From 3c7e8ff989355bf518eabaeea83036585e4782b7 Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Tue, 16 Aug 2022 18:29:47 -0400 Subject: [PATCH] [core] remove unimrcp from tree --- LICENSE | 6 - bootstrap.sh | 2 +- build/buildmrcpserver.sh | 6 - build/modules.conf.in | 1 - build/modules.conf.most | 1 - conf/rayo/autoload_configs/rayo.conf.xml | 30 - .../vanilla/autoload_configs/unimrcp.conf.xml | 23 - .../mrcp_profiles/loquendo-7-mrcp-v2.xml | 32 - .../mrcp_profiles/nuance-1.0.0-mrcp-v1.xml | 39 - .../mrcp_profiles/nuance-5.0-mrcp-v1.xml | 39 - .../mrcp_profiles/nuance-5.0-mrcp-v2.xml | 43 - .../mrcp_profiles/unimrcpserver-mrcp-v1.xml | 27 - conf/vanilla/mrcp_profiles/vestec-mrcp-v1.xml | 26 - .../voxeo-prophecy-8.0-mrcp-v1.xml | 27 - configure.ac | 4 +- debian/bootstrap.sh | 2 - debian/control-modules | 4 - debian/copyright | 6 - docs/Doxygen.conf | 2 +- freeswitch.spec | 15 +- libs/.gitignore | 98 - libs/unimrcp/.gitignore | 1 - libs/unimrcp/.update | 1 - libs/unimrcp/AUTHORS | 17 - libs/unimrcp/CHANGES | 214 - libs/unimrcp/INSTALL | 158 - libs/unimrcp/LICENSE | 202 - libs/unimrcp/Makefile.am | 36 - libs/unimrcp/NOTICE | 47 - libs/unimrcp/README | 59 - libs/unimrcp/acinclude.m4 | 7 - libs/unimrcp/bootstrap | 14 - libs/unimrcp/build/Makefile.am | 5 - libs/unimrcp/build/acmacros/apr.m4 | 79 - libs/unimrcp/build/acmacros/apr_common.m4 | 990 ---- libs/unimrcp/build/acmacros/apu.m4 | 2 - .../build/acmacros/ax_compiler_vendor.m4 | 41 - libs/unimrcp/build/acmacros/find_apr.m4 | 167 - libs/unimrcp/build/acmacros/find_apu.m4 | 176 - libs/unimrcp/build/acmacros/sofia-sip.m4 | 85 - libs/unimrcp/build/acmacros/uni_plugin.m4 | 45 - libs/unimrcp/build/get-version.sh | 37 - libs/unimrcp/build/init.d/unimrcp-server | 270 - libs/unimrcp/build/pkgconfig/Makefile.am | 4 - .../build/pkgconfig/unimrcpclient.pc.in | 11 - .../build/pkgconfig/unimrcpplugin.pc.in | 11 - .../build/pkgconfig/unimrcpserver.pc.in | 11 - libs/unimrcp/build/props/apr.props | 33 - libs/unimrcp/build/props/apt.props | 18 - libs/unimrcp/build/props/mpf.props | 18 - libs/unimrcp/build/props/mrcp.props | 18 - libs/unimrcp/build/props/mrcpclient.props | 15 - libs/unimrcp/build/props/mrcpengine.props | 15 - libs/unimrcp/build/props/mrcpserver.props | 16 - libs/unimrcp/build/props/mrcpsignaling.props | 15 - .../unimrcp/build/props/mrcpv2transport.props | 14 - .../build/props/sdk/unimrcpclient.props | 14 - .../build/props/sdk/unimrcpplugin.props | 14 - libs/unimrcp/build/props/sdk/unimrcpsdk.props | 23 - .../build/props/sdk/unimrcpserver.props | 14 - libs/unimrcp/build/props/sofiasip.props | 25 - libs/unimrcp/build/props/unibase.props | 29 - libs/unimrcp/build/props/unibin-x64.props | 21 - libs/unimrcp/build/props/unibin.props | 18 - libs/unimrcp/build/props/unidebug.props | 25 - libs/unimrcp/build/props/unilib-x64.props | 13 - libs/unimrcp/build/props/unilib.props | 8 - libs/unimrcp/build/props/unimrcpclient.props | 23 - libs/unimrcp/build/props/unimrcpserver.props | 23 - libs/unimrcp/build/props/uniplugin-x64.props | 22 - libs/unimrcp/build/props/uniplugin.props | 19 - libs/unimrcp/build/props/unirelease.props | 18 - libs/unimrcp/build/props/unirtsp.props | 15 - libs/unimrcp/build/rules/uniclientapp.am | 24 - libs/unimrcp/build/rules/uniclientlib.am | 30 - libs/unimrcp/build/rules/uniplugin.am | 14 - libs/unimrcp/build/rules/uniserverapp.am | 25 - libs/unimrcp/build/rules/uniserverlib.am | 32 - libs/unimrcp/build/tools/prepare.vcproj | 122 - libs/unimrcp/build/tools/prepare.vcxproj | 205 - libs/unimrcp/build/tools/unimrcp_service.c | 446 -- .../build/tools/unimrcpservice.exe.manifest | 11 - libs/unimrcp/build/tools/unimrcpservice.rc | 39 - .../unimrcp/build/tools/unimrcpservice.vcproj | 326 -- .../build/tools/unimrcpservice.vcxproj | 136 - .../tools/unimrcpservice.vcxproj.filters | 17 - libs/unimrcp/build/uni_revision.h | 43 - libs/unimrcp/build/uni_version.h | 100 - libs/unimrcp/build/vsprops/apr.vsprops | 24 - libs/unimrcp/build/vsprops/apt.vsprops | 13 - libs/unimrcp/build/vsprops/mpf.vsprops | 13 - libs/unimrcp/build/vsprops/mrcp.vsprops | 13 - libs/unimrcp/build/vsprops/mrcpclient.vsprops | 12 - libs/unimrcp/build/vsprops/mrcpengine.vsprops | 12 - libs/unimrcp/build/vsprops/mrcpserver.vsprops | 12 - .../build/vsprops/mrcpsignaling.vsprops | 12 - .../build/vsprops/mrcpv2transport.vsprops | 12 - .../build/vsprops/sdk/unimrcpclient.vsprops | 12 - .../build/vsprops/sdk/unimrcpplugin.vsprops | 12 - .../build/vsprops/sdk/unimrcpsdk.vsprops | 21 - .../build/vsprops/sdk/unimrcpserver.vsprops | 12 - libs/unimrcp/build/vsprops/sofiasip.vsprops | 16 - libs/unimrcp/build/vsprops/unibase.vsprops | 22 - libs/unimrcp/build/vsprops/unibin-x64.vsprops | 19 - libs/unimrcp/build/vsprops/unibin.vsprops | 15 - libs/unimrcp/build/vsprops/unidebug.vsprops | 23 - libs/unimrcp/build/vsprops/unilib-x64.vsprops | 17 - libs/unimrcp/build/vsprops/unilib.vsprops | 13 - .../build/vsprops/unimrcpclient.vsprops | 16 - .../build/vsprops/unimrcpserver.vsprops | 16 - .../build/vsprops/uniplugin-x64.vsprops | 20 - libs/unimrcp/build/vsprops/uniplugin.vsprops | 16 - libs/unimrcp/build/vsprops/unirelease.vsprops | 15 - libs/unimrcp/build/vsprops/unirtsp.vsprops | 13 - libs/unimrcp/conf/Makefile.am | 31 - .../unimrcp/conf/client-profiles/lumenvox.xml | 50 - libs/unimrcp/conf/client-profiles/nuance.xml | 78 - .../conf/client-profiles/speechpro.xml | 33 - libs/unimrcp/conf/client-profiles/unimrcp.xml | 51 - libs/unimrcp/conf/dirlayout.xml | 26 - libs/unimrcp/conf/logger.xml | 38 - libs/unimrcp/conf/umcscenarios.xml | 117 - libs/unimrcp/conf/unimrcpclient.xml | 111 - libs/unimrcp/conf/unimrcpclient.xsd | 277 - libs/unimrcp/conf/unimrcpserver.xml | 166 - libs/unimrcp/conf/unimrcpserver.xsd | 277 - libs/unimrcp/config.layout | 26 - libs/unimrcp/configure.ac | 285 - libs/unimrcp/configure.gnu | 3 - libs/unimrcp/data/Makefile.am | 31 - libs/unimrcp/data/demo-16kHz.pcm | Bin 70444 -> 0 bytes libs/unimrcp/data/demo-8kHz.pcm | Bin 35200 -> 0 bytes libs/unimrcp/data/grammar.jsgf | 3 - libs/unimrcp/data/grammar.mixed | 19 - libs/unimrcp/data/grammar.srgs | 4 - libs/unimrcp/data/grammar.xml | 10 - libs/unimrcp/data/johnsmith-16kHz.pcm | Bin 33214 -> 0 bytes libs/unimrcp/data/johnsmith-8kHz.pcm | Bin 16000 -> 0 bytes libs/unimrcp/data/one-16kHz.pcm | Bin 64508 -> 0 bytes libs/unimrcp/data/one-8kHz.pcm | Bin 32318 -> 0 bytes libs/unimrcp/data/result-verification.xml | 21 - libs/unimrcp/data/result.xml | 7 - libs/unimrcp/data/speak.txt | 1 - libs/unimrcp/data/speak.xml | 6 - libs/unimrcp/docs/doxygen.conf.in | 34 - libs/unimrcp/docs/mainpage.docs | 71 - libs/unimrcp/libs/Makefile.am | 3 - libs/unimrcp/libs/apr-toolkit/Makefile.am | 50 - .../libs/apr-toolkit/aprtoolkit.2017.vcxproj | 167 - .../libs/apr-toolkit/aprtoolkit.vcproj | 417 -- .../libs/apr-toolkit/aprtoolkit.vcxproj | 139 - .../apr-toolkit/aprtoolkit.vcxproj.filters | 143 - libs/unimrcp/libs/apr-toolkit/include/apt.h | 61 - .../apr-toolkit/include/apt_consumer_task.h | 79 - .../apr-toolkit/include/apt_cyclic_queue.h | 79 - .../libs/apr-toolkit/include/apt_dir_layout.h | 162 - .../apr-toolkit/include/apt_header_field.h | 178 - .../libs/apr-toolkit/include/apt_log.h | 274 - .../include/apt_multipart_content.h | 108 - .../libs/apr-toolkit/include/apt_net.h | 55 - .../libs/apr-toolkit/include/apt_nlsml_doc.h | 210 - .../libs/apr-toolkit/include/apt_obj_list.h | 139 - .../libs/apr-toolkit/include/apt_pair.h | 75 - .../apr-toolkit/include/apt_poller_task.h | 130 - .../libs/apr-toolkit/include/apt_pollset.h | 98 - .../libs/apr-toolkit/include/apt_pool.h | 49 - .../libs/apr-toolkit/include/apt_string.h | 156 - .../apr-toolkit/include/apt_string_table.h | 65 - .../libs/apr-toolkit/include/apt_task.h | 262 - .../libs/apr-toolkit/include/apt_task_msg.h | 86 - .../libs/apr-toolkit/include/apt_test_suite.h | 101 - .../apr-toolkit/include/apt_text_message.h | 125 - .../apr-toolkit/include/apt_text_stream.h | 241 - .../apr-toolkit/include/apt_timer_queue.h | 68 - .../libs/apr-toolkit/src/apt_consumer_task.c | 164 - .../libs/apr-toolkit/src/apt_cyclic_queue.c | 106 - .../libs/apr-toolkit/src/apt_dir_layout.c | 317 -- .../libs/apr-toolkit/src/apt_header_field.c | 187 - libs/unimrcp/libs/apr-toolkit/src/apt_log.c | 627 --- .../apr-toolkit/src/apt_multipart_content.c | 312 -- libs/unimrcp/libs/apr-toolkit/src/apt_net.c | 153 - .../libs/apr-toolkit/src/apt_nlsml_doc.c | 569 -- .../libs/apr-toolkit/src/apt_obj_list.c | 153 - libs/unimrcp/libs/apr-toolkit/src/apt_pair.c | 88 - .../libs/apr-toolkit/src/apt_poller_task.c | 296 -- .../libs/apr-toolkit/src/apt_pollset.c | 325 -- libs/unimrcp/libs/apr-toolkit/src/apt_pool.c | 57 - .../libs/apr-toolkit/src/apt_string_table.c | 68 - libs/unimrcp/libs/apr-toolkit/src/apt_task.c | 623 --- .../libs/apr-toolkit/src/apt_task_msg.c | 105 - .../libs/apr-toolkit/src/apt_test_suite.c | 121 - .../libs/apr-toolkit/src/apt_text_message.c | 451 -- .../libs/apr-toolkit/src/apt_text_stream.c | 554 -- .../libs/apr-toolkit/src/apt_timer_queue.c | 229 - libs/unimrcp/libs/mpf/Makefile.am | 82 - libs/unimrcp/libs/mpf/codecs/g711/g711.c | 73 - libs/unimrcp/libs/mpf/codecs/g711/g711.h | 374 -- libs/unimrcp/libs/mpf/include/mpf.h | 44 - .../libs/mpf/include/mpf_activity_detector.h | 68 - .../mpf/include/mpf_audio_file_descriptor.h | 56 - .../libs/mpf/include/mpf_audio_file_stream.h | 48 - libs/unimrcp/libs/mpf/include/mpf_bridge.h | 49 - libs/unimrcp/libs/mpf/include/mpf_buffer.h | 58 - libs/unimrcp/libs/mpf/include/mpf_codec.h | 177 - .../libs/mpf/include/mpf_codec_descriptor.h | 283 - .../libs/mpf/include/mpf_codec_manager.h | 55 - libs/unimrcp/libs/mpf/include/mpf_context.h | 133 - libs/unimrcp/libs/mpf/include/mpf_decoder.h | 42 - .../libs/mpf/include/mpf_dtmf_detector.h | 123 - .../libs/mpf/include/mpf_dtmf_generator.h | 131 - libs/unimrcp/libs/mpf/include/mpf_encoder.h | 42 - libs/unimrcp/libs/mpf/include/mpf_engine.h | 165 - .../libs/mpf/include/mpf_engine_factory.h | 48 - .../include/mpf_file_termination_factory.h | 39 - libs/unimrcp/libs/mpf/include/mpf_frame.h | 66 - .../libs/mpf/include/mpf_frame_buffer.h | 56 - .../libs/mpf/include/mpf_jitter_buffer.h | 68 - libs/unimrcp/libs/mpf/include/mpf_message.h | 94 - libs/unimrcp/libs/mpf/include/mpf_mixer.h | 51 - .../unimrcp/libs/mpf/include/mpf_multiplier.h | 51 - .../libs/mpf/include/mpf_named_event.h | 73 - libs/unimrcp/libs/mpf/include/mpf_object.h | 79 - libs/unimrcp/libs/mpf/include/mpf_resampler.h | 42 - .../libs/mpf/include/mpf_rtcp_packet.h | 203 - .../libs/mpf/include/mpf_rtp_attribs.h | 56 - libs/unimrcp/libs/mpf/include/mpf_rtp_defs.h | 185 - .../libs/mpf/include/mpf_rtp_descriptor.h | 219 - .../unimrcp/libs/mpf/include/mpf_rtp_header.h | 88 - libs/unimrcp/libs/mpf/include/mpf_rtp_pt.h | 48 - libs/unimrcp/libs/mpf/include/mpf_rtp_stat.h | 115 - .../unimrcp/libs/mpf/include/mpf_rtp_stream.h | 62 - .../mpf/include/mpf_rtp_termination_factory.h | 42 - libs/unimrcp/libs/mpf/include/mpf_scheduler.h | 68 - libs/unimrcp/libs/mpf/include/mpf_stream.h | 171 - .../libs/mpf/include/mpf_stream_descriptor.h | 90 - .../libs/mpf/include/mpf_termination.h | 121 - .../mpf/include/mpf_termination_factory.h | 105 - libs/unimrcp/libs/mpf/include/mpf_trace.h | 51 - libs/unimrcp/libs/mpf/include/mpf_types.h | 61 - .../unimrcp/libs/mpf/mpf.2010.vcxproj.filters | 236 - libs/unimrcp/libs/mpf/mpf.2017.vcxproj | 201 - libs/unimrcp/libs/mpf/mpf.vcproj | 552 -- libs/unimrcp/libs/mpf/mpf.vcxproj | 200 - libs/unimrcp/libs/mpf/mpf.vcxproj.filters | 239 - .../libs/mpf/src/mpf_activity_detector.c | 183 - .../libs/mpf/src/mpf_audio_file_stream.c | 171 - libs/unimrcp/libs/mpf/src/mpf_bridge.c | 230 - libs/unimrcp/libs/mpf/src/mpf_buffer.c | 175 - .../libs/mpf/src/mpf_codec_descriptor.c | 279 - libs/unimrcp/libs/mpf/src/mpf_codec_g711.c | 191 - libs/unimrcp/libs/mpf/src/mpf_codec_linear.c | 90 - libs/unimrcp/libs/mpf/src/mpf_codec_manager.c | 199 - libs/unimrcp/libs/mpf/src/mpf_context.c | 548 -- libs/unimrcp/libs/mpf/src/mpf_decoder.c | 129 - libs/unimrcp/libs/mpf/src/mpf_dtmf_detector.c | 302 -- .../unimrcp/libs/mpf/src/mpf_dtmf_generator.c | 349 -- libs/unimrcp/libs/mpf/src/mpf_encoder.c | 125 - libs/unimrcp/libs/mpf/src/mpf_engine.c | 453 -- .../unimrcp/libs/mpf/src/mpf_engine_factory.c | 78 - .../mpf/src/mpf_file_termination_factory.c | 86 - libs/unimrcp/libs/mpf/src/mpf_frame_buffer.c | 184 - libs/unimrcp/libs/mpf/src/mpf_jitter_buffer.c | 510 -- libs/unimrcp/libs/mpf/src/mpf_mixer.c | 210 - libs/unimrcp/libs/mpf/src/mpf_multiplier.c | 187 - libs/unimrcp/libs/mpf/src/mpf_named_event.c | 76 - libs/unimrcp/libs/mpf/src/mpf_resampler.c | 28 - libs/unimrcp/libs/mpf/src/mpf_rtp_attribs.c | 60 - libs/unimrcp/libs/mpf/src/mpf_rtp_stream.c | 1507 ------ .../mpf/src/mpf_rtp_termination_factory.c | 204 - libs/unimrcp/libs/mpf/src/mpf_scheduler.c | 267 - libs/unimrcp/libs/mpf/src/mpf_stream.c | 160 - libs/unimrcp/libs/mpf/src/mpf_termination.c | 75 - .../libs/mpf/src/mpf_termination_factory.c | 85 - libs/unimrcp/libs/mrcp-client/Makefile.am | 23 - .../mrcp-client/include/mrcp_application.h | 360 -- .../libs/mrcp-client/include/mrcp_client.h | 254 - .../mrcp-client/include/mrcp_client_session.h | 215 - .../mrcp-client/include/mrcp_client_types.h | 50 - .../libs/mrcp-client/mrcpclient.2017.vcxproj | 131 - .../libs/mrcp-client/mrcpclient.vcproj | 280 - .../libs/mrcp-client/mrcpclient.vcxproj | 125 - .../mrcp-client/mrcpclient.vcxproj.filters | 38 - .../libs/mrcp-client/src/mrcp_application.c | 549 -- .../libs/mrcp-client/src/mrcp_client.c | 989 ---- .../mrcp-client/src/mrcp_client_session.c | 1314 ----- libs/unimrcp/libs/mrcp-engine/Makefile.am | 38 - .../mrcp-engine/include/mrcp_engine_factory.h | 62 - .../mrcp-engine/include/mrcp_engine_iface.h | 85 - .../mrcp-engine/include/mrcp_engine_impl.h | 135 - .../mrcp-engine/include/mrcp_engine_loader.h | 54 - .../mrcp-engine/include/mrcp_engine_plugin.h | 126 - .../mrcp-engine/include/mrcp_engine_types.h | 156 - .../mrcp-engine/include/mrcp_recog_engine.h | 35 - .../include/mrcp_recog_state_machine.h | 36 - .../include/mrcp_recorder_engine.h | 35 - .../include/mrcp_recorder_state_machine.h | 36 - .../include/mrcp_resource_engine.h | 51 - .../mrcp-engine/include/mrcp_state_machine.h | 86 - .../mrcp-engine/include/mrcp_synth_engine.h | 35 - .../include/mrcp_synth_state_machine.h | 36 - .../include/mrcp_verifier_engine.h | 35 - .../include/mrcp_verifier_state_machine.h | 36 - .../libs/mrcp-engine/mrcpengine.vcproj | 348 -- .../libs/mrcp-engine/mrcpengine.vcxproj | 142 - .../mrcp-engine/mrcpengine.vcxproj.filters | 89 - .../mrcp-engine/src/mrcp_engine_factory.c | 157 - .../libs/mrcp-engine/src/mrcp_engine_iface.c | 102 - .../libs/mrcp-engine/src/mrcp_engine_impl.c | 246 - .../libs/mrcp-engine/src/mrcp_engine_loader.c | 169 - .../src/mrcp_recog_state_machine.c | 553 -- .../src/mrcp_recorder_state_machine.c | 389 -- .../src/mrcp_synth_state_machine.c | 612 --- .../src/mrcp_verifier_state_machine.c | 524 -- libs/unimrcp/libs/mrcp-server/Makefile.am | 22 - .../libs/mrcp-server/include/mrcp_server.h | 226 - .../mrcp-server/include/mrcp_server_session.h | 163 - .../mrcp-server/include/mrcp_server_types.h | 42 - .../libs/mrcp-server/mrcpserver.vcproj | 272 - .../libs/mrcp-server/mrcpserver.vcxproj | 127 - .../mrcp-server/mrcpserver.vcxproj.filters | 32 - .../libs/mrcp-server/src/mrcp_server.c | 999 ---- .../mrcp-server/src/mrcp_server_session.c | 1191 ----- libs/unimrcp/libs/mrcp-signaling/Makefile.am | 17 - .../mrcp-signaling/include/mrcp_session.h | 206 - .../include/mrcp_session_descriptor.h | 150 - .../mrcp-signaling/include/mrcp_sig_agent.h | 97 - .../mrcp-signaling/include/mrcp_sig_types.h | 48 - .../mrcpsignaling.2010.vcxproj.filters | 35 - .../mrcp-signaling/mrcpsignaling.2017.vcxproj | 130 - .../libs/mrcp-signaling/mrcpsignaling.vcproj | 276 - .../libs/mrcp-signaling/mrcpsignaling.vcxproj | 124 - .../mrcpsignaling.vcxproj.filters | 35 - .../src/mrcp_session_descriptor.c | 52 - .../libs/mrcp-signaling/src/mrcp_sig_agent.c | 128 - libs/unimrcp/libs/mrcp/Makefile.am | 47 - .../libs/mrcp/control/include/mrcp_resource.h | 82 - .../control/include/mrcp_resource_factory.h | 50 - .../control/include/mrcp_resource_loader.h | 53 - .../libs/mrcp/control/include/mrcp_stream.h | 69 - .../mrcp/control/src/mrcp_resource_factory.c | 101 - .../mrcp/control/src/mrcp_resource_loader.c | 140 - .../libs/mrcp/control/src/mrcp_stream.c | 245 - libs/unimrcp/libs/mrcp/include/mrcp.h | 45 - libs/unimrcp/libs/mrcp/include/mrcp_types.h | 83 - .../message/include/mrcp_generic_header.h | 125 - .../libs/mrcp/message/include/mrcp_header.h | 121 - .../message/include/mrcp_header_accessor.h | 131 - .../libs/mrcp/message/include/mrcp_message.h | 253 - .../mrcp/message/include/mrcp_start_line.h | 117 - .../mrcp/message/src/mrcp_generic_header.c | 350 -- .../libs/mrcp/message/src/mrcp_header.c | 265 - .../mrcp/message/src/mrcp_header_accessor.c | 84 - .../libs/mrcp/message/src/mrcp_message.c | 259 - .../libs/mrcp/message/src/mrcp_start_line.c | 452 -- .../libs/mrcp/mrcp.2010.vcxproj.filters | 133 - libs/unimrcp/libs/mrcp/mrcp.2017.vcxproj | 163 - libs/unimrcp/libs/mrcp/mrcp.vcproj | 433 -- libs/unimrcp/libs/mrcp/mrcp.vcxproj | 157 - libs/unimrcp/libs/mrcp/mrcp.vcxproj.filters | 151 - .../resources/include/mrcp_recog_header.h | 273 - .../resources/include/mrcp_recog_resource.h | 64 - .../resources/include/mrcp_recorder_header.h | 138 - .../include/mrcp_recorder_resource.h | 55 - .../resources/include/mrcp_synth_header.h | 304 -- .../resources/include/mrcp_synth_resource.h | 60 - .../resources/include/mrcp_verifier_header.h | 162 - .../include/mrcp_verifier_resource.h | 63 - .../mrcp/resources/src/mrcp_recog_header.c | 781 --- .../mrcp/resources/src/mrcp_recog_resource.c | 99 - .../mrcp/resources/src/mrcp_recorder_header.c | 282 - .../resources/src/mrcp_recorder_resource.c | 59 - .../mrcp/resources/src/mrcp_synth_header.c | 563 -- .../mrcp/resources/src/mrcp_synth_resource.c | 63 - .../mrcp/resources/src/mrcp_verifier_header.c | 352 -- .../resources/src/mrcp_verifier_resource.c | 68 - .../unimrcp/libs/mrcpv2-transport/Makefile.am | 23 - .../include/mrcp_ca_factory.h | 45 - .../include/mrcp_client_connection.h | 186 - .../include/mrcp_connection.h | 110 - .../include/mrcp_connection_types.h | 140 - .../include/mrcp_control_descriptor.h | 147 - .../include/mrcp_server_connection.h | 175 - .../mrcpv2transport.2010.vcxproj.filters | 47 - .../mrcpv2transport.2017.vcxproj | 134 - .../mrcpv2-transport/mrcpv2transport.vcproj | 296 -- .../mrcpv2-transport/mrcpv2transport.vcxproj | 125 - .../mrcpv2transport.vcxproj.filters | 50 - .../mrcpv2-transport/src/mrcp_ca_factory.c | 65 - .../src/mrcp_client_connection.c | 696 --- .../mrcpv2-transport/src/mrcp_connection.c | 104 - .../src/mrcp_control_descriptor.c | 147 - .../src/mrcp_server_connection.c | 715 --- libs/unimrcp/libs/uni-rtsp/Makefile.am | 22 - libs/unimrcp/libs/uni-rtsp/include/rtsp.h | 45 - .../libs/uni-rtsp/include/rtsp_client.h | 155 - .../libs/uni-rtsp/include/rtsp_header.h | 232 - .../libs/uni-rtsp/include/rtsp_message.h | 78 - .../libs/uni-rtsp/include/rtsp_server.h | 147 - .../libs/uni-rtsp/include/rtsp_start_line.h | 181 - .../libs/uni-rtsp/include/rtsp_stream.h | 54 - libs/unimrcp/libs/uni-rtsp/src/rtsp_client.c | 992 ---- libs/unimrcp/libs/uni-rtsp/src/rtsp_header.c | 420 -- libs/unimrcp/libs/uni-rtsp/src/rtsp_message.c | 80 - libs/unimrcp/libs/uni-rtsp/src/rtsp_server.c | 889 ---- .../libs/uni-rtsp/src/rtsp_start_line.c | 261 - libs/unimrcp/libs/uni-rtsp/src/rtsp_stream.c | 124 - .../uni-rtsp/unirtsp.2010.vcxproj.filters | 56 - .../libs/uni-rtsp/unirtsp.2017.vcxproj | 141 - libs/unimrcp/libs/uni-rtsp/unirtsp.vcproj | 304 -- libs/unimrcp/libs/uni-rtsp/unirtsp.vcxproj | 127 - .../libs/uni-rtsp/unirtsp.vcxproj.filters | 56 - libs/unimrcp/modules/Makefile.am | 3 - .../unimrcp/modules/mrcp-sofiasip/Makefile.am | 22 - .../modules/mrcp-sofiasip/include/mrcp_sdp.h | 42 - .../include/mrcp_sofiasip_client_agent.h | 82 - .../include/mrcp_sofiasip_server_agent.h | 85 - .../mrcpsofiasip.2010.vcxproj.filters | 38 - .../mrcp-sofiasip/mrcpsofiasip.2017.vcxproj | 143 - .../modules/mrcp-sofiasip/mrcpsofiasip.vcproj | 288 - .../mrcp-sofiasip/mrcpsofiasip.vcxproj | 147 - .../mrcpsofiasip.vcxproj.filters | 38 - .../modules/mrcp-sofiasip/src/mrcp_sdp.c | 421 -- .../src/mrcp_sofiasip_client_agent.c | 637 --- .../mrcp-sofiasip/src/mrcp_sofiasip_logger.c | 92 - .../src/mrcp_sofiasip_server_agent.c | 477 -- libs/unimrcp/modules/mrcp-unirtsp/Makefile.am | 22 - .../include/mrcp_unirtsp_client_agent.h | 59 - .../mrcp-unirtsp/include/mrcp_unirtsp_sdp.h | 89 - .../include/mrcp_unirtsp_server_agent.h | 70 - .../mrcpunirtsp.2010.vcxproj.filters | 35 - .../mrcp-unirtsp/mrcpunirtsp.2017.vcxproj | 146 - .../modules/mrcp-unirtsp/mrcpunirtsp.vcproj | 280 - .../modules/mrcp-unirtsp/mrcpunirtsp.vcxproj | 146 - .../mrcp-unirtsp/mrcpunirtsp.vcxproj.filters | 35 - .../src/mrcp_unirtsp_client_agent.c | 437 -- .../mrcp-unirtsp/src/mrcp_unirtsp_sdp.c | 598 --- .../src/mrcp_unirtsp_server_agent.c | 381 -- .../packages/inno-setup/setup-sdk-win32.txt | 3 - .../packages/inno-setup/setup-sdk-x64.txt | 4 - .../packages/inno-setup/setup-win32.txt | 3 - .../unimrcp/packages/inno-setup/setup-x64.txt | 5 - libs/unimrcp/packages/inno-setup/setup.txt | 14 - .../packages/inno-setup/unimrcp-sdk.iss | 56 - libs/unimrcp/packages/inno-setup/unimrcp.iss | 91 - libs/unimrcp/platforms/Makefile.am | 27 - libs/unimrcp/platforms/asr-client/Makefile.am | 10 - .../platforms/asr-client/asrclient.vcproj | 298 -- .../platforms/asr-client/asrclient.vcxproj | 136 - .../asr-client/asrclient.vcxproj.filters | 18 - libs/unimrcp/platforms/asr-client/src/main.c | 300 -- .../platforms/libasr-client/Makefile.am | 12 - .../libasr-client/include/asr_engine.h | 133 - .../libasr-client/libasrclient.vcproj | 308 -- .../libasr-client/libasrclient.vcxproj | 148 - .../libasrclient.vcxproj.filters | 23 - .../platforms/libasr-client/src/asr_engine.c | 752 --- .../platforms/libunimrcp-client/Makefile.am | 11 - .../include/unimrcp_client.h | 46 - .../libunimrcp-client/libunimrcpclient.vcproj | 272 - .../libunimrcpclient.vcxproj | 140 - .../libunimrcpclient.vcxproj.filters | 29 - .../libunimrcp-client/src/unimrcp_client.c | 1416 ----- .../platforms/libunimrcp-server/Makefile.am | 11 - .../include/unimrcp_server.h | 45 - .../libunimrcp-server/libunimrcpserver.vcproj | 272 - .../libunimrcpserver.vcxproj | 140 - .../libunimrcpserver.vcxproj.filters | 29 - .../libunimrcp-server/src/unimrcp_server.c | 1251 ----- libs/unimrcp/platforms/umc/Makefile.am | 26 - .../platforms/umc/include/dtmfscenario.h | 77 - .../platforms/umc/include/dtmfsession.h | 70 - .../platforms/umc/include/recogscenario.h | 97 - .../platforms/umc/include/recogsession.h | 75 - .../platforms/umc/include/recorderscenario.h | 68 - .../platforms/umc/include/recordersession.h | 70 - .../platforms/umc/include/setparamscenario.h | 49 - .../platforms/umc/include/setparamsession.h | 78 - .../platforms/umc/include/synthscenario.h | 76 - .../platforms/umc/include/synthsession.h | 69 - .../platforms/umc/include/umcconsole.h | 65 - .../platforms/umc/include/umcframework.h | 96 - .../platforms/umc/include/umcscenario.h | 129 - .../platforms/umc/include/umcsession.h | 131 - .../platforms/umc/include/verifierscenario.h | 75 - .../platforms/umc/include/verifiersession.h | 74 - .../platforms/umc/src/dtmfscenario.cpp | 79 - .../unimrcp/platforms/umc/src/dtmfsession.cpp | 279 - libs/unimrcp/platforms/umc/src/main.cpp | 26 - .../platforms/umc/src/recogscenario.cpp | 116 - .../platforms/umc/src/recogsession.cpp | 456 -- .../platforms/umc/src/recorderscenario.cpp | 72 - .../platforms/umc/src/recordersession.cpp | 286 - .../platforms/umc/src/setparamscenario.cpp | 25 - .../platforms/umc/src/setparamsession.cpp | 390 -- .../platforms/umc/src/synthscenario.cpp | 82 - .../platforms/umc/src/synthsession.cpp | 299 -- libs/unimrcp/platforms/umc/src/umcconsole.cpp | 333 -- .../platforms/umc/src/umcframework.cpp | 632 --- .../unimrcp/platforms/umc/src/umcscenario.cpp | 234 - libs/unimrcp/platforms/umc/src/umcsession.cpp | 252 - .../platforms/umc/src/verifierscenario.cpp | 82 - .../platforms/umc/src/verifiersession.cpp | 396 -- libs/unimrcp/platforms/umc/umc.rc | 39 - libs/unimrcp/platforms/umc/umc.vcproj | 460 -- libs/unimrcp/platforms/umc/umc.vcxproj | 176 - .../unimrcp/platforms/umc/umc.vcxproj.filters | 119 - .../platforms/unimrcp-client/Makefile.am | 16 - .../unimrcp-client/include/demo_application.h | 63 - .../unimrcp-client/include/demo_framework.h | 55 - .../unimrcp-client/include/demo_util.h | 44 - .../src/demo_bypass_application.c | 213 - .../src/demo_discover_application.c | 116 - .../unimrcp-client/src/demo_framework.c | 245 - .../src/demo_recog_application.c | 380 -- .../src/demo_synth_application.c | 317 -- .../platforms/unimrcp-client/src/demo_util.c | 176 - .../platforms/unimrcp-client/src/main.c | 275 - .../platforms/unimrcp-client/unimrcpclient.rc | 39 - .../unimrcp-client/unimrcpclient.vcproj | 368 -- .../unimrcp-client/unimrcpclient.vcxproj | 153 - .../unimrcpclient.vcxproj.filters | 50 - .../platforms/unimrcp-server/Makefile.am | 9 - .../platforms/unimrcp-server/src/main.c | 257 - .../unimrcp-server/src/uni_cmdline.c | 83 - .../platforms/unimrcp-server/src/uni_daemon.c | 52 - .../unimrcp-server/src/uni_service.c | 121 - .../platforms/unimrcp-server/unimrcpserver.rc | 39 - .../unimrcp-server/unimrcpserver.vcproj | 340 -- .../unimrcp-server/unimrcpserver.vcxproj | 135 - .../unimrcpserver.vcxproj.filters | 30 - libs/unimrcp/plugins/Makefile.am | 19 - libs/unimrcp/plugins/demo-recog/Makefile.am | 8 - .../plugins/demo-recog/demorecog.vcproj | 296 -- .../plugins/demo-recog/demorecog.vcxproj | 123 - .../demo-recog/demorecog.vcxproj.filters | 18 - .../demo-recog/src/demo_recog_engine.c | 564 -- libs/unimrcp/plugins/demo-synth/Makefile.am | 8 - .../plugins/demo-synth/demosynth.vcproj | 296 -- .../plugins/demo-synth/demosynth.vcxproj | 123 - .../demo-synth/demosynth.vcxproj.filters | 18 - .../demo-synth/src/demo_synth_engine.c | 557 -- .../unimrcp/plugins/demo-verifier/Makefile.am | 8 - .../plugins/demo-verifier/demoverifier.vcproj | 296 -- .../demo-verifier/demoverifier.vcxproj | 123 - .../demoverifier.vcxproj.filters | 18 - .../demo-verifier/src/demo_verifier_engine.c | 589 --- .../unimrcp/plugins/mrcp-recorder/Makefile.am | 8 - .../plugins/mrcp-recorder/mrcprecorder.vcproj | 296 -- .../mrcp-recorder/mrcprecorder.vcxproj | 123 - .../mrcprecorder.vcxproj.filters | 18 - .../mrcp-recorder/src/mrcp_recorder_engine.c | 481 -- libs/unimrcp/tests/Makefile.am | 3 - libs/unimrcp/tests/apttest/Makefile.am | 12 - libs/unimrcp/tests/apttest/apttest.vcproj | 304 -- libs/unimrcp/tests/apttest/apttest.vcxproj | 127 - .../tests/apttest/apttest.vcxproj.filters | 27 - .../tests/apttest/src/consumer_task_suite.c | 102 - libs/unimrcp/tests/apttest/src/main.c | 60 - .../tests/apttest/src/multipart_suite.c | 98 - libs/unimrcp/tests/apttest/src/task_suite.c | 64 - libs/unimrcp/tests/mpftest/Makefile.am | 12 - libs/unimrcp/tests/mpftest/mpftest.vcproj | 296 -- libs/unimrcp/tests/mpftest/mpftest.vcxproj | 125 - .../tests/mpftest/mpftest.vcxproj.filters | 21 - libs/unimrcp/tests/mpftest/src/main.c | 52 - libs/unimrcp/tests/mpftest/src/mpf_suite.c | 571 -- libs/unimrcp/tests/mrcptest/Makefile.am | 17 - libs/unimrcp/tests/mrcptest/mrcptest.vcproj | 304 -- libs/unimrcp/tests/mrcptest/mrcptest.vcxproj | 127 - .../tests/mrcptest/mrcptest.vcxproj.filters | 27 - libs/unimrcp/tests/mrcptest/src/main.c | 58 - .../tests/mrcptest/src/parse_gen_suite.c | 212 - .../tests/mrcptest/src/set_get_suite.c | 326 -- .../mrcptest/src/transparent_set_get_suite.c | 252 - .../tests/mrcptest/v1/definegrammar.msg | 18 - libs/unimrcp/tests/mrcptest/v1/getparams.msg | 5 - libs/unimrcp/tests/mrcptest/v1/multi.msg | 27 - libs/unimrcp/tests/mrcptest/v1/pause.msg | 3 - .../tests/mrcptest/v1/recognitioncomplete.msg | 20 - libs/unimrcp/tests/mrcptest/v1/recognize.msg | 30 - libs/unimrcp/tests/mrcptest/v1/response.msg | 3 - libs/unimrcp/tests/mrcptest/v1/resume.msg | 3 - libs/unimrcp/tests/mrcptest/v1/setparams.msg | 5 - libs/unimrcp/tests/mrcptest/v1/speak.msg | 19 - .../tests/mrcptest/v1/speakcomplete.msg | 4 - libs/unimrcp/tests/mrcptest/v1/stop.msg | 3 - .../tests/mrcptest/v2/definegrammar.msg | 30 - libs/unimrcp/tests/mrcptest/v2/getparams.msg | 5 - .../tests/mrcptest/v2/recognitioncomplete.msg | 20 - libs/unimrcp/tests/mrcptest/v2/recognize.msg | 30 - libs/unimrcp/tests/mrcptest/v2/setparams.msg | 5 - libs/unimrcp/tests/mrcptest/v2/speak.msg | 26 - .../tests/mrcptest/v2/speakcomplete.msg | 5 - libs/unimrcp/tests/mrcptest/v2/stop.msg | 3 - libs/unimrcp/tests/rtsptest/Makefile.am | 12 - libs/unimrcp/tests/rtsptest/msg/announce.msg | 24 - libs/unimrcp/tests/rtsptest/msg/ok.msg | 16 - libs/unimrcp/tests/rtsptest/msg/re-ok.msg | 6 - libs/unimrcp/tests/rtsptest/msg/re-setup.msg | 6 - libs/unimrcp/tests/rtsptest/msg/setup.msg | 16 - libs/unimrcp/tests/rtsptest/msg/teardown.msg | 4 - libs/unimrcp/tests/rtsptest/msg/ultimate.msg | 46 - libs/unimrcp/tests/rtsptest/rtsptest.vcproj | 296 -- libs/unimrcp/tests/rtsptest/rtsptest.vcxproj | 125 - .../tests/rtsptest/rtsptest.vcxproj.filters | 21 - libs/unimrcp/tests/rtsptest/src/main.c | 52 - .../tests/rtsptest/src/parse_gen_suite.c | 159 - libs/unimrcp/tests/sipp/mrcp_uac_multi | 108 - libs/unimrcp/tests/sipp/mrcp_uac_recog | 103 - libs/unimrcp/tests/sipp/mrcp_uac_synth | 103 - libs/unimrcp/tests/sipp/mrcp_uac_unknown | 102 - libs/unimrcp/tests/sipp/mrcp_uac_update | 179 - libs/unimrcp/tests/sipp/mrcp_uas_recog | 127 - libs/unimrcp/tests/sipp/mrcp_uas_reject | 49 - libs/unimrcp/tests/sipp/mrcp_uas_synth | 127 - libs/unimrcp/tests/sipp/mrcp_uas_unknown | 88 - libs/unimrcp/tests/strtablegen/Makefile.am | 9 - libs/unimrcp/tests/strtablegen/src/main.c | 146 - libs/unimrcp/tests/strtablegen/stringtable.in | 12 - .../tests/strtablegen/strtablegen.vcproj | 292 -- .../tests/strtablegen/strtablegen.vcxproj | 124 - .../strtablegen/strtablegen.vcxproj.filters | 18 - libs/unimrcp/unimrcp-2010.sln | 358 -- libs/unimrcp/unimrcp.sln | 447 -- src/include/switch.h | 3 - src/mod/.gitignore | 3 - src/mod/Makefile.am | 1 - src/mod/asr_tts/mod_unimrcp/Makefile.am | 44 - .../mod_unimrcp/mod_unimrcp.2017.vcxproj | 205 - src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c | 4631 ----------------- src/mod/asr_tts/mod_unimrcp/unimrcp.props | 15 - .../conf/autoload_configs/rayo.conf.xml | 30 - 632 files changed, 4 insertions(+), 93781 deletions(-) delete mode 100755 build/buildmrcpserver.sh delete mode 100644 conf/vanilla/autoload_configs/unimrcp.conf.xml delete mode 100644 conf/vanilla/mrcp_profiles/loquendo-7-mrcp-v2.xml delete mode 100644 conf/vanilla/mrcp_profiles/nuance-1.0.0-mrcp-v1.xml delete mode 100644 conf/vanilla/mrcp_profiles/nuance-5.0-mrcp-v1.xml delete mode 100644 conf/vanilla/mrcp_profiles/nuance-5.0-mrcp-v2.xml delete mode 100644 conf/vanilla/mrcp_profiles/unimrcpserver-mrcp-v1.xml delete mode 100644 conf/vanilla/mrcp_profiles/vestec-mrcp-v1.xml delete mode 100644 conf/vanilla/mrcp_profiles/voxeo-prophecy-8.0-mrcp-v1.xml delete mode 100644 libs/unimrcp/.gitignore delete mode 100644 libs/unimrcp/.update delete mode 100644 libs/unimrcp/AUTHORS delete mode 100644 libs/unimrcp/CHANGES delete mode 100644 libs/unimrcp/INSTALL delete mode 100644 libs/unimrcp/LICENSE delete mode 100644 libs/unimrcp/Makefile.am delete mode 100644 libs/unimrcp/NOTICE delete mode 100644 libs/unimrcp/README delete mode 100644 libs/unimrcp/acinclude.m4 delete mode 100755 libs/unimrcp/bootstrap delete mode 100644 libs/unimrcp/build/Makefile.am delete mode 100644 libs/unimrcp/build/acmacros/apr.m4 delete mode 100644 libs/unimrcp/build/acmacros/apr_common.m4 delete mode 100644 libs/unimrcp/build/acmacros/apu.m4 delete mode 100644 libs/unimrcp/build/acmacros/ax_compiler_vendor.m4 delete mode 100644 libs/unimrcp/build/acmacros/find_apr.m4 delete mode 100644 libs/unimrcp/build/acmacros/find_apu.m4 delete mode 100644 libs/unimrcp/build/acmacros/sofia-sip.m4 delete mode 100644 libs/unimrcp/build/acmacros/uni_plugin.m4 delete mode 100755 libs/unimrcp/build/get-version.sh delete mode 100755 libs/unimrcp/build/init.d/unimrcp-server delete mode 100644 libs/unimrcp/build/pkgconfig/Makefile.am delete mode 100644 libs/unimrcp/build/pkgconfig/unimrcpclient.pc.in delete mode 100644 libs/unimrcp/build/pkgconfig/unimrcpplugin.pc.in delete mode 100644 libs/unimrcp/build/pkgconfig/unimrcpserver.pc.in delete mode 100644 libs/unimrcp/build/props/apr.props delete mode 100644 libs/unimrcp/build/props/apt.props delete mode 100644 libs/unimrcp/build/props/mpf.props delete mode 100644 libs/unimrcp/build/props/mrcp.props delete mode 100644 libs/unimrcp/build/props/mrcpclient.props delete mode 100644 libs/unimrcp/build/props/mrcpengine.props delete mode 100644 libs/unimrcp/build/props/mrcpserver.props delete mode 100644 libs/unimrcp/build/props/mrcpsignaling.props delete mode 100644 libs/unimrcp/build/props/mrcpv2transport.props delete mode 100644 libs/unimrcp/build/props/sdk/unimrcpclient.props delete mode 100644 libs/unimrcp/build/props/sdk/unimrcpplugin.props delete mode 100644 libs/unimrcp/build/props/sdk/unimrcpsdk.props delete mode 100644 libs/unimrcp/build/props/sdk/unimrcpserver.props delete mode 100644 libs/unimrcp/build/props/sofiasip.props delete mode 100644 libs/unimrcp/build/props/unibase.props delete mode 100644 libs/unimrcp/build/props/unibin-x64.props delete mode 100644 libs/unimrcp/build/props/unibin.props delete mode 100644 libs/unimrcp/build/props/unidebug.props delete mode 100644 libs/unimrcp/build/props/unilib-x64.props delete mode 100644 libs/unimrcp/build/props/unilib.props delete mode 100644 libs/unimrcp/build/props/unimrcpclient.props delete mode 100644 libs/unimrcp/build/props/unimrcpserver.props delete mode 100644 libs/unimrcp/build/props/uniplugin-x64.props delete mode 100644 libs/unimrcp/build/props/uniplugin.props delete mode 100644 libs/unimrcp/build/props/unirelease.props delete mode 100644 libs/unimrcp/build/props/unirtsp.props delete mode 100644 libs/unimrcp/build/rules/uniclientapp.am delete mode 100644 libs/unimrcp/build/rules/uniclientlib.am delete mode 100644 libs/unimrcp/build/rules/uniplugin.am delete mode 100644 libs/unimrcp/build/rules/uniserverapp.am delete mode 100644 libs/unimrcp/build/rules/uniserverlib.am delete mode 100644 libs/unimrcp/build/tools/prepare.vcproj delete mode 100644 libs/unimrcp/build/tools/prepare.vcxproj delete mode 100644 libs/unimrcp/build/tools/unimrcp_service.c delete mode 100644 libs/unimrcp/build/tools/unimrcpservice.exe.manifest delete mode 100644 libs/unimrcp/build/tools/unimrcpservice.rc delete mode 100644 libs/unimrcp/build/tools/unimrcpservice.vcproj delete mode 100644 libs/unimrcp/build/tools/unimrcpservice.vcxproj delete mode 100644 libs/unimrcp/build/tools/unimrcpservice.vcxproj.filters delete mode 100644 libs/unimrcp/build/uni_revision.h delete mode 100644 libs/unimrcp/build/uni_version.h delete mode 100644 libs/unimrcp/build/vsprops/apr.vsprops delete mode 100644 libs/unimrcp/build/vsprops/apt.vsprops delete mode 100644 libs/unimrcp/build/vsprops/mpf.vsprops delete mode 100644 libs/unimrcp/build/vsprops/mrcp.vsprops delete mode 100644 libs/unimrcp/build/vsprops/mrcpclient.vsprops delete mode 100644 libs/unimrcp/build/vsprops/mrcpengine.vsprops delete mode 100644 libs/unimrcp/build/vsprops/mrcpserver.vsprops delete mode 100644 libs/unimrcp/build/vsprops/mrcpsignaling.vsprops delete mode 100644 libs/unimrcp/build/vsprops/mrcpv2transport.vsprops delete mode 100644 libs/unimrcp/build/vsprops/sdk/unimrcpclient.vsprops delete mode 100644 libs/unimrcp/build/vsprops/sdk/unimrcpplugin.vsprops delete mode 100644 libs/unimrcp/build/vsprops/sdk/unimrcpsdk.vsprops delete mode 100644 libs/unimrcp/build/vsprops/sdk/unimrcpserver.vsprops delete mode 100644 libs/unimrcp/build/vsprops/sofiasip.vsprops delete mode 100644 libs/unimrcp/build/vsprops/unibase.vsprops delete mode 100644 libs/unimrcp/build/vsprops/unibin-x64.vsprops delete mode 100644 libs/unimrcp/build/vsprops/unibin.vsprops delete mode 100644 libs/unimrcp/build/vsprops/unidebug.vsprops delete mode 100644 libs/unimrcp/build/vsprops/unilib-x64.vsprops delete mode 100644 libs/unimrcp/build/vsprops/unilib.vsprops delete mode 100644 libs/unimrcp/build/vsprops/unimrcpclient.vsprops delete mode 100644 libs/unimrcp/build/vsprops/unimrcpserver.vsprops delete mode 100644 libs/unimrcp/build/vsprops/uniplugin-x64.vsprops delete mode 100644 libs/unimrcp/build/vsprops/uniplugin.vsprops delete mode 100644 libs/unimrcp/build/vsprops/unirelease.vsprops delete mode 100644 libs/unimrcp/build/vsprops/unirtsp.vsprops delete mode 100644 libs/unimrcp/conf/Makefile.am delete mode 100644 libs/unimrcp/conf/client-profiles/lumenvox.xml delete mode 100644 libs/unimrcp/conf/client-profiles/nuance.xml delete mode 100644 libs/unimrcp/conf/client-profiles/speechpro.xml delete mode 100644 libs/unimrcp/conf/client-profiles/unimrcp.xml delete mode 100644 libs/unimrcp/conf/dirlayout.xml delete mode 100644 libs/unimrcp/conf/logger.xml delete mode 100644 libs/unimrcp/conf/umcscenarios.xml delete mode 100644 libs/unimrcp/conf/unimrcpclient.xml delete mode 100644 libs/unimrcp/conf/unimrcpclient.xsd delete mode 100644 libs/unimrcp/conf/unimrcpserver.xml delete mode 100644 libs/unimrcp/conf/unimrcpserver.xsd delete mode 100644 libs/unimrcp/config.layout delete mode 100644 libs/unimrcp/configure.ac delete mode 100755 libs/unimrcp/configure.gnu delete mode 100644 libs/unimrcp/data/Makefile.am delete mode 100644 libs/unimrcp/data/demo-16kHz.pcm delete mode 100644 libs/unimrcp/data/demo-8kHz.pcm delete mode 100644 libs/unimrcp/data/grammar.jsgf delete mode 100644 libs/unimrcp/data/grammar.mixed delete mode 100644 libs/unimrcp/data/grammar.srgs delete mode 100644 libs/unimrcp/data/grammar.xml delete mode 100644 libs/unimrcp/data/johnsmith-16kHz.pcm delete mode 100644 libs/unimrcp/data/johnsmith-8kHz.pcm delete mode 100644 libs/unimrcp/data/one-16kHz.pcm delete mode 100644 libs/unimrcp/data/one-8kHz.pcm delete mode 100644 libs/unimrcp/data/result-verification.xml delete mode 100644 libs/unimrcp/data/result.xml delete mode 100644 libs/unimrcp/data/speak.txt delete mode 100644 libs/unimrcp/data/speak.xml delete mode 100644 libs/unimrcp/docs/doxygen.conf.in delete mode 100644 libs/unimrcp/docs/mainpage.docs delete mode 100644 libs/unimrcp/libs/Makefile.am delete mode 100644 libs/unimrcp/libs/apr-toolkit/Makefile.am delete mode 100644 libs/unimrcp/libs/apr-toolkit/aprtoolkit.2017.vcxproj delete mode 100644 libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcproj delete mode 100644 libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcxproj delete mode 100644 libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcxproj.filters delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_consumer_task.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_cyclic_queue.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_dir_layout.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_header_field.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_log.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_multipart_content.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_net.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_nlsml_doc.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_obj_list.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_pair.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_poller_task.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_pollset.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_pool.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_string.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_string_table.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_task.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_task_msg.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_test_suite.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_text_message.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_text_stream.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_timer_queue.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_consumer_task.c delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_cyclic_queue.c delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_dir_layout.c delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_header_field.c delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_log.c delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_multipart_content.c delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_net.c delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_nlsml_doc.c delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_obj_list.c delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_pair.c delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_poller_task.c delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_pollset.c delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_pool.c delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_string_table.c delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_task.c delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_task_msg.c delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_test_suite.c delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_text_message.c delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_text_stream.c delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_timer_queue.c delete mode 100644 libs/unimrcp/libs/mpf/Makefile.am delete mode 100644 libs/unimrcp/libs/mpf/codecs/g711/g711.c delete mode 100644 libs/unimrcp/libs/mpf/codecs/g711/g711.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_activity_detector.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_audio_file_descriptor.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_audio_file_stream.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_bridge.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_buffer.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_codec.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_codec_descriptor.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_codec_manager.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_context.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_decoder.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_dtmf_detector.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_dtmf_generator.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_encoder.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_engine.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_engine_factory.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_file_termination_factory.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_frame.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_frame_buffer.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_jitter_buffer.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_message.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_mixer.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_multiplier.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_named_event.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_object.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_resampler.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_rtcp_packet.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_rtp_attribs.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_rtp_defs.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_rtp_descriptor.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_rtp_header.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_rtp_pt.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_rtp_stat.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_rtp_stream.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_rtp_termination_factory.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_scheduler.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_stream.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_stream_descriptor.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_termination.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_termination_factory.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_trace.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_types.h delete mode 100644 libs/unimrcp/libs/mpf/mpf.2010.vcxproj.filters delete mode 100644 libs/unimrcp/libs/mpf/mpf.2017.vcxproj delete mode 100644 libs/unimrcp/libs/mpf/mpf.vcproj delete mode 100644 libs/unimrcp/libs/mpf/mpf.vcxproj delete mode 100644 libs/unimrcp/libs/mpf/mpf.vcxproj.filters delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_activity_detector.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_audio_file_stream.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_bridge.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_buffer.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_codec_descriptor.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_codec_g711.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_codec_linear.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_codec_manager.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_context.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_decoder.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_dtmf_detector.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_dtmf_generator.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_encoder.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_engine.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_engine_factory.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_file_termination_factory.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_frame_buffer.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_jitter_buffer.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_mixer.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_multiplier.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_named_event.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_resampler.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_rtp_attribs.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_rtp_stream.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_rtp_termination_factory.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_scheduler.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_stream.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_termination.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_termination_factory.c delete mode 100644 libs/unimrcp/libs/mrcp-client/Makefile.am delete mode 100644 libs/unimrcp/libs/mrcp-client/include/mrcp_application.h delete mode 100644 libs/unimrcp/libs/mrcp-client/include/mrcp_client.h delete mode 100644 libs/unimrcp/libs/mrcp-client/include/mrcp_client_session.h delete mode 100644 libs/unimrcp/libs/mrcp-client/include/mrcp_client_types.h delete mode 100644 libs/unimrcp/libs/mrcp-client/mrcpclient.2017.vcxproj delete mode 100644 libs/unimrcp/libs/mrcp-client/mrcpclient.vcproj delete mode 100644 libs/unimrcp/libs/mrcp-client/mrcpclient.vcxproj delete mode 100644 libs/unimrcp/libs/mrcp-client/mrcpclient.vcxproj.filters delete mode 100644 libs/unimrcp/libs/mrcp-client/src/mrcp_application.c delete mode 100644 libs/unimrcp/libs/mrcp-client/src/mrcp_client.c delete mode 100644 libs/unimrcp/libs/mrcp-client/src/mrcp_client_session.c delete mode 100644 libs/unimrcp/libs/mrcp-engine/Makefile.am delete mode 100644 libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_factory.h delete mode 100644 libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_iface.h delete mode 100644 libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_impl.h delete mode 100644 libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_loader.h delete mode 100644 libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_plugin.h delete mode 100644 libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_types.h delete mode 100644 libs/unimrcp/libs/mrcp-engine/include/mrcp_recog_engine.h delete mode 100644 libs/unimrcp/libs/mrcp-engine/include/mrcp_recog_state_machine.h delete mode 100644 libs/unimrcp/libs/mrcp-engine/include/mrcp_recorder_engine.h delete mode 100644 libs/unimrcp/libs/mrcp-engine/include/mrcp_recorder_state_machine.h delete mode 100644 libs/unimrcp/libs/mrcp-engine/include/mrcp_resource_engine.h delete mode 100644 libs/unimrcp/libs/mrcp-engine/include/mrcp_state_machine.h delete mode 100644 libs/unimrcp/libs/mrcp-engine/include/mrcp_synth_engine.h delete mode 100644 libs/unimrcp/libs/mrcp-engine/include/mrcp_synth_state_machine.h delete mode 100644 libs/unimrcp/libs/mrcp-engine/include/mrcp_verifier_engine.h delete mode 100644 libs/unimrcp/libs/mrcp-engine/include/mrcp_verifier_state_machine.h delete mode 100644 libs/unimrcp/libs/mrcp-engine/mrcpengine.vcproj delete mode 100644 libs/unimrcp/libs/mrcp-engine/mrcpengine.vcxproj delete mode 100644 libs/unimrcp/libs/mrcp-engine/mrcpengine.vcxproj.filters delete mode 100644 libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_factory.c delete mode 100644 libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_iface.c delete mode 100644 libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_impl.c delete mode 100644 libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_loader.c delete mode 100644 libs/unimrcp/libs/mrcp-engine/src/mrcp_recog_state_machine.c delete mode 100644 libs/unimrcp/libs/mrcp-engine/src/mrcp_recorder_state_machine.c delete mode 100644 libs/unimrcp/libs/mrcp-engine/src/mrcp_synth_state_machine.c delete mode 100644 libs/unimrcp/libs/mrcp-engine/src/mrcp_verifier_state_machine.c delete mode 100644 libs/unimrcp/libs/mrcp-server/Makefile.am delete mode 100644 libs/unimrcp/libs/mrcp-server/include/mrcp_server.h delete mode 100644 libs/unimrcp/libs/mrcp-server/include/mrcp_server_session.h delete mode 100644 libs/unimrcp/libs/mrcp-server/include/mrcp_server_types.h delete mode 100644 libs/unimrcp/libs/mrcp-server/mrcpserver.vcproj delete mode 100644 libs/unimrcp/libs/mrcp-server/mrcpserver.vcxproj delete mode 100644 libs/unimrcp/libs/mrcp-server/mrcpserver.vcxproj.filters delete mode 100644 libs/unimrcp/libs/mrcp-server/src/mrcp_server.c delete mode 100644 libs/unimrcp/libs/mrcp-server/src/mrcp_server_session.c delete mode 100644 libs/unimrcp/libs/mrcp-signaling/Makefile.am delete mode 100644 libs/unimrcp/libs/mrcp-signaling/include/mrcp_session.h delete mode 100644 libs/unimrcp/libs/mrcp-signaling/include/mrcp_session_descriptor.h delete mode 100644 libs/unimrcp/libs/mrcp-signaling/include/mrcp_sig_agent.h delete mode 100644 libs/unimrcp/libs/mrcp-signaling/include/mrcp_sig_types.h delete mode 100644 libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2010.vcxproj.filters delete mode 100644 libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2017.vcxproj delete mode 100644 libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcproj delete mode 100644 libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcxproj delete mode 100644 libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcxproj.filters delete mode 100644 libs/unimrcp/libs/mrcp-signaling/src/mrcp_session_descriptor.c delete mode 100644 libs/unimrcp/libs/mrcp-signaling/src/mrcp_sig_agent.c delete mode 100644 libs/unimrcp/libs/mrcp/Makefile.am delete mode 100644 libs/unimrcp/libs/mrcp/control/include/mrcp_resource.h delete mode 100644 libs/unimrcp/libs/mrcp/control/include/mrcp_resource_factory.h delete mode 100644 libs/unimrcp/libs/mrcp/control/include/mrcp_resource_loader.h delete mode 100644 libs/unimrcp/libs/mrcp/control/include/mrcp_stream.h delete mode 100644 libs/unimrcp/libs/mrcp/control/src/mrcp_resource_factory.c delete mode 100644 libs/unimrcp/libs/mrcp/control/src/mrcp_resource_loader.c delete mode 100644 libs/unimrcp/libs/mrcp/control/src/mrcp_stream.c delete mode 100644 libs/unimrcp/libs/mrcp/include/mrcp.h delete mode 100644 libs/unimrcp/libs/mrcp/include/mrcp_types.h delete mode 100644 libs/unimrcp/libs/mrcp/message/include/mrcp_generic_header.h delete mode 100644 libs/unimrcp/libs/mrcp/message/include/mrcp_header.h delete mode 100644 libs/unimrcp/libs/mrcp/message/include/mrcp_header_accessor.h delete mode 100644 libs/unimrcp/libs/mrcp/message/include/mrcp_message.h delete mode 100644 libs/unimrcp/libs/mrcp/message/include/mrcp_start_line.h delete mode 100644 libs/unimrcp/libs/mrcp/message/src/mrcp_generic_header.c delete mode 100644 libs/unimrcp/libs/mrcp/message/src/mrcp_header.c delete mode 100644 libs/unimrcp/libs/mrcp/message/src/mrcp_header_accessor.c delete mode 100644 libs/unimrcp/libs/mrcp/message/src/mrcp_message.c delete mode 100644 libs/unimrcp/libs/mrcp/message/src/mrcp_start_line.c delete mode 100644 libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj.filters delete mode 100644 libs/unimrcp/libs/mrcp/mrcp.2017.vcxproj delete mode 100644 libs/unimrcp/libs/mrcp/mrcp.vcproj delete mode 100644 libs/unimrcp/libs/mrcp/mrcp.vcxproj delete mode 100644 libs/unimrcp/libs/mrcp/mrcp.vcxproj.filters delete mode 100644 libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_header.h delete mode 100644 libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_resource.h delete mode 100644 libs/unimrcp/libs/mrcp/resources/include/mrcp_recorder_header.h delete mode 100644 libs/unimrcp/libs/mrcp/resources/include/mrcp_recorder_resource.h delete mode 100644 libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_header.h delete mode 100644 libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_resource.h delete mode 100644 libs/unimrcp/libs/mrcp/resources/include/mrcp_verifier_header.h delete mode 100644 libs/unimrcp/libs/mrcp/resources/include/mrcp_verifier_resource.h delete mode 100644 libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_header.c delete mode 100644 libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_resource.c delete mode 100644 libs/unimrcp/libs/mrcp/resources/src/mrcp_recorder_header.c delete mode 100644 libs/unimrcp/libs/mrcp/resources/src/mrcp_recorder_resource.c delete mode 100644 libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_header.c delete mode 100644 libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_resource.c delete mode 100644 libs/unimrcp/libs/mrcp/resources/src/mrcp_verifier_header.c delete mode 100644 libs/unimrcp/libs/mrcp/resources/src/mrcp_verifier_resource.c delete mode 100644 libs/unimrcp/libs/mrcpv2-transport/Makefile.am delete mode 100644 libs/unimrcp/libs/mrcpv2-transport/include/mrcp_ca_factory.h delete mode 100644 libs/unimrcp/libs/mrcpv2-transport/include/mrcp_client_connection.h delete mode 100644 libs/unimrcp/libs/mrcpv2-transport/include/mrcp_connection.h delete mode 100644 libs/unimrcp/libs/mrcpv2-transport/include/mrcp_connection_types.h delete mode 100644 libs/unimrcp/libs/mrcpv2-transport/include/mrcp_control_descriptor.h delete mode 100644 libs/unimrcp/libs/mrcpv2-transport/include/mrcp_server_connection.h delete mode 100644 libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj.filters delete mode 100644 libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2017.vcxproj delete mode 100644 libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcproj delete mode 100644 libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcxproj delete mode 100644 libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcxproj.filters delete mode 100644 libs/unimrcp/libs/mrcpv2-transport/src/mrcp_ca_factory.c delete mode 100644 libs/unimrcp/libs/mrcpv2-transport/src/mrcp_client_connection.c delete mode 100644 libs/unimrcp/libs/mrcpv2-transport/src/mrcp_connection.c delete mode 100644 libs/unimrcp/libs/mrcpv2-transport/src/mrcp_control_descriptor.c delete mode 100644 libs/unimrcp/libs/mrcpv2-transport/src/mrcp_server_connection.c delete mode 100644 libs/unimrcp/libs/uni-rtsp/Makefile.am delete mode 100644 libs/unimrcp/libs/uni-rtsp/include/rtsp.h delete mode 100644 libs/unimrcp/libs/uni-rtsp/include/rtsp_client.h delete mode 100644 libs/unimrcp/libs/uni-rtsp/include/rtsp_header.h delete mode 100644 libs/unimrcp/libs/uni-rtsp/include/rtsp_message.h delete mode 100644 libs/unimrcp/libs/uni-rtsp/include/rtsp_server.h delete mode 100644 libs/unimrcp/libs/uni-rtsp/include/rtsp_start_line.h delete mode 100644 libs/unimrcp/libs/uni-rtsp/include/rtsp_stream.h delete mode 100644 libs/unimrcp/libs/uni-rtsp/src/rtsp_client.c delete mode 100644 libs/unimrcp/libs/uni-rtsp/src/rtsp_header.c delete mode 100644 libs/unimrcp/libs/uni-rtsp/src/rtsp_message.c delete mode 100644 libs/unimrcp/libs/uni-rtsp/src/rtsp_server.c delete mode 100644 libs/unimrcp/libs/uni-rtsp/src/rtsp_start_line.c delete mode 100644 libs/unimrcp/libs/uni-rtsp/src/rtsp_stream.c delete mode 100644 libs/unimrcp/libs/uni-rtsp/unirtsp.2010.vcxproj.filters delete mode 100644 libs/unimrcp/libs/uni-rtsp/unirtsp.2017.vcxproj delete mode 100644 libs/unimrcp/libs/uni-rtsp/unirtsp.vcproj delete mode 100644 libs/unimrcp/libs/uni-rtsp/unirtsp.vcxproj delete mode 100644 libs/unimrcp/libs/uni-rtsp/unirtsp.vcxproj.filters delete mode 100644 libs/unimrcp/modules/Makefile.am delete mode 100644 libs/unimrcp/modules/mrcp-sofiasip/Makefile.am delete mode 100644 libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sdp.h delete mode 100644 libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sofiasip_client_agent.h delete mode 100644 libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sofiasip_server_agent.h delete mode 100644 libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj.filters delete mode 100644 libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2017.vcxproj delete mode 100644 libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcproj delete mode 100644 libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcxproj delete mode 100644 libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcxproj.filters delete mode 100644 libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sdp.c delete mode 100644 libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_client_agent.c delete mode 100644 libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_logger.c delete mode 100644 libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_server_agent.c delete mode 100644 libs/unimrcp/modules/mrcp-unirtsp/Makefile.am delete mode 100644 libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_client_agent.h delete mode 100644 libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_sdp.h delete mode 100644 libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_server_agent.h delete mode 100644 libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2010.vcxproj.filters delete mode 100644 libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2017.vcxproj delete mode 100644 libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.vcproj delete mode 100644 libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.vcxproj delete mode 100644 libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.vcxproj.filters delete mode 100644 libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_client_agent.c delete mode 100644 libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_sdp.c delete mode 100644 libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_server_agent.c delete mode 100644 libs/unimrcp/packages/inno-setup/setup-sdk-win32.txt delete mode 100644 libs/unimrcp/packages/inno-setup/setup-sdk-x64.txt delete mode 100644 libs/unimrcp/packages/inno-setup/setup-win32.txt delete mode 100644 libs/unimrcp/packages/inno-setup/setup-x64.txt delete mode 100644 libs/unimrcp/packages/inno-setup/setup.txt delete mode 100644 libs/unimrcp/packages/inno-setup/unimrcp-sdk.iss delete mode 100644 libs/unimrcp/packages/inno-setup/unimrcp.iss delete mode 100644 libs/unimrcp/platforms/Makefile.am delete mode 100644 libs/unimrcp/platforms/asr-client/Makefile.am delete mode 100644 libs/unimrcp/platforms/asr-client/asrclient.vcproj delete mode 100644 libs/unimrcp/platforms/asr-client/asrclient.vcxproj delete mode 100644 libs/unimrcp/platforms/asr-client/asrclient.vcxproj.filters delete mode 100644 libs/unimrcp/platforms/asr-client/src/main.c delete mode 100644 libs/unimrcp/platforms/libasr-client/Makefile.am delete mode 100644 libs/unimrcp/platforms/libasr-client/include/asr_engine.h delete mode 100644 libs/unimrcp/platforms/libasr-client/libasrclient.vcproj delete mode 100644 libs/unimrcp/platforms/libasr-client/libasrclient.vcxproj delete mode 100644 libs/unimrcp/platforms/libasr-client/libasrclient.vcxproj.filters delete mode 100644 libs/unimrcp/platforms/libasr-client/src/asr_engine.c delete mode 100644 libs/unimrcp/platforms/libunimrcp-client/Makefile.am delete mode 100644 libs/unimrcp/platforms/libunimrcp-client/include/unimrcp_client.h delete mode 100644 libs/unimrcp/platforms/libunimrcp-client/libunimrcpclient.vcproj delete mode 100644 libs/unimrcp/platforms/libunimrcp-client/libunimrcpclient.vcxproj delete mode 100644 libs/unimrcp/platforms/libunimrcp-client/libunimrcpclient.vcxproj.filters delete mode 100644 libs/unimrcp/platforms/libunimrcp-client/src/unimrcp_client.c delete mode 100644 libs/unimrcp/platforms/libunimrcp-server/Makefile.am delete mode 100644 libs/unimrcp/platforms/libunimrcp-server/include/unimrcp_server.h delete mode 100644 libs/unimrcp/platforms/libunimrcp-server/libunimrcpserver.vcproj delete mode 100644 libs/unimrcp/platforms/libunimrcp-server/libunimrcpserver.vcxproj delete mode 100644 libs/unimrcp/platforms/libunimrcp-server/libunimrcpserver.vcxproj.filters delete mode 100644 libs/unimrcp/platforms/libunimrcp-server/src/unimrcp_server.c delete mode 100644 libs/unimrcp/platforms/umc/Makefile.am delete mode 100644 libs/unimrcp/platforms/umc/include/dtmfscenario.h delete mode 100644 libs/unimrcp/platforms/umc/include/dtmfsession.h delete mode 100644 libs/unimrcp/platforms/umc/include/recogscenario.h delete mode 100644 libs/unimrcp/platforms/umc/include/recogsession.h delete mode 100644 libs/unimrcp/platforms/umc/include/recorderscenario.h delete mode 100644 libs/unimrcp/platforms/umc/include/recordersession.h delete mode 100644 libs/unimrcp/platforms/umc/include/setparamscenario.h delete mode 100644 libs/unimrcp/platforms/umc/include/setparamsession.h delete mode 100644 libs/unimrcp/platforms/umc/include/synthscenario.h delete mode 100644 libs/unimrcp/platforms/umc/include/synthsession.h delete mode 100644 libs/unimrcp/platforms/umc/include/umcconsole.h delete mode 100644 libs/unimrcp/platforms/umc/include/umcframework.h delete mode 100644 libs/unimrcp/platforms/umc/include/umcscenario.h delete mode 100644 libs/unimrcp/platforms/umc/include/umcsession.h delete mode 100644 libs/unimrcp/platforms/umc/include/verifierscenario.h delete mode 100644 libs/unimrcp/platforms/umc/include/verifiersession.h delete mode 100644 libs/unimrcp/platforms/umc/src/dtmfscenario.cpp delete mode 100644 libs/unimrcp/platforms/umc/src/dtmfsession.cpp delete mode 100644 libs/unimrcp/platforms/umc/src/main.cpp delete mode 100644 libs/unimrcp/platforms/umc/src/recogscenario.cpp delete mode 100644 libs/unimrcp/platforms/umc/src/recogsession.cpp delete mode 100644 libs/unimrcp/platforms/umc/src/recorderscenario.cpp delete mode 100644 libs/unimrcp/platforms/umc/src/recordersession.cpp delete mode 100644 libs/unimrcp/platforms/umc/src/setparamscenario.cpp delete mode 100644 libs/unimrcp/platforms/umc/src/setparamsession.cpp delete mode 100644 libs/unimrcp/platforms/umc/src/synthscenario.cpp delete mode 100644 libs/unimrcp/platforms/umc/src/synthsession.cpp delete mode 100644 libs/unimrcp/platforms/umc/src/umcconsole.cpp delete mode 100644 libs/unimrcp/platforms/umc/src/umcframework.cpp delete mode 100644 libs/unimrcp/platforms/umc/src/umcscenario.cpp delete mode 100644 libs/unimrcp/platforms/umc/src/umcsession.cpp delete mode 100644 libs/unimrcp/platforms/umc/src/verifierscenario.cpp delete mode 100644 libs/unimrcp/platforms/umc/src/verifiersession.cpp delete mode 100644 libs/unimrcp/platforms/umc/umc.rc delete mode 100644 libs/unimrcp/platforms/umc/umc.vcproj delete mode 100644 libs/unimrcp/platforms/umc/umc.vcxproj delete mode 100644 libs/unimrcp/platforms/umc/umc.vcxproj.filters delete mode 100644 libs/unimrcp/platforms/unimrcp-client/Makefile.am delete mode 100644 libs/unimrcp/platforms/unimrcp-client/include/demo_application.h delete mode 100644 libs/unimrcp/platforms/unimrcp-client/include/demo_framework.h delete mode 100644 libs/unimrcp/platforms/unimrcp-client/include/demo_util.h delete mode 100644 libs/unimrcp/platforms/unimrcp-client/src/demo_bypass_application.c delete mode 100644 libs/unimrcp/platforms/unimrcp-client/src/demo_discover_application.c delete mode 100644 libs/unimrcp/platforms/unimrcp-client/src/demo_framework.c delete mode 100644 libs/unimrcp/platforms/unimrcp-client/src/demo_recog_application.c delete mode 100644 libs/unimrcp/platforms/unimrcp-client/src/demo_synth_application.c delete mode 100644 libs/unimrcp/platforms/unimrcp-client/src/demo_util.c delete mode 100644 libs/unimrcp/platforms/unimrcp-client/src/main.c delete mode 100644 libs/unimrcp/platforms/unimrcp-client/unimrcpclient.rc delete mode 100644 libs/unimrcp/platforms/unimrcp-client/unimrcpclient.vcproj delete mode 100644 libs/unimrcp/platforms/unimrcp-client/unimrcpclient.vcxproj delete mode 100644 libs/unimrcp/platforms/unimrcp-client/unimrcpclient.vcxproj.filters delete mode 100644 libs/unimrcp/platforms/unimrcp-server/Makefile.am delete mode 100644 libs/unimrcp/platforms/unimrcp-server/src/main.c delete mode 100644 libs/unimrcp/platforms/unimrcp-server/src/uni_cmdline.c delete mode 100644 libs/unimrcp/platforms/unimrcp-server/src/uni_daemon.c delete mode 100644 libs/unimrcp/platforms/unimrcp-server/src/uni_service.c delete mode 100644 libs/unimrcp/platforms/unimrcp-server/unimrcpserver.rc delete mode 100644 libs/unimrcp/platforms/unimrcp-server/unimrcpserver.vcproj delete mode 100644 libs/unimrcp/platforms/unimrcp-server/unimrcpserver.vcxproj delete mode 100644 libs/unimrcp/platforms/unimrcp-server/unimrcpserver.vcxproj.filters delete mode 100644 libs/unimrcp/plugins/Makefile.am delete mode 100644 libs/unimrcp/plugins/demo-recog/Makefile.am delete mode 100644 libs/unimrcp/plugins/demo-recog/demorecog.vcproj delete mode 100644 libs/unimrcp/plugins/demo-recog/demorecog.vcxproj delete mode 100644 libs/unimrcp/plugins/demo-recog/demorecog.vcxproj.filters delete mode 100644 libs/unimrcp/plugins/demo-recog/src/demo_recog_engine.c delete mode 100644 libs/unimrcp/plugins/demo-synth/Makefile.am delete mode 100644 libs/unimrcp/plugins/demo-synth/demosynth.vcproj delete mode 100644 libs/unimrcp/plugins/demo-synth/demosynth.vcxproj delete mode 100644 libs/unimrcp/plugins/demo-synth/demosynth.vcxproj.filters delete mode 100644 libs/unimrcp/plugins/demo-synth/src/demo_synth_engine.c delete mode 100644 libs/unimrcp/plugins/demo-verifier/Makefile.am delete mode 100644 libs/unimrcp/plugins/demo-verifier/demoverifier.vcproj delete mode 100644 libs/unimrcp/plugins/demo-verifier/demoverifier.vcxproj delete mode 100644 libs/unimrcp/plugins/demo-verifier/demoverifier.vcxproj.filters delete mode 100644 libs/unimrcp/plugins/demo-verifier/src/demo_verifier_engine.c delete mode 100644 libs/unimrcp/plugins/mrcp-recorder/Makefile.am delete mode 100644 libs/unimrcp/plugins/mrcp-recorder/mrcprecorder.vcproj delete mode 100644 libs/unimrcp/plugins/mrcp-recorder/mrcprecorder.vcxproj delete mode 100644 libs/unimrcp/plugins/mrcp-recorder/mrcprecorder.vcxproj.filters delete mode 100644 libs/unimrcp/plugins/mrcp-recorder/src/mrcp_recorder_engine.c delete mode 100644 libs/unimrcp/tests/Makefile.am delete mode 100644 libs/unimrcp/tests/apttest/Makefile.am delete mode 100644 libs/unimrcp/tests/apttest/apttest.vcproj delete mode 100644 libs/unimrcp/tests/apttest/apttest.vcxproj delete mode 100644 libs/unimrcp/tests/apttest/apttest.vcxproj.filters delete mode 100644 libs/unimrcp/tests/apttest/src/consumer_task_suite.c delete mode 100644 libs/unimrcp/tests/apttest/src/main.c delete mode 100644 libs/unimrcp/tests/apttest/src/multipart_suite.c delete mode 100644 libs/unimrcp/tests/apttest/src/task_suite.c delete mode 100644 libs/unimrcp/tests/mpftest/Makefile.am delete mode 100644 libs/unimrcp/tests/mpftest/mpftest.vcproj delete mode 100644 libs/unimrcp/tests/mpftest/mpftest.vcxproj delete mode 100644 libs/unimrcp/tests/mpftest/mpftest.vcxproj.filters delete mode 100644 libs/unimrcp/tests/mpftest/src/main.c delete mode 100644 libs/unimrcp/tests/mpftest/src/mpf_suite.c delete mode 100644 libs/unimrcp/tests/mrcptest/Makefile.am delete mode 100644 libs/unimrcp/tests/mrcptest/mrcptest.vcproj delete mode 100644 libs/unimrcp/tests/mrcptest/mrcptest.vcxproj delete mode 100644 libs/unimrcp/tests/mrcptest/mrcptest.vcxproj.filters delete mode 100644 libs/unimrcp/tests/mrcptest/src/main.c delete mode 100644 libs/unimrcp/tests/mrcptest/src/parse_gen_suite.c delete mode 100644 libs/unimrcp/tests/mrcptest/src/set_get_suite.c delete mode 100644 libs/unimrcp/tests/mrcptest/src/transparent_set_get_suite.c delete mode 100644 libs/unimrcp/tests/mrcptest/v1/definegrammar.msg delete mode 100644 libs/unimrcp/tests/mrcptest/v1/getparams.msg delete mode 100644 libs/unimrcp/tests/mrcptest/v1/multi.msg delete mode 100644 libs/unimrcp/tests/mrcptest/v1/pause.msg delete mode 100644 libs/unimrcp/tests/mrcptest/v1/recognitioncomplete.msg delete mode 100644 libs/unimrcp/tests/mrcptest/v1/recognize.msg delete mode 100644 libs/unimrcp/tests/mrcptest/v1/response.msg delete mode 100644 libs/unimrcp/tests/mrcptest/v1/resume.msg delete mode 100644 libs/unimrcp/tests/mrcptest/v1/setparams.msg delete mode 100644 libs/unimrcp/tests/mrcptest/v1/speak.msg delete mode 100644 libs/unimrcp/tests/mrcptest/v1/speakcomplete.msg delete mode 100644 libs/unimrcp/tests/mrcptest/v1/stop.msg delete mode 100644 libs/unimrcp/tests/mrcptest/v2/definegrammar.msg delete mode 100644 libs/unimrcp/tests/mrcptest/v2/getparams.msg delete mode 100644 libs/unimrcp/tests/mrcptest/v2/recognitioncomplete.msg delete mode 100644 libs/unimrcp/tests/mrcptest/v2/recognize.msg delete mode 100644 libs/unimrcp/tests/mrcptest/v2/setparams.msg delete mode 100644 libs/unimrcp/tests/mrcptest/v2/speak.msg delete mode 100644 libs/unimrcp/tests/mrcptest/v2/speakcomplete.msg delete mode 100644 libs/unimrcp/tests/mrcptest/v2/stop.msg delete mode 100644 libs/unimrcp/tests/rtsptest/Makefile.am delete mode 100644 libs/unimrcp/tests/rtsptest/msg/announce.msg delete mode 100644 libs/unimrcp/tests/rtsptest/msg/ok.msg delete mode 100644 libs/unimrcp/tests/rtsptest/msg/re-ok.msg delete mode 100644 libs/unimrcp/tests/rtsptest/msg/re-setup.msg delete mode 100644 libs/unimrcp/tests/rtsptest/msg/setup.msg delete mode 100644 libs/unimrcp/tests/rtsptest/msg/teardown.msg delete mode 100644 libs/unimrcp/tests/rtsptest/msg/ultimate.msg delete mode 100644 libs/unimrcp/tests/rtsptest/rtsptest.vcproj delete mode 100644 libs/unimrcp/tests/rtsptest/rtsptest.vcxproj delete mode 100644 libs/unimrcp/tests/rtsptest/rtsptest.vcxproj.filters delete mode 100644 libs/unimrcp/tests/rtsptest/src/main.c delete mode 100644 libs/unimrcp/tests/rtsptest/src/parse_gen_suite.c delete mode 100644 libs/unimrcp/tests/sipp/mrcp_uac_multi delete mode 100644 libs/unimrcp/tests/sipp/mrcp_uac_recog delete mode 100644 libs/unimrcp/tests/sipp/mrcp_uac_synth delete mode 100644 libs/unimrcp/tests/sipp/mrcp_uac_unknown delete mode 100644 libs/unimrcp/tests/sipp/mrcp_uac_update delete mode 100644 libs/unimrcp/tests/sipp/mrcp_uas_recog delete mode 100644 libs/unimrcp/tests/sipp/mrcp_uas_reject delete mode 100644 libs/unimrcp/tests/sipp/mrcp_uas_synth delete mode 100644 libs/unimrcp/tests/sipp/mrcp_uas_unknown delete mode 100644 libs/unimrcp/tests/strtablegen/Makefile.am delete mode 100644 libs/unimrcp/tests/strtablegen/src/main.c delete mode 100644 libs/unimrcp/tests/strtablegen/stringtable.in delete mode 100644 libs/unimrcp/tests/strtablegen/strtablegen.vcproj delete mode 100644 libs/unimrcp/tests/strtablegen/strtablegen.vcxproj delete mode 100644 libs/unimrcp/tests/strtablegen/strtablegen.vcxproj.filters delete mode 100644 libs/unimrcp/unimrcp-2010.sln delete mode 100644 libs/unimrcp/unimrcp.sln delete mode 100644 src/mod/asr_tts/mod_unimrcp/Makefile.am delete mode 100644 src/mod/asr_tts/mod_unimrcp/mod_unimrcp.2017.vcxproj delete mode 100644 src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c delete mode 100644 src/mod/asr_tts/mod_unimrcp/unimrcp.props diff --git a/LICENSE b/LICENSE index 46a2c712e9..2002b83219 100644 --- a/LICENSE +++ b/LICENSE @@ -1011,12 +1011,6 @@ License: MPL-1.1 or GPL-2+ use the text of this Exhibit A rather than the text found in the Original Code Source Code for Your Modifications.] -Files: libs/unimrcp/* -Copyright: 2008-2010 Arsen Chaloyan - 2009-2010 Tomas Valenta, Arsen Chaloyan - 2001-2006 Steve Underwood -License: Apache-2.0 - Files: */inet_pton.c libs/curl/lib/inet_ntop.c libs/curl/lib/mprintf.c diff --git a/bootstrap.sh b/bootstrap.sh index a68a0624ac..802c6098f7 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -10,7 +10,7 @@ BGJOB=false VERBOSE=false BASEDIR=`pwd`; LIBDIR=${BASEDIR}/libs; -SUBDIRS="apr libzrtp iksemel srtp unimrcp fs"; +SUBDIRS="apr libzrtp iksemel srtp fs"; while getopts 'jhd:v' o; do case "$o" in diff --git a/build/buildmrcpserver.sh b/build/buildmrcpserver.sh deleted file mode 100755 index a6468b06d2..0000000000 --- a/build/buildmrcpserver.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -base=`pwd` -cd libs/unimrcp -./configure --with-pocketsphinx=$base/libs/pocketsphinx-0.5.99 --with-sphinxbase=$base/libs/sphinxbase-0.4.99 --with-flite=$base/libs/flite-1.3.99 --with-apr=$base/libs/apr --with-apr-util=$base/libs/apr-util --with-sofia-sip=$base/libs/sofia-sip --prefix=/usr/local/unimrcpserver --enable-pocketsphinx-plugin --enable-flite-plugin --disable-demosynth-plugin --disable-demorecog-plugin --disable-recorder-plugin --disable-cepstral-plugin -make -make install diff --git a/build/modules.conf.in b/build/modules.conf.in index ab50bd53dc..7bf59e2acc 100644 --- a/build/modules.conf.in +++ b/build/modules.conf.in @@ -60,7 +60,6 @@ applications/mod_voicemail #asr_tts/mod_flite #asr_tts/mod_pocketsphinx #asr_tts/mod_tts_commandline -#asr_tts/mod_unimrcp codecs/mod_amr #codecs/mod_amrwb codecs/mod_b64 diff --git a/build/modules.conf.most b/build/modules.conf.most index 86063db582..fbf8100a90 100644 --- a/build/modules.conf.most +++ b/build/modules.conf.most @@ -58,7 +58,6 @@ applications/mod_voicemail_ivr asr_tts/mod_flite asr_tts/mod_pocketsphinx asr_tts/mod_tts_commandline -asr_tts/mod_unimrcp codecs/mod_amr codecs/mod_amrwb codecs/mod_b64 diff --git a/conf/rayo/autoload_configs/rayo.conf.xml b/conf/rayo/autoload_configs/rayo.conf.xml index e5191909cb..9f525c597c 100644 --- a/conf/rayo/autoload_configs/rayo.conf.xml +++ b/conf/rayo/autoload_configs/rayo.conf.xml @@ -277,36 +277,6 @@ ]]> - - - - yesno - ]]]]> - - - ]]> - - - - - yesno - ]]]]> - - - ]]> - - - - - - - - - - - - - - - - - - - - - - diff --git a/conf/vanilla/mrcp_profiles/loquendo-7-mrcp-v2.xml b/conf/vanilla/mrcp_profiles/loquendo-7-mrcp-v2.xml deleted file mode 100644 index dcf42821f5..0000000000 --- a/conf/vanilla/mrcp_profiles/loquendo-7-mrcp-v2.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/conf/vanilla/mrcp_profiles/nuance-1.0.0-mrcp-v1.xml b/conf/vanilla/mrcp_profiles/nuance-1.0.0-mrcp-v1.xml deleted file mode 100644 index 0700dec629..0000000000 --- a/conf/vanilla/mrcp_profiles/nuance-1.0.0-mrcp-v1.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/conf/vanilla/mrcp_profiles/nuance-5.0-mrcp-v1.xml b/conf/vanilla/mrcp_profiles/nuance-5.0-mrcp-v1.xml deleted file mode 100644 index 3c4938a66d..0000000000 --- a/conf/vanilla/mrcp_profiles/nuance-5.0-mrcp-v1.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/conf/vanilla/mrcp_profiles/nuance-5.0-mrcp-v2.xml b/conf/vanilla/mrcp_profiles/nuance-5.0-mrcp-v2.xml deleted file mode 100644 index b53cba0984..0000000000 --- a/conf/vanilla/mrcp_profiles/nuance-5.0-mrcp-v2.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/conf/vanilla/mrcp_profiles/unimrcpserver-mrcp-v1.xml b/conf/vanilla/mrcp_profiles/unimrcpserver-mrcp-v1.xml deleted file mode 100644 index fe02b1582f..0000000000 --- a/conf/vanilla/mrcp_profiles/unimrcpserver-mrcp-v1.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/conf/vanilla/mrcp_profiles/vestec-mrcp-v1.xml b/conf/vanilla/mrcp_profiles/vestec-mrcp-v1.xml deleted file mode 100644 index cbde87ca5a..0000000000 --- a/conf/vanilla/mrcp_profiles/vestec-mrcp-v1.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/conf/vanilla/mrcp_profiles/voxeo-prophecy-8.0-mrcp-v1.xml b/conf/vanilla/mrcp_profiles/voxeo-prophecy-8.0-mrcp-v1.xml deleted file mode 100644 index fb1d0ee287..0000000000 --- a/conf/vanilla/mrcp_profiles/voxeo-prophecy-8.0-mrcp-v1.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/configure.ac b/configure.ac index 24e838731a..52b0a3cd98 100644 --- a/configure.ac +++ b/configure.ac @@ -1089,7 +1089,7 @@ fi # Tested and fixed lot of modules, but some are untested. Will be added back when the core team decide it ready # Untested modules : mod_osp mod_soundtouch mod_sangoma_codec mod_opal mod_h323 mod_khomp -# mod_unimrcp mod_cepstral mod_erlang_event mod_snmp mod_perl mod_java mod_managed +# mod_cepstral mod_erlang_event mod_snmp mod_perl mod_java mod_managed # #saved_CFLAGS="$CFLAGS" #AC_CACHE_CHECK([whether compiler supports -Wunused-but-set-variable], [ac_cv_gcc_unused_but_set_variable], [ @@ -2144,7 +2144,6 @@ AC_CONFIG_FILES([Makefile src/mod/asr_tts/mod_flite/Makefile src/mod/asr_tts/mod_pocketsphinx/Makefile src/mod/asr_tts/mod_tts_commandline/Makefile - src/mod/asr_tts/mod_unimrcp/Makefile src/mod/codecs/mod_amr/Makefile src/mod/codecs/mod_amrwb/Makefile src/mod/codecs/mod_b64/Makefile @@ -2331,7 +2330,6 @@ if test "$use_system_apr" != "yes"; then AC_CONFIG_SUBDIRS([libs/apr]) fi AC_CONFIG_SUBDIRS([libs/iksemel]) -#AC_CONFIG_SUBDIRS([libs/unimrcp]) if test "x${enable_zrtp}" = "xyes"; then AC_CONFIG_SUBDIRS([libs/libzrtp]) fi diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index ba94c9d1ce..71c5b52f99 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -653,7 +653,6 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}), freeswitch-mod-flite (= \${binary:Version}), freeswitch-mod-pocketsphinx (= \${binary:Version}), freeswitch-mod-tts-commandline (= \${binary:Version}), - freeswitch-mod-unimrcp (= \${binary:Version}), freeswitch-mod-dialplan-asterisk (= \${binary:Version}), freeswitch-mod-dialplan-directory (= \${binary:Version}), freeswitch-mod-dialplan-xml (= \${binary:Version}), @@ -891,7 +890,6 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}), freeswitch-mod-flite-dbg (= \${binary:Version}), freeswitch-mod-pocketsphinx-dbg (= \${binary:Version}), freeswitch-mod-tts-commandline-dbg (= \${binary:Version}), - freeswitch-mod-unimrcp-dbg (= \${binary:Version}), freeswitch-mod-dialplan-asterisk-dbg (= \${binary:Version}), freeswitch-mod-dialplan-directory-dbg (= \${binary:Version}), freeswitch-mod-dialplan-xml-dbg (= \${binary:Version}), diff --git a/debian/control-modules b/debian/control-modules index f438d0277d..b9d7a05933 100644 --- a/debian/control-modules +++ b/debian/control-modules @@ -291,10 +291,6 @@ Module: asr_tts/mod_tts_commandline Description: mod_tts_commandline Adds mod_tts_commandline. -Module: asr_tts/mod_unimrcp -Description: mod_unimrcp - Adds mod_unimrcp. - ## mod/codecs Module: codecs/mod_amr diff --git a/debian/copyright b/debian/copyright index af7a6fe152..01473e4940 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1011,12 +1011,6 @@ License: MPL-1.1 or GPL-2+ use the text of this Exhibit A rather than the text found in the Original Code Source Code for Your Modifications.] -Files: libs/unimrcp/* -Copyright: 2008-2010 Arsen Chaloyan - 2009-2010 Tomas Valenta, Arsen Chaloyan - 2001-2006 Steve Underwood -License: Apache-2.0 - Files: */inet_pton.c libs/curl/lib/inet_ntop.c libs/curl/lib/mprintf.c diff --git a/docs/Doxygen.conf b/docs/Doxygen.conf index 5df2a2bcb2..9e62b08232 100644 --- a/docs/Doxygen.conf +++ b/docs/Doxygen.conf @@ -1242,7 +1242,7 @@ SEARCH_INCLUDES = YES INCLUDE_PATH =../libs/apr ../libs/apr-util ../libs/iksemel ../libs/libnatpmp \ ../libs/miniupnpc ../libs/sofia-sip ../libs/spandsp \ - ../libs/srtp ../libs/unimrcp ../libs/win32 ../libs/xmlrpc-c + ../libs/srtp ../libs/win32 ../libs/xmlrpc-c # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the diff --git a/freeswitch.spec b/freeswitch.spec index 7bdb8eaec6..8672b4fc59 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -636,15 +636,6 @@ Requires: %{name} = %{version}-%{release} Provides FreeSWITCH mod_tts_commandline, Run a command line and play the output file. -%package asrtts-unimrcp -Summary: FreeSWITCH mod_unimrcp -Group: System/Libraries -Requires: %{name} = %{version}-%{release} - -%description asrtts-unimrcp -Provides FreeSWITCH mod_unimrcp, allows communication with Media Resource -Control Protocol (MRCP) servers - ###################################################################################################################### # FreeSWITCH Codec Modules ###################################################################################################################### @@ -1435,7 +1426,7 @@ APPLICATIONS_MODULES="$APPLICATION_MODULES_AC $APPLICATION_MODULES_DE $APPLICATI # Automatic Speech Recognition and Text To Speech Modules # ###################################################################################################################### -ASR_TTS_MODULES="asr_tts/mod_flite asr_tts/mod_pocketsphinx asr_tts/mod_tts_commandline asr_tts/mod_unimrcp" +ASR_TTS_MODULES="asr_tts/mod_flite asr_tts/mod_pocketsphinx asr_tts/mod_tts_commandline" ###################################################################################################################### # @@ -1962,7 +1953,6 @@ fi %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/translate.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/tts_commandline.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/unicall.conf.xml -%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/unimrcp.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/verto.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/voicemail.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/voicemail_ivr.conf.xml @@ -2163,9 +2153,6 @@ fi %files asrtts-tts-commandline %{MODINSTDIR}/mod_tts_commandline.so* -%files asrtts-unimrcp -%{MODINSTDIR}/mod_unimrcp.so* - ###################################################################################################################### # # CODEC Packages diff --git a/libs/.gitignore b/libs/.gitignore index cb4112eb88..f1d983b2da 100644 --- a/libs/.gitignore +++ b/libs/.gitignore @@ -551,102 +551,6 @@ opal /tiff-*/tools/tiffmedian /tiff-*/tools/tiffset /tiff-*/tools/tiffsplit -/unimrcp/build/acmacros/libtool.m4 -/unimrcp/build/acmacros/lt~obsolete.m4 -/unimrcp/build/acmacros/ltoptions.m4 -/unimrcp/build/acmacros/ltsugar.m4 -/unimrcp/build/acmacros/ltversion.m4 -/unimrcp/build/Makefile -/unimrcp/build/Makefile.in -/unimrcp/build/pkgconfig/Makefile -/unimrcp/build/pkgconfig/Makefile.in -/unimrcp/build/svnrev/Makefile -/unimrcp/build/svnrev/Makefile.in -/unimrcp/build/svnrev/svnrev -!/unimrcp/build/tools/unimrcpservice.exe.manifest -!/unimrcp/build/uni_revision.h -!/unimrcp/configure.gnu -/unimrcp/conf/Makefile -/unimrcp/conf/Makefile.in -/unimrcp/data/Makefile -/unimrcp/data/Makefile.in -/unimrcp/docs/doxygen.conf -/unimrcp/libs/apr-toolkit/Makefile -/unimrcp/libs/apr-toolkit/Makefile.in -/unimrcp/libs/Makefile -/unimrcp/libs/Makefile.in -/unimrcp/libs/mpf/Makefile -/unimrcp/libs/mpf/Makefile.in -/unimrcp/libs/mrcp-client/Makefile -/unimrcp/libs/mrcp-client/Makefile.in -/unimrcp/libs/mrcp-engine/Makefile -/unimrcp/libs/mrcp-engine/Makefile.in -/unimrcp/libs/mrcp/Makefile -/unimrcp/libs/mrcp/Makefile.in -/unimrcp/libs/mrcp-server/Makefile -/unimrcp/libs/mrcp-server/Makefile.in -/unimrcp/libs/mrcp-signaling/Makefile -/unimrcp/libs/mrcp-signaling/Makefile.in -/unimrcp/libs/mrcpv2-transport/Makefile -/unimrcp/libs/mrcpv2-transport/Makefile.in -/unimrcp/libs/uni-rtsp/Makefile -/unimrcp/libs/uni-rtsp/Makefile.in -/unimrcp/Makefile -/unimrcp/Makefile.in -/unimrcp/modules/Makefile -/unimrcp/modules/Makefile.in -/unimrcp/modules/mrcp-sofiasip/Makefile -/unimrcp/modules/mrcp-sofiasip/Makefile.in -/unimrcp/modules/mrcp-unirtsp/Makefile -/unimrcp/modules/mrcp-unirtsp/Makefile.in -/unimrcp/platforms/asr-client/asrclient -/unimrcp/platforms/asr-client/Makefile -/unimrcp/platforms/asr-client/Makefile.in -/unimrcp/platforms/libasr-client/Makefile -/unimrcp/platforms/libasr-client/Makefile.in -/unimrcp/platforms/libunimrcp-client/Makefile -/unimrcp/platforms/libunimrcp-client/Makefile.in -/unimrcp/platforms/libunimrcp-server/Makefile -/unimrcp/platforms/libunimrcp-server/Makefile.in -/unimrcp/platforms/Makefile -/unimrcp/platforms/Makefile.in -/unimrcp/platforms/umc/Makefile -/unimrcp/platforms/umc/Makefile.in -/unimrcp/platforms/umc/umc -/unimrcp/platforms/unimrcp-client/Makefile -/unimrcp/platforms/unimrcp-client/Makefile.in -/unimrcp/platforms/unimrcp-client/unimrcpclient -/unimrcp/platforms/unimrcp-server/Makefile -/unimrcp/platforms/unimrcp-server/Makefile.in -/unimrcp/platforms/unimrcp-server/unimrcpserver -/unimrcp/plugins/demo-recog/Makefile -/unimrcp/plugins/demo-recog/Makefile.in -/unimrcp/plugins/demo-synth/Makefile -/unimrcp/plugins/demo-synth/Makefile.in -/unimrcp/plugins/demo-verifier/Makefile -/unimrcp/plugins/demo-verifier/Makefile.in -/unimrcp/plugins/Makefile -/unimrcp/plugins/Makefile.in -/unimrcp/plugins/mrcp-cepstral/Makefile -/unimrcp/plugins/mrcp-cepstral/Makefile.in -/unimrcp/plugins/mrcp-flite/Makefile -/unimrcp/plugins/mrcp-flite/Makefile.in -/unimrcp/plugins/mrcp-pocketsphinx/Makefile -/unimrcp/plugins/mrcp-pocketsphinx/Makefile.in -/unimrcp/plugins/mrcp-recorder/Makefile -/unimrcp/plugins/mrcp-recorder/Makefile.in -/unimrcp/tests/apttest/Makefile -/unimrcp/tests/apttest/Makefile.in -/unimrcp/tests/Makefile -/unimrcp/tests/Makefile.in -/unimrcp/tests/mpftest/Makefile -/unimrcp/tests/mpftest/Makefile.in -/unimrcp/tests/mrcptest/Makefile -/unimrcp/tests/mrcptest/Makefile.in -/unimrcp/tests/rtsptest/Makefile -/unimrcp/tests/rtsptest/Makefile.in -/unimrcp/tests/strtablegen/Makefile -/unimrcp/tests/strtablegen/Makefile.in /win32/celt/*/*/libcelt.log /win32/libg722_1/*/*/libg722_1.log /win32/libshout/*/*/libshout.log @@ -708,7 +612,6 @@ ilbc/config/compile libg722_1/config/compile pcre/compile srtp/build/compile -unimrcp/build/compile /pcre-*/ /speex-*/ /curl-*/ @@ -723,7 +626,6 @@ libyuv/Makefile libyuv/convert srtp/configure tiff-4.0.2/configure -unimrcp/configure zlib-*/ zlib-* libpq-*/ diff --git a/libs/unimrcp/.gitignore b/libs/unimrcp/.gitignore deleted file mode 100644 index 90ec22bee1..0000000000 --- a/libs/unimrcp/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.svn diff --git a/libs/unimrcp/.update b/libs/unimrcp/.update deleted file mode 100644 index 5875d6e932..0000000000 --- a/libs/unimrcp/.update +++ /dev/null @@ -1 +0,0 @@ -Mon Nov 17 11:06:30 EST 2014 diff --git a/libs/unimrcp/AUTHORS b/libs/unimrcp/AUTHORS deleted file mode 100644 index 6c7b0eee09..0000000000 --- a/libs/unimrcp/AUTHORS +++ /dev/null @@ -1,17 +0,0 @@ -Author(s): - Arsen Chaloyan - - -Contributor(s): - Kamil Shakirov - Anthony Masse - Vlad Socaciu - Garmt - Patrick Nunes - Bayram Boyraz - Mahmoud Hassan - Michael Jerris - Carlos Pina Soares - Chaitanya Chokkareddy - Tomas Valenta - Danijel Korzinek diff --git a/libs/unimrcp/CHANGES b/libs/unimrcp/CHANGES deleted file mode 100644 index 8271824144..0000000000 --- a/libs/unimrcp/CHANGES +++ /dev/null @@ -1,214 +0,0 @@ -Changes for UniMRCP-1.2.0 - - APR-toolkit library - - * Implemented a new interface for the NLSML parser in accordance with the NSLML schema defined in http://tools.ietf.org/html/rfc6787#section-16.1. - * Took out the legacy NLSML interface. - * Fixed a gcc warning for strict-aliasing rules. - * Implemented apt_pair_array_generate() in 2 passes, apr_pstrcatv() alike. - * Prevent compilation warnings for unused-but-set-variable. - * Use int instead of apt_task_msg_type_e to suppress a warning triggered by gcc 4.7: case value not in enumerated type 'apt_task_msg_type_e'. - * Upon creation of a new memory pool, register apr_abortfunc_t callback which is supposed to be invoked when memory allocation fails within apr_pool. - * Added apt_va_log() which accepts va_list as an input argument. - * Set the default maximum number of log files used in rotation to 100. - * Set thread names for APT tasks to be shown in debuggers. Thanks Vali. - * Enable apt_timer logs only if APT_TIMER_DEBUG is defined. - * Use a local temporary char buffer to construct the hostname in apt_ip_get() not to allocate memory from a permanent pool. - * Unified pointer logging in APT style. Thanks Vali. - * Define APT_PTR_FMT as 0x%I64x for 64-bit Windows. - * Removed unused function apt_text_boolean_value_insert/apt_boolean_value_insert (inconsistent declaration/definition). Thanks Vali. - - MPF library - - * The function mpf_codec_lists_intersect() now returns FALSE if there is no match for the primary codec descriptor. - * Reject the RTP session if there is no match in remote and local codecs. - * Use the reserved RTP payload type 19 in case codec list is empty (media stream is rejected). - * If the codec list does not match the capabilities, mark the stream as disabled. - * Do not set SO_REUSEADDR on RTP sockets. - * Made G.711 implementation bit-exact with ITU-T reference implementation. - * Use APR typedefs in G.711 implementation. - * Improved the RTP port management for those cases when the specified RTP port range is not enough to handle concurrent MRCP sessions. - * Check the number of ports per engine to be even to ensure there is a room for a pair of RTP/RTCP ports. - * Added debugging capabilities to mpf_frame_buffer. - * Copy name string when adding to codec capabilities. Thanks Vali. - - MRCP common library - - * Use apr_snprintf() instead of sprintf() in mrcp_request_id_generate(). - * Get rid of local fixed-size char buffers and additional string copies. Instead, allocate buffers from memory pool and generate strings straight into the buffers. - - MRCP client library - - * Completed the implementation of the new API function to retrieve a SIP/RTSP response code received from the server (Issue-90). - * Fixed a potential crash of the client stack which could happen when the server unexpectedly closes the MRCPv2 connection while the client stack is processing an application request. - * Allow a pool/factory of signaling agents to be defined with the MRCPv1 and/or MRCPv2 profiles. - * Respond straight away with success to the session termination request if the session creation failed in the first place. - * Keep track of associations between RTP termination factories (pools of RTP ports) and media engines. - * Allow a pool/factory of media processing engines to be defined with the MRCPv1 and/or MRCPv2 profiles. - * Allow a pool/factory of MRCPv2 connection agents to be defined with the MRCPv2 profiles. - * Added the ability to specify an IP address by the name of network interface/adapter. - * Added a new accessor function to the client API mrcp_client_profiles_get() which retrieves the available profiles. - * Store the profile name not only as a key in the profile table but also in the profile structure. - * Allow setting an arbitrary tag to the profile. - - MRCP server library - - * Handle separately the case when an RTSP SETUP contains no SDP, which means it's up to the server to decide which codec to use. - * Fixed a crash if MRCP resource not found. Thanks Vali. - * Keep track of associations between RTP termination factories (pools of RTP ports) and media engines. - * Added the ability to specify an IP address by the name of network interface/adapter. - * Log maximum engine channel count exceeded. Thanks Vali. - - Sofia-SIP module (MRCPv2 agent) - - * Do not generate media format list for a disabled audio stream. - * Use snprintf() consistently in mrcp_sdp.c. - * Implemented the log redirection routine of SofiaSIP. - * Added an indentifier of the SofiaSIP agent to the log statement "Receive SIP Event". - - RTSP module (MRCPv1 agent) - - * Do not generate media format list for a disabled audio stream. - - Demo plugins - - * Respond with failure if codec descriptor is unavailable (associated media stream is disabled). - - UMC sample application - - * Terminate execution of sample application if media descriptor is unavailable (media stream is disabled). - * Use the new NLSML parser interface in sample apps. - * Set the header field Save-Waveform to TRUE in the sample umc recog application. - * Fixed an invalid read of 8 bytes in umc application: sizeof(mpf_codec_capabilities_t) was meant to be allocated. - - ASR Client application (and library) - - * Get rid of 1Kb grammar file limit in libasrclient. Load the content into an allocated buffer instead. - - Miscellaneous - - * Copy the version and revision header files located in the build directory to the SDK include directory. - * Added/fixed support for DESTDIR. - * Take into consideration m4 macro files generated for/by libtool 2. - * Set ac_macro_dir variable manually, since newer versions of autoconf don't do that. - * Enable silent build rules (--enable-silent-rules)and use silent build by default. - * Enhanced the report generated by the ./configure script. - * Pass no-define to AM_INIT_AUTOMAKE in order not to define PACKAGE and VERSION. - * Do not use autoconf generated compiler DEFS by replacing confdefs.h after AC_INIT, AM_INIT_AUTOMAKE and AC_PROG_LIBTOLL getting called. - * Updated definition of the macro AX_COMPILER_VENDOR and moved it out from configure.ac to a separate m4 file. - * Added missing dereferences of pointers to the (potential) terminal NUL of some strings. Thanks Vali. - * Disabled DEFAULT_INCLUDES provided by automake. - * Added generic apr_common.m4 in order to use helper m4 macros APR_ADDTO() and APR_CONFIG_NICE(). - * Generate ./config.nice to reuse ./configure command-line. - * Added uni_plugin.m4 which provides generic macros UNI_PLUGIN_ENABLED(name) and UNI_PLUGIN_DISABLED(name). - * Added common GNU make rules/vars for plugins, client and server libs/apps alike VS property sheets. - * The macro UNIMRCP_CHECK_APR() now checks and sets variables for both APR and APR-util libraries. - * Added a brief description of the license definition which is intended to be used for Windows resource files only. - * Brought XML schema definitions of configuration file formats up to date. - * Cppcheck: printf-like formats fix, possible NULL pointer dereference, member not initialized in the constructor, - unused variable/value, method can be made static. Thanks Vali. - * Define _WIN64 in Visual Studio x64 targets (for IDE only, the compiler defines _WIN64 anyway). Thanks Vali. - * Fixed some GCC warnings. Thanks Vali. - * Moved mrcp-flite and mrcp-pocketsphinx plugins out of the source tree into the external solutions directory. - - -Changes for UniMRCP-1.1.0 - - APR-toolkit library - - * The function apt_log_file_open() makes a copy of dir_path and file_name variables passed from a user application. - * Applied a patch to the apt_log routine which allows the log file to be appended instead of being overwritten. The patch was submitted by Dani. Thanks. - * Added a new parameter to the function apt_log_file_open() which specifies whether the log file should be appended or overwritten. - * Fixed the formatting of float values in the header fields. Applied a patch submitted by Randy (Issue-108). Thanks. - * Fixed apt_log_output_mode_check() which returned TRUE if any mode was enabled or checked regardless their correspondence. Thanks Vali. - * Enhanced the debug output by adding task message identifier to the log statements "Signal Message" and "Process Message". - * Fixed a potential crash related to the use of pollsets. - * Fixed a potential buffer overflow in apt_text_pair_array_insert(). Thanks Vali. - * Remove a socket descriptor from the pollset only if the descriptor has been properly added to the pollset. Otherwise, this operation could cause a crash. - - MPF library - - * Tweaked DTMF detector's energy thresholds to eliminate false positives during in-band (from audio) DTMF detection. Thanks Vali. - * Took into consideration the RTP marker in order to re-sync the jitter buffer on a new talkspurt. Audio data loss could be experienced in the RTP receiver in case of consecutive SPEAK (for client) or RECOGNIZE (for server) requests. - * Instead of discarding a non-aligned RTP packet, adjust the timestamp and write available frames to the jitter buffer (Issue-122). - * Added support for the adaptive jitter buffer. Applied a reworked patch submitted by Erik. Thanks. - * Enhanced the detection of a new RTP talkspurt by implicitly setting the RTP marker if a gap between two RTP packets is more than the specified threshold (INTER_TALSKPUSRT_GAP = 1000 msec). - * Allow the initial playout delay in the jitter buffer to be set to 0. - * Implemented a time skew detection algorithm for RTP streams. The detection can be enabled and used for both the adaptive and static jitter buffer. - * Added support for redirection of RTP traces (RTP_TRACE, JB_TRACE) to the debug output window of Visual Studio. - * Enhanced the processing of the RTP named events. - - RTSP library - - * Use strcasecmp() instead of apr_strnatcasecmp() to match RTSP resource names (Issue-94). - * Fixed a crash in the RTSP client stack when the server closes a TCP connection while the associated RTSP session is being destroyed (Issue-124). - * Fixed the processing of RTSP TEARDOWN requests being timed out. Applied a patch submitted to Issue-125 by Chris. Thanks. - * For logging purposes, pass a string identifier of the RTSP/MRCPv1 signaling agent to the RTSP client and server stacks. - - MRCP common library - - * Added missing recognizer header fields used for voice enrollment (speaker-dependent recognition). - * Added support for custom MRCP header fields. - * Added support for speaker verification and identification resource. - * Added missing recognizer methods used for voice enrollment and interpretation. - * Updated the state machine of the recognizer resource to take into consideration requests, responses and events used for interpretation. - * Enhanced helper functions which operate on the MRCP header to properly set, get and inherit header fields (Issue-110). - - MRCP client library - - * Added support for SIP redirection with 300 Multiple Choices used by the Nuance Resource Manager. - * Added support for feature-tags set in the SIP Accept-Contact header field in an outgoing SIP INVITE message sent to the Nuance Resource Manager. - * Added a new accessor function to the client API to get an audio stream associated with the specified channel. The function name is mrcp_application_audio_stream_get(). - * Added the ability to retrieve an external object associated with the MRCP session through the log handler (apt_log_ext_handler_f). - * Fixed the processing of a response to the SIP OPTIONS request used for resource discovery (Issue-112). - * Added a new constructor function unimrcp_client_create2() which allows to pass the client XML configuration not by a file, but rather by a string parameter. Thanks Vali. - * Fixed the processing of more than one pending application requests upon reception of a SIP BYE message from the server. - * Fixed the loading of the client configuration parameter . - * Respond to client user application requests with failure if a new session couldn't be created due to an error in initialization of the SIP stack (Issue-127). - * When originating an offer from the client, take into account capabilities of an audio stream created by the client user application. - * Added a new function to the client API to retrieve a SIP/RTSP response code received from the server (Issue-90). The support is incomplete. - - MRCP server library - - * Fixed an interoperability issue with AVP. The mid attribute is not required when the SDP contains only one m-line. - * Fixed the build of C++ MRCP plugins for platforms other than Win32. Thanks Vali. - * Added the ability to take and use parameters set by the plugin in a response to the GET-PARAMS request. Thanks Vali. - - Sofia-SIP module - - * Took out unused tags (variables) to compile with Sofia-SIP 1.12.11. - * Added support for Sofia-SIP's TPTAG_LOG() and TPTAG_DUMP() tags which can be enabled from the client and server configuration to print out and/or dump SIP messages. - - PocketSphinx plugin - - * In the PocketSphinx plugin, instead of using one common timeout for detection of speech activity and inactivity, use two different timeouts: one for activity and the other for inactivity detection. - * In the recognition results sent from the PocketSphinx plugin, set both and elements. - * Fixed a race condition in the PocketSphinx plugin which caused the server to crash. - * Fixed the use of recognition timer in the PocketSphinx plugin. - * Set an MRCP version specific completion cause in the PocketSphinx plugin. - - UniMRCP server application - - * Enhanced the UniMRCP Windows service manager. Thanks Vali. - * Corrected FileType in Windows resources from DLL to APP. Thanks Vali. - * Added a Windows resource file for the unimrcpservice application. - - UMC sample application - - * Set the default profile name in umcscenarios.xml to "uni2". - * Added sample 8kHz and 16 kHz voiceprints in the data directory which are used by the umc application for a sample verification scenario. - * Added mandatory attributes for the SSML element in the sample speak.xml file. - * Added support for a binary recognition grammar used in RecogScenario by the sample umc application. Thanks Vali. - * Added a sample SRGS ABNF grammar to the data directory. - - Miscellaneous - - * Added init.d script. The script was originally submitted by pdeschen. Thanks. - * Modified the "prepare" utility project to use the new location of PthreadVC2.dll which is now built from source with other dependencies. - * Added support for Visual Studio 2010. - * Modified the MPF test application to read a raw PCM data from one file, transmit it over RTP, and write the data back to another file. - * Set the libtool parameters link_all_deplibs and link_all_deplibs_CXX to "yes" by default, with an option to disable them (--disable-interlib-deps), if ever needed. This fixes a link error on recent Debian/Ubuntu distributions. - * Modified the apr.m4 and apu.m4 macros to use '--link-ld' instead of '--link-libtool --libs' for the APR library dependencies. This addresses the problem with a wrong -L path to the expat library. - * Set prerequisite version for autoconf to 2.59. - * Added a checking for pkg-config to the configure script. - * Added a new option (-v or --version) to the unimrcpserver as well as the sample umc and unimrcpclient applications. diff --git a/libs/unimrcp/INSTALL b/libs/unimrcp/INSTALL deleted file mode 100644 index 2d4f0d8eec..0000000000 --- a/libs/unimrcp/INSTALL +++ /dev/null @@ -1,158 +0,0 @@ -BUILD REQUIREMENTS -================== - -The UniMRCP project depends on a number of third party tools and libraries which must be installed first. - -All the required dependencies are available to download prepackaged for the UniMRCP use from the -following location: - - http://www.unimrcp.org/downloads/dependencies - -Alternatively, original versions of the libraries as well as patches on them can be downloaded -separately from the following location: - - http://www.unimrcp.org/dependencies - -References: - -1. Apache Portable Runtime [>=1.2.x] (http://apr.apache.org). -In order to build any part of the UniMRCP project, the Apache Portable Runtime (APR) and -the APR Utility (APR-util) libraries are required. The libraries provide a consistent interface to -underlying platform-specific implementations. - -2. Sofia-SIP [>=1.12.6] (http://sofia-sip.sourceforge.net). -Sofia-SIP is an open-source SIP User-Agent library, compliant with the IETF RFC3261 specification. -The library is utilized for implementation of SIP signaling for MRCPv2. The SDP message parser is -also used for both MRCPv2 (SIP/SDP) and MRCPv1 (RTSP/SDP). - - -GNU BUILD -========= - -Prerequisites: - - autoconf 2.59 or newer - automake - libtool 1.4 or newer - gcc - pkg-config - - -Procedure: - -If the UniMRCP source is checked out from the repository, the "bootstrap" script must be run first -in order to generate the "configure" script and other required files. - - ./bootstrap - -The usual "configure", "make", "make install" sequence of commands should follow in order to build -and install the project from source. - - ./configure - make - make install - -As a result, the project will be installed in the directory "/usr/local/unimrcp" with the following -layout: - - bin binaries (unimrcpserver, unimrcpclient, ...) - conf configuration files (unimrcpserver.xml, unimrcpclient.xml, ...) - data data files - include header files - lib shared (convenience) libraries - log log files - plugin run-time loadable modules - -There are a couple of options which can additionally be configured. -In order to specify where to look for the APR and APR-util libraries, use the "--with-apr=" and -"--with-apr-util=" options respectively. For example: - - ./configure --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr - -In order to specify where to look for the Sofia-SIP library, use the "--with-sofia-sip=" option. -For example: - - ./configure --with-sofia-sip=/usr/local/sofia-sip - -In order to generate executables and shared libraries for x86-64 architecture, use the "-m64" -option as follows: - - CFLAGS=-m64 CXXFLAGS=-m64 LDFLAGS=-m64 ./configure - -In order to generate executables and shared libraries for i386 architecture, use the "-m32" option -as follows: - - CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32 ./configure - -In order to install the default configuration, use the following commands: - - cd conf - make def-conf - -In order to install the default data files, use the following commands: - - cd data - make def-data - -In order to build a Doxygen generated documentation, use the following command: - - make dox - - -WINDOWS BUILD -============= - -Prerequisites: - - Microsoft Visual Studio 2005 or 2010. - -One-time pre-build setup: [optional] - -This step can be skipped if the dependencies are installed in their default locations. Otherwise, -the paths in the corresponding property sheets must be modified accordingly. Below is the content -of property sheets for Visual Studio 2005, which are located in the directory "build/vsprops". -Similarly, property sheets for Visual Studio 2010 can be found in the directory "build/props". - -apr.vsprops - - - -sofiasip.vsprops - - -Procedure: - -1. Open one of the available solution files: - * for Visual Studio 2005, use unimrcp.sln, - * for Visual Studio 2010, use unimrcp-2010.sln. -2. Choose a platform (Build -> Configuration Manager): - * win32 - * x64. -3. Choose a configuration (Build -> Configuration Manager): - * Debug - * Release. -4. Build the solution (Build -> Build Solution). - -One-time output directory setup: - -Build the "prepare.vcproj" utility project by right clicking on the project icon from the Solution -Explorer (tools->prepare) and selecting the Build command from the context menu. This routine will -setup the output directory and copy all the required APR, APR-Util, and Sofia-SIP libraries as well -as the default configuration and data files. As a result, the output directory layout will look -like the following: - - bin binaries (unimrcpserver, unimrcpclient, ...) and all the required dlls - conf configuration files (unimrcpserver.xml, unimrcpclient.xml, ...) - data data files - lib libraries - log log files - plugin run-time loadable modules diff --git a/libs/unimrcp/LICENSE b/libs/unimrcp/LICENSE deleted file mode 100644 index d645695673..0000000000 --- a/libs/unimrcp/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/libs/unimrcp/Makefile.am b/libs/unimrcp/Makefile.am deleted file mode 100644 index caa6756c06..0000000000 --- a/libs/unimrcp/Makefile.am +++ /dev/null @@ -1,36 +0,0 @@ -macrodir = @ac_macro_dir@ -auxdir = @ac_aux_dir@ - -AUX_DIST = $(auxdir)/compile \ - $(auxdir)/config.guess \ - $(auxdir)/config.sub \ - $(auxdir)/install-sh \ - $(auxdir)/ltconfig \ - $(auxdir)/ltmain.sh \ - $(auxdir)/depcomp \ - $(auxdir)/missing - -MACRO_DIST = $(macrodir)/libtool.m4 \ - $(macrodir)/ltoptions.m4 \ - $(macrodir)/ltsugar.m4 \ - $(macrodir)/ltversion.m4 \ - $(macrodir)/lt~obsolete.m4 - -EXTRA_DIST = bootstrap - -AUTOMAKE_OPTIONS = foreign -MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure config.nice $(AUX_DIST) $(MACRO_DIST) - -ACLOCAL = aclocal -I $(macrodir) - -SUBDIRS = build conf data libs modules plugins platforms -if TEST_SUITES -SUBDIRS += tests -endif - -dox: - doxygen $(top_srcdir)/docs/doxygen.conf - -install-data-local: - test -d $(DESTDIR)$(logdir) || $(mkinstalldirs) $(DESTDIR)$(logdir) - test -d $(DESTDIR)$(vardir) || $(mkinstalldirs) $(DESTDIR)$(vardir) diff --git a/libs/unimrcp/NOTICE b/libs/unimrcp/NOTICE deleted file mode 100644 index 37f1bf3c01..0000000000 --- a/libs/unimrcp/NOTICE +++ /dev/null @@ -1,47 +0,0 @@ -The UniMRCP Project (http://www.unimrcp.org) -Copyright (C) 2008-2010 Arsen Chaloyan -Licensed under the Apache License, Version 2.0 (the "License"). - -This product includes a number of subcomponents with -separate copyright notices and license terms. - - -Notice for APR (Apache Portable Runtime) library ---------------------------------------------------- -This product includes software developed by -The Apache Software Foundation (http://www.apache.org/). - -Portions of this software were developed at the National Center -for Supercomputing Applications (NCSA) at the University of -Illinois at Urbana-Champaign. - -This software contains code derived from the RSA Data Security -Inc. MD5 Message-Digest Algorithm. ---------------------------------------------------- - - -Notice for Sofia-SIP library ---------------------------------------------------- -Copyright (C) 2005-2006 Nokia Corporation and others (see the -in individual files for a detailed list of copyright holders). -Contact: Pekka Pessi - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public License -as published by the Free Software Foundation; either version 2.1 of -the License, or (at your option) any later version. ---------------------------------------------------- - - -Notice for G711 implementation ---------------------------------------------------- -g711.h/g711.c - A-law and u-law transcoding routines - -Written by Steve Underwood -Copyright (C) 2006 Steve Underwood - -Despite my general liking of the GPL, I place this code in the -public domain for the benefit of all mankind - even the slimy -ones who might try to proprietize my work and use it to my -detriment. ---------------------------------------------------- diff --git a/libs/unimrcp/README b/libs/unimrcp/README deleted file mode 100644 index 55e84045be..0000000000 --- a/libs/unimrcp/README +++ /dev/null @@ -1,59 +0,0 @@ -INTRODUCTION -============ - -UniMRCP is an open source project compliant with the IETF RFC6787 (MRCPv2) and RFC4463 (MRCPv1) -specifications. - - -INSTALLATION -============ - -See the file "INSTALL" for installation tips. - - -DOCUMENTATION -============= - -Use the directory "docs/dox" for a documentation generated by Doxygen. -Use the directory "docs/ea" for UML based design concepts, HTML pages generated by Enterpise Architect. - - -REFERENCES -========== - -Website: - http://www.unimrcp.org - -Downloads: - http://www.unimrcp.org/downloads - -Documentation: - http://www.unimrcp.org/documentation - -Google Code: - http://code.google.com/p/unimrcp - -Issue Tracker: - http://code.google.com/p/unimrcp/issues/list - -Discussion Group: - http://groups.google.com/group/unimrcp - -Version Control Repository (SVN): - http://unimrcp.googlecode.com/svn/trunk - -UML Documentation File (Enterpise Architect): - http://unimrcp.googlecode.com/svn/misc/unimrcp.eap - -Commit Monitor: - http://code.google.com/p/unimrcp/source/list - http://groups.google.com/group/unimrcp-svn-commits - - -LICENSING -========= - -UniMRCP is licensed under terms of the Apache License 2.0. -See the file "LICENSE" for more information. - -Copyright 2008 - 2014 Arsen Chaloyan diff --git a/libs/unimrcp/acinclude.m4 b/libs/unimrcp/acinclude.m4 deleted file mode 100644 index 14fa221614..0000000000 --- a/libs/unimrcp/acinclude.m4 +++ /dev/null @@ -1,7 +0,0 @@ -m4_include([build/acmacros/apr.m4]) -m4_include([build/acmacros/find_apr.m4]) -m4_include([build/acmacros/find_apu.m4]) -m4_include([build/acmacros/sofia-sip.m4]) -m4_include([build/acmacros/ax_compiler_vendor.m4]) -m4_include([build/acmacros/apr_common.m4]) -m4_include([build/acmacros/uni_plugin.m4]) diff --git a/libs/unimrcp/bootstrap b/libs/unimrcp/bootstrap deleted file mode 100755 index e037f546a3..0000000000 --- a/libs/unimrcp/bootstrap +++ /dev/null @@ -1,14 +0,0 @@ -#! /bin/sh - -case `uname` in - Darwin) libtoolize=glibtoolize ;; - *) libtoolize=libtoolize ;; -esac - -set -x -$libtoolize --force --automake --copy -aclocal -I build/acmacros -automake --foreign --add-missing --copy -autoconf - -rm -rf autom4te.cache diff --git a/libs/unimrcp/build/Makefile.am b/libs/unimrcp/build/Makefile.am deleted file mode 100644 index 859d2a553f..0000000000 --- a/libs/unimrcp/build/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -SUBDIRS = pkgconfig - -include_HEADERS = uni_version.h uni_revision.h diff --git a/libs/unimrcp/build/acmacros/apr.m4 b/libs/unimrcp/build/acmacros/apr.m4 deleted file mode 100644 index 0fc55215eb..0000000000 --- a/libs/unimrcp/build/acmacros/apr.m4 +++ /dev/null @@ -1,79 +0,0 @@ -dnl -dnl UNIMRCP_CHECK_APR -dnl -dnl This macro attempts to find APR and APR-util libraries and -dnl set corresponding variables on exit. -dnl -AC_DEFUN([UNIMRCP_CHECK_APR], -[ - AC_MSG_NOTICE([Apache Portable Runtime (APR) library configuration]) - - APR_FIND_APR("", "", 1, 1) - - if test $apr_found = "no"; then - AC_MSG_WARN([APR not found]) - UNIMRCP_DOWNLOAD_APR - fi - - if test $apr_found = "reconfig"; then - AC_MSG_WARN([APR reconfig]) - fi - - dnl check APR version number - apr_version="`$apr_config --version`" - AC_MSG_RESULT([$apr_version]) - - dnl Get build information from APR - APR_ADDTO(CPPFLAGS,`$apr_config --cppflags`) - APR_ADDTO(CFLAGS,`$apr_config --cflags`) - APR_ADDTO(LDFLAGS,`$apr_config --ldflags`) - - APR_ADDTO(UNIMRCP_APR_INCLUDES,`$apr_config --includes`) - APR_ADDTO(UNIMRCP_APR_LIBS,`$apr_config --link-ld`) - - AC_MSG_NOTICE([Apache Portable Runtime Utility (APU) library configuration]) - - APR_FIND_APU("", "", 1, 1) - - if test $apu_found = "no"; then - AC_MSG_WARN([APU not found]) - UNIMRCP_DOWNLOAD_APU - fi - - if test $apu_found = "reconfig"; then - AC_MSG_WARN([APU reconfig]) - fi - - dnl check APU version number - apu_version="`$apu_config --version`" - AC_MSG_RESULT([$apu_version]) - - dnl Get build information from APU - APR_ADDTO(LDFLAGS,`$apu_config --ldflags`) - - APR_ADDTO(UNIMRCP_APR_INCLUDES,`$apu_config --includes`) - APR_ADDTO(UNIMRCP_APR_LIBS,`$apu_config --link-ld`) - - AC_SUBST(UNIMRCP_APR_INCLUDES) - AC_SUBST(UNIMRCP_APR_LIBS) -]) - -dnl UNIMRCP_DOWNLOAD_APR -dnl no apr found, print out a message telling the user what to do -AC_DEFUN([UNIMRCP_DOWNLOAD_APR], -[ - echo "The Apache Portable Runtime (APR) library cannot be found." - echo "Please install APR on this system and supply the appropriate" - echo "--with-apr option to 'configure'" - AC_MSG_ERROR([no suitable APR found]) -]) - -dnl UNIMRCP_DOWNLOAD_APU -dnl no apr-util found, print out a message telling the user what to do -AC_DEFUN([UNIMRCP_DOWNLOAD_APU], -[ - echo "The Apache Portable Runtime Utility (APU) library cannot be found." - echo "Please install APRUTIL on this system and supply the appropriate" - echo "--with-apr-util option to 'configure'" - AC_MSG_ERROR([no suitable APU found]) -]) diff --git a/libs/unimrcp/build/acmacros/apr_common.m4 b/libs/unimrcp/build/acmacros/apr_common.m4 deleted file mode 100644 index 6b5c0f033b..0000000000 --- a/libs/unimrcp/build/acmacros/apr_common.m4 +++ /dev/null @@ -1,990 +0,0 @@ -dnl -------------------------------------------------------- -*- autoconf -*- -dnl Licensed to the Apache Software Foundation (ASF) under one or more -dnl contributor license agreements. See the NOTICE file distributed with -dnl this work for additional information regarding copyright ownership. -dnl The ASF licenses this file to You under the Apache License, Version 2.0 -dnl (the "License"); you may not use this file except in compliance with -dnl the License. You may obtain a copy of the License at -dnl -dnl http://www.apache.org/licenses/LICENSE-2.0 -dnl -dnl Unless required by applicable law or agreed to in writing, software -dnl distributed under the License is distributed on an "AS IS" BASIS, -dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -dnl See the License for the specific language governing permissions and -dnl limitations under the License. - -dnl -dnl apr_common.m4: APR's general-purpose autoconf macros -dnl - -dnl -dnl APR_CONFIG_NICE(filename) -dnl -dnl Saves a snapshot of the configure command-line for later reuse -dnl -AC_DEFUN([APR_CONFIG_NICE], [ - rm -f $1 - cat >$1<> $1 - fi - if test -n "$CFLAGS"; then - echo "CFLAGS=\"$CFLAGS\"; export CFLAGS" >> $1 - fi - if test -n "$CPPFLAGS"; then - echo "CPPFLAGS=\"$CPPFLAGS\"; export CPPFLAGS" >> $1 - fi - if test -n "$LDFLAGS"; then - echo "LDFLAGS=\"$LDFLAGS\"; export LDFLAGS" >> $1 - fi - if test -n "$LTFLAGS"; then - echo "LTFLAGS=\"$LTFLAGS\"; export LTFLAGS" >> $1 - fi - if test -n "$LIBS"; then - echo "LIBS=\"$LIBS\"; export LIBS" >> $1 - fi - if test -n "$INCLUDES"; then - echo "INCLUDES=\"$INCLUDES\"; export INCLUDES" >> $1 - fi - if test -n "$NOTEST_CFLAGS"; then - echo "NOTEST_CFLAGS=\"$NOTEST_CFLAGS\"; export NOTEST_CFLAGS" >> $1 - fi - if test -n "$NOTEST_CPPFLAGS"; then - echo "NOTEST_CPPFLAGS=\"$NOTEST_CPPFLAGS\"; export NOTEST_CPPFLAGS" >> $1 - fi - if test -n "$NOTEST_LDFLAGS"; then - echo "NOTEST_LDFLAGS=\"$NOTEST_LDFLAGS\"; export NOTEST_LDFLAGS" >> $1 - fi - if test -n "$NOTEST_LIBS"; then - echo "NOTEST_LIBS=\"$NOTEST_LIBS\"; export NOTEST_LIBS" >> $1 - fi - - # Retrieve command-line arguments. - eval "set x $[0] $ac_configure_args" - shift - - for arg - do - APR_EXPAND_VAR(arg, $arg) - echo "\"[$]arg\" \\" >> $1 - done - echo '"[$]@"' >> $1 - chmod +x $1 -])dnl - -dnl APR_MKDIR_P_CHECK(fallback-mkdir-p) -dnl checks whether mkdir -p works -AC_DEFUN([APR_MKDIR_P_CHECK], [ - AC_CACHE_CHECK(for working mkdir -p, ac_cv_mkdir_p,[ - test -d conftestdir && rm -rf conftestdir - mkdir -p conftestdir/somedir >/dev/null 2>&1 - if test -d conftestdir/somedir; then - ac_cv_mkdir_p=yes - else - ac_cv_mkdir_p=no - fi - rm -rf conftestdir - ]) - if test "$ac_cv_mkdir_p" = "yes"; then - mkdir_p="mkdir -p" - else - mkdir_p="$1" - fi -]) - -dnl -dnl APR_SUBDIR_CONFIG(dir [, sub-package-cmdline-args, args-to-drop]) -dnl -dnl dir: directory to find configure in -dnl sub-package-cmdline-args: arguments to add to the invocation (optional) -dnl args-to-drop: arguments to drop from the invocation (optional) -dnl -dnl Note: This macro relies on ac_configure_args being set properly. -dnl -dnl The args-to-drop argument is shoved into a case statement, so -dnl multiple arguments can be separated with a |. -dnl -dnl Note: Older versions of autoconf do not single-quote args, while 2.54+ -dnl places quotes around every argument. So, if you want to drop the -dnl argument called --enable-layout, you must pass the third argument as: -dnl [--enable-layout=*|\'--enable-layout=*] -dnl -dnl Trying to optimize this is left as an exercise to the reader who wants -dnl to put up with more autoconf craziness. I give up. -dnl -AC_DEFUN([APR_SUBDIR_CONFIG], [ - # save our work to this point; this allows the sub-package to use it - AC_CACHE_SAVE - - echo "configuring package in $1 now" - ac_popdir=`pwd` - apr_config_subdirs="$1" - test -d $1 || $mkdir_p $1 - ac_abs_srcdir=`(cd $srcdir/$1 && pwd)` - cd $1 - -changequote(, )dnl - # A "../" for each directory in /$config_subdirs. - ac_dots=`echo $apr_config_subdirs|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'` -changequote([, ])dnl - - # Make the cache file pathname absolute for the subdirs - # required to correctly handle subdirs that might actually - # be symlinks - case "$cache_file" in - /*) # already absolute - ac_sub_cache_file=$cache_file ;; - *) # Was relative path. - ac_sub_cache_file="$ac_popdir/$cache_file" ;; - esac - - ifelse($3, [], [apr_configure_args=$ac_configure_args],[ - apr_configure_args= - apr_sep= - for apr_configure_arg in $ac_configure_args - do - case "$apr_configure_arg" in - $3) - continue ;; - esac - apr_configure_args="$apr_configure_args$apr_sep'$apr_configure_arg'" - apr_sep=" " - done - ]) - - dnl autoconf doesn't add --silent to ac_configure_args; explicitly pass it - test "x$silent" = "xyes" && apr_configure_args="$apr_configure_args --silent" - - dnl AC_CONFIG_SUBDIRS silences option warnings, emulate this for 2.62 - apr_configure_args="--disable-option-checking $apr_configure_args" - - dnl The eval makes quoting arguments work - specifically the second argument - dnl where the quoting mechanisms used is "" rather than []. - dnl - dnl We need to execute another shell because some autoconf/shell combinations - dnl will choke after doing repeated APR_SUBDIR_CONFIG()s. (Namely Solaris - dnl and autoconf-2.54+) - if eval $SHELL $ac_abs_srcdir/configure $apr_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_abs_srcdir $2 - then : - echo "$1 configured properly" - else - echo "configure failed for $1" - exit 1 - fi - - cd $ac_popdir - - # grab any updates from the sub-package - AC_CACHE_LOAD -])dnl - -dnl -dnl APR_SAVE_THE_ENVIRONMENT(variable_name) -dnl -dnl Stores the variable (usually a Makefile macro) for later restoration -dnl -AC_DEFUN([APR_SAVE_THE_ENVIRONMENT], [ - apr_ste_save_$1="$$1" -])dnl - -dnl -dnl APR_RESTORE_THE_ENVIRONMENT(variable_name, prefix_) -dnl -dnl Uses the previously saved variable content to figure out what configure -dnl has added to the variable, moving the new bits to prefix_variable_name -dnl and restoring the original variable contents. This makes it possible -dnl for a user to override configure when it does something stupid. -dnl -AC_DEFUN([APR_RESTORE_THE_ENVIRONMENT], [ -dnl Check whether $apr_ste_save_$1 is empty or -dnl only whitespace. The verbatim "X" is token number 1, -dnl the following whitespace will be ignored. -set X $apr_ste_save_$1 -if test ${#} -eq 1; then - $2$1="$$1" - $1= -else - if test "x$apr_ste_save_$1" = "x$$1"; then - $2$1= - else - $2$1=`echo "$$1" | sed -e "s%${apr_ste_save_$1}%%"` - $1="$apr_ste_save_$1" - fi -fi -if test "x$silent" != "xyes"; then - echo " restoring $1 to \"$$1\"" - echo " setting $2$1 to \"$$2$1\"" -fi -AC_SUBST($2$1) -])dnl - -dnl -dnl APR_SETIFNULL(variable, value) -dnl -dnl Set variable iff it's currently null -dnl -AC_DEFUN([APR_SETIFNULL], [ - if test -z "$$1"; then - test "x$silent" != "xyes" && echo " setting $1 to \"$2\"" - $1="$2" - fi -])dnl - -dnl -dnl APR_SETVAR(variable, value) -dnl -dnl Set variable no matter what -dnl -AC_DEFUN([APR_SETVAR], [ - test "x$silent" != "xyes" && echo " forcing $1 to \"$2\"" - $1="$2" -])dnl - -dnl -dnl APR_ADDTO(variable, value) -dnl -dnl Add value to variable -dnl -AC_DEFUN([APR_ADDTO], [ - if test "x$$1" = "x"; then - test "x$silent" != "xyes" && echo " setting $1 to \"$2\"" - $1="$2" - else - apr_addto_bugger="$2" - for i in $apr_addto_bugger; do - apr_addto_duplicate="0" - for j in $$1; do - if test "x$i" = "x$j"; then - apr_addto_duplicate="1" - break - fi - done - if test $apr_addto_duplicate = "0"; then - test "x$silent" != "xyes" && echo " adding \"$i\" to $1" - $1="$$1 $i" - fi - done - fi -])dnl - -dnl -dnl APR_REMOVEFROM(variable, value) -dnl -dnl Remove a value from a variable -dnl -AC_DEFUN([APR_REMOVEFROM], [ - if test "x$$1" = "x$2"; then - test "x$silent" != "xyes" && echo " nulling $1" - $1="" - else - apr_new_bugger="" - apr_removed=0 - for i in $$1; do - if test "x$i" != "x$2"; then - apr_new_bugger="$apr_new_bugger $i" - else - apr_removed=1 - fi - done - if test $apr_removed = "1"; then - test "x$silent" != "xyes" && echo " removed \"$2\" from $1" - $1=$apr_new_bugger - fi - fi -]) dnl - -dnl -dnl APR_CHECK_DEFINE_FILES( symbol, header_file [header_file ...] ) -dnl -AC_DEFUN([APR_CHECK_DEFINE_FILES], [ - AC_CACHE_CHECK([for $1 in $2],ac_cv_define_$1,[ - ac_cv_define_$1=no - for curhdr in $2 - do - AC_EGREP_CPP(YES_IS_DEFINED, [ -#include <$curhdr> -#ifdef $1 -YES_IS_DEFINED -#endif - ], ac_cv_define_$1=yes) - done - ]) - if test "$ac_cv_define_$1" = "yes"; then - AC_DEFINE(HAVE_$1, 1, [Define if $1 is defined]) - fi -]) - - -dnl -dnl APR_CHECK_DEFINE(symbol, header_file) -dnl -AC_DEFUN([APR_CHECK_DEFINE], [ - AC_CACHE_CHECK([for $1 in $2],ac_cv_define_$1,[ - AC_EGREP_CPP(YES_IS_DEFINED, [ -#include <$2> -#ifdef $1 -YES_IS_DEFINED -#endif - ], ac_cv_define_$1=yes, ac_cv_define_$1=no) - ]) - if test "$ac_cv_define_$1" = "yes"; then - AC_DEFINE(HAVE_$1, 1, [Define if $1 is defined in $2]) - fi -]) - -dnl -dnl APR_CHECK_APR_DEFINE( symbol ) -dnl -AC_DEFUN([APR_CHECK_APR_DEFINE], [ -apr_old_cppflags=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $INCLUDES" -AC_EGREP_CPP(YES_IS_DEFINED, [ -#include -#if $1 -YES_IS_DEFINED -#endif -], ac_cv_define_$1=yes, ac_cv_define_$1=no) -CPPFLAGS=$apr_old_cppflags -]) - -dnl APR_CHECK_FILE(filename); set ac_cv_file_filename to -dnl "yes" if 'filename' is readable, else "no". -dnl @deprecated! - use AC_CHECK_FILE instead -AC_DEFUN([APR_CHECK_FILE], [ -dnl Pick a safe variable name -define([apr_cvname], ac_cv_file_[]translit([$1], [./+-], [__p_])) -AC_CACHE_CHECK([for $1], [apr_cvname], -[if test -r $1; then - apr_cvname=yes - else - apr_cvname=no - fi]) -]) - -define(APR_IFALLYES,[dnl -ac_rc=yes -for ac_spec in $1; do - ac_type=`echo "$ac_spec" | sed -e 's/:.*$//'` - ac_item=`echo "$ac_spec" | sed -e 's/^.*://'` - case $ac_type in - header ) - ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'` - ac_var="ac_cv_header_$ac_item" - ;; - file ) - ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'` - ac_var="ac_cv_file_$ac_item" - ;; - func ) ac_var="ac_cv_func_$ac_item" ;; - struct ) ac_var="ac_cv_struct_$ac_item" ;; - define ) ac_var="ac_cv_define_$ac_item" ;; - custom ) ac_var="$ac_item" ;; - esac - eval "ac_val=\$$ac_var" - if test ".$ac_val" != .yes; then - ac_rc=no - break - fi -done -if test ".$ac_rc" = .yes; then - : - $2 -else - : - $3 -fi -]) - - -define(APR_BEGIN_DECISION,[dnl -ac_decision_item='$1' -ac_decision_msg='FAILED' -ac_decision='' -]) - - -AC_DEFUN([APR_DECIDE],[dnl -dnl Define the flag (or not) in apr_private.h via autoheader -AH_TEMPLATE($1, [Define if $2 will be used]) -ac_decision='$1' -ac_decision_msg='$2' -ac_decision_$1=yes -ac_decision_$1_msg='$2' -]) - - -define(APR_DECISION_OVERRIDE,[dnl - ac_decision='' - for ac_item in $1; do - eval "ac_decision_this=\$ac_decision_${ac_item}" - if test ".$ac_decision_this" = .yes; then - ac_decision=$ac_item - eval "ac_decision_msg=\$ac_decision_${ac_item}_msg" - fi - done -]) - - -define(APR_DECISION_FORCE,[dnl -ac_decision="$1" -eval "ac_decision_msg=\"\$ac_decision_${ac_decision}_msg\"" -]) - - -define(APR_END_DECISION,[dnl -if test ".$ac_decision" = .; then - echo "[$]0:Error: decision on $ac_decision_item failed" 1>&2 - exit 1 -else - if test ".$ac_decision_msg" = .; then - ac_decision_msg="$ac_decision" - fi - AC_DEFINE_UNQUOTED(${ac_decision_item}) - AC_MSG_RESULT([decision on $ac_decision_item... $ac_decision_msg]) -fi -]) - - -dnl -dnl APR_CHECK_SIZEOF_EXTENDED(INCLUDES, TYPE [, CROSS_SIZE]) -dnl -dnl A variant of AC_CHECK_SIZEOF which allows the checking of -dnl sizes of non-builtin types -dnl -AC_DEFUN([APR_CHECK_SIZEOF_EXTENDED], -[changequote(<<, >>)dnl -dnl The name to #define. -define(<>, translit(sizeof_$2, [a-z *], [A-Z_P]))dnl -dnl The cache variable name. -define(<>, translit(ac_cv_sizeof_$2, [ *], [_p]))dnl -changequote([, ])dnl -AC_MSG_CHECKING(size of $2) -AC_CACHE_VAL(AC_CV_NAME, -[AC_TRY_RUN([#include -$1 -#ifdef WIN32 -#define binmode "b" -#else -#define binmode -#endif -main() -{ - FILE *f=fopen("conftestval", "w" binmode); - if (!f) exit(1); - fprintf(f, "%d\n", sizeof($2)); - exit(0); -}], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$3],,, -AC_CV_NAME=$3))])dnl -AC_MSG_RESULT($AC_CV_NAME) -AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [The size of ]$2) -undefine([AC_TYPE_NAME])dnl -undefine([AC_CV_NAME])dnl -]) - - -dnl -dnl APR_TRY_COMPILE_NO_WARNING(INCLUDES, FUNCTION-BODY, -dnl [ACTIONS-IF-NO-WARNINGS], [ACTIONS-IF-WARNINGS]) -dnl -dnl Tries a compile test with warnings activated so that the result -dnl is false if the code doesn't compile cleanly. For compilers -dnl where it is not known how to activate a "fail-on-error" mode, -dnl it is undefined which of the sets of actions will be run. -dnl -AC_DEFUN([APR_TRY_COMPILE_NO_WARNING], -[apr_save_CFLAGS=$CFLAGS - CFLAGS="$CFLAGS $CFLAGS_WARN" - if test "$ac_cv_prog_gcc" = "yes"; then - CFLAGS="$CFLAGS -Werror" - fi - AC_COMPILE_IFELSE( - [AC_LANG_SOURCE( - [#include "confdefs.h" - ] - [[$1]] - [int main(int argc, const char *const *argv) {] - [[$2]] - [ return 0; }] - )], - [$3], [$4]) - CFLAGS=$apr_save_CFLAGS -]) - -dnl -dnl APR_CHECK_STRERROR_R_RC -dnl -dnl Decide which style of retcode is used by this system's -dnl strerror_r(). It either returns int (0 for success, -1 -dnl for failure), or it returns a pointer to the error -dnl string. -dnl -dnl -AC_DEFUN([APR_CHECK_STRERROR_R_RC], [ -AC_MSG_CHECKING(for type of return code from strerror_r) -AC_TRY_RUN([ -#include -#include -#include -main() -{ - char buf[1024]; - if (strerror_r(ERANGE, buf, sizeof buf) < 1) { - exit(0); - } - else { - exit(1); - } -}], [ - ac_cv_strerror_r_rc_int=yes ], [ - ac_cv_strerror_r_rc_int=no ], [ - ac_cv_strerror_r_rc_int=no ] ) -if test "x$ac_cv_strerror_r_rc_int" = xyes; then - AC_DEFINE(STRERROR_R_RC_INT, 1, [Define if strerror returns int]) - msg="int" -else - msg="pointer" -fi -AC_MSG_RESULT([$msg]) -] ) - -dnl -dnl APR_CHECK_DIRENT_INODE -dnl -dnl Decide if d_fileno or d_ino are available in the dirent -dnl structure on this platform. Single UNIX Spec says d_ino, -dnl BSD uses d_fileno. Undef to find the real beast. -dnl -AC_DEFUN([APR_CHECK_DIRENT_INODE], [ -AC_CACHE_CHECK([for inode member of struct dirent], apr_cv_dirent_inode, [ -apr_cv_dirent_inode=no -AC_TRY_COMPILE([ -#include -#include -],[ -#ifdef d_ino -#undef d_ino -#endif -struct dirent de; de.d_fileno; -], apr_cv_dirent_inode=d_fileno) -if test "$apr_cv_dirent_inode" = "no"; then -AC_TRY_COMPILE([ -#include -#include -],[ -#ifdef d_fileno -#undef d_fileno -#endif -struct dirent de; de.d_ino; -], apr_cv_dirent_inode=d_ino) -fi -]) -if test "$apr_cv_dirent_inode" != "no"; then - AC_DEFINE_UNQUOTED(DIRENT_INODE, $apr_cv_dirent_inode, - [Define if struct dirent has an inode member]) -fi -]) - -dnl -dnl APR_CHECK_DIRENT_TYPE -dnl -dnl Decide if d_type is available in the dirent structure -dnl on this platform. Not part of the Single UNIX Spec. -dnl Note that this is worthless without DT_xxx macros, so -dnl look for one while we are at it. -dnl -AC_DEFUN([APR_CHECK_DIRENT_TYPE], [ -AC_CACHE_CHECK([for file type member of struct dirent], apr_cv_dirent_type,[ -apr_cv_dirent_type=no -AC_TRY_COMPILE([ -#include -#include -],[ -struct dirent de; de.d_type = DT_REG; -], apr_cv_dirent_type=d_type) -]) -if test "$apr_cv_dirent_type" != "no"; then - AC_DEFINE_UNQUOTED(DIRENT_TYPE, $apr_cv_dirent_type, - [Define if struct dirent has a d_type member]) -fi -]) - -dnl the following is a newline, a space, a tab, and a backslash (the -dnl backslash is used by the shell to skip newlines, but m4 sees it; -dnl treat it like whitespace). -dnl WARNING: don't reindent these lines, or the space/tab will be lost! -define([apr_whitespace],[ - \]) - -dnl -dnl APR_COMMA_ARGS(ARG1 ...) -dnl convert the whitespace-separated arguments into comman-separated -dnl arguments. -dnl -dnl APR_FOREACH(CODE-BLOCK, ARG1, ARG2, ...) -dnl subsitute CODE-BLOCK for each ARG[i]. "eachval" will be set to ARG[i] -dnl within each iteration. -dnl -changequote({,}) -define({APR_COMMA_ARGS},{patsubst([$}{1],[[}apr_whitespace{]+],[,])}) -define({APR_FOREACH}, - {ifelse($}{2,,, - [define([eachval], - $}{2)$}{1[]APR_FOREACH([$}{1], - builtin([shift], - builtin([shift], $}{@)))])}) -changequote([,]) - -dnl APR_FLAG_HEADERS(HEADER-FILE ... [, FLAG-TO-SET ] [, "yes" ]) -dnl we set FLAG-TO-SET to 1 if we find HEADER-FILE, otherwise we set to 0 -dnl if FLAG-TO-SET is null, we automagically determine it's name -dnl by changing all "/" to "_" in the HEADER-FILE and dropping -dnl all "." and "-" chars. If the 3rd parameter is "yes" then instead of -dnl setting to 1 or 0, we set FLAG-TO-SET to yes or no. -dnl -AC_DEFUN([APR_FLAG_HEADERS], [ -AC_CHECK_HEADERS($1) -for aprt_i in $1 -do - ac_safe=`echo "$aprt_i" | sed 'y%./+-%__p_%'` - aprt_2=`echo "$aprt_i" | sed -e 's%/%_%g' -e 's/\.//g' -e 's/-//g'` - if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - eval "ifelse($2,,$aprt_2,$2)=ifelse($3,yes,yes,1)" - else - eval "ifelse($2,,$aprt_2,$2)=ifelse($3,yes,no,0)" - fi -done -]) - -dnl APR_FLAG_FUNCS(FUNC ... [, FLAG-TO-SET] [, "yes" ]) -dnl if FLAG-TO-SET is null, we automagically determine it's name -dnl prepending "have_" to the function name in FUNC, otherwise -dnl we use what's provided as FLAG-TO-SET. If the 3rd parameter -dnl is "yes" then instead of setting to 1 or 0, we set FLAG-TO-SET -dnl to yes or no. -dnl -AC_DEFUN([APR_FLAG_FUNCS], [ -AC_CHECK_FUNCS($1) -for aprt_j in $1 -do - aprt_3="have_$aprt_j" - if eval "test \"`echo '$ac_cv_func_'$aprt_j`\" = yes"; then - eval "ifelse($2,,$aprt_3,$2)=ifelse($3,yes,yes,1)" - else - eval "ifelse($2,,$aprt_3,$2)=ifelse($3,yes,no,0)" - fi -done -]) - -dnl Iteratively interpolate the contents of the second argument -dnl until interpolation offers no new result. Then assign the -dnl final result to $1. -dnl -dnl Example: -dnl -dnl foo=1 -dnl bar='${foo}/2' -dnl baz='${bar}/3' -dnl APR_EXPAND_VAR(fraz, $baz) -dnl $fraz is now "1/2/3" -dnl -AC_DEFUN([APR_EXPAND_VAR], [ -ap_last= -ap_cur="$2" -while test "x${ap_cur}" != "x${ap_last}"; -do - ap_last="${ap_cur}" - ap_cur=`eval "echo ${ap_cur}"` -done -$1="${ap_cur}" -]) - -dnl -dnl Removes the value of $3 from the string in $2, strips of any leading -dnl slashes, and returns the value in $1. -dnl -dnl Example: -dnl orig_path="${prefix}/bar" -dnl APR_PATH_RELATIVE(final_path, $orig_path, $prefix) -dnl $final_path now contains "bar" -AC_DEFUN([APR_PATH_RELATIVE], [ -ap_stripped=`echo $2 | sed -e "s#^$3##"` -# check if the stripping was successful -if test "x$2" != "x${ap_stripped}"; then - # it was, so strip of any leading slashes - $1="`echo ${ap_stripped} | sed -e 's#^/*##'`" -else - # it wasn't so return the original - $1="$2" -fi -]) - -dnl APR_HELP_STRING(LHS, RHS) -dnl Autoconf 2.50 can not handle substr correctly. It does have -dnl AC_HELP_STRING, so let's try to call it if we can. -dnl Note: this define must be on one line so that it can be properly returned -dnl as the help string. When using this macro with a multi-line RHS, ensure -dnl that you surround the macro invocation with []s -AC_DEFUN([APR_HELP_STRING], [ifelse(regexp(AC_ACVERSION, 2\.1), -1, AC_HELP_STRING([$1],[$2]),[ ][$1] substr([ ],len($1))[$2])]) - -dnl -dnl APR_LAYOUT(configlayout, layoutname [, extravars]) -dnl -AC_DEFUN([APR_LAYOUT], [ - if test ! -f $srcdir/config.layout; then - echo "** Error: Layout file $srcdir/config.layout not found" - echo "** Error: Cannot use undefined layout '$LAYOUT'" - exit 1 - fi - # Catch layout names including a slash which will otherwise - # confuse the heck out of the sed script. - case $2 in - */*) - echo "** Error: $2 is not a valid layout name" - exit 1 ;; - esac - pldconf=./config.pld - changequote({,}) - sed -e "1s/[ ]*<[lL]ayout[ ]*$2[ ]*>[ ]*//;1t" \ - -e "1,/[ ]*<[lL]ayout[ ]*$2[ ]*>[ ]*/d" \ - -e '/[ ]*<\/Layout>[ ]*/,$d' \ - -e "s/^[ ]*//g" \ - -e "s/:[ ]*/=\'/g" \ - -e "s/[ ]*$/'/g" \ - $1 > $pldconf - layout_name=$2 - if test ! -s $pldconf; then - echo "** Error: unable to find layout $layout_name" - exit 1 - fi - . $pldconf - rm $pldconf - for var in prefix exec_prefix bindir sbindir libexecdir mandir \ - sysconfdir datadir includedir localstatedir runtimedir \ - logfiledir libdir installbuilddir libsuffix $3; do - eval "val=\"\$$var\"" - case $val in - *+) - val=`echo $val | sed -e 's;\+$;;'` - eval "$var=\"\$val\"" - autosuffix=yes - ;; - *) - autosuffix=no - ;; - esac - val=`echo $val | sed -e 's:\(.\)/*$:\1:'` - val=`echo $val | sed -e 's:[\$]\([a-z_]*\):${\1}:g'` - if test "$autosuffix" = "yes"; then - if echo $val | grep apache >/dev/null; then - addtarget=no - else - addtarget=yes - fi - if test "$addtarget" = "yes"; then - val="$val/apache2" - fi - fi - eval "$var='$val'" - done - changequote([,]) -])dnl - -dnl -dnl APR_ENABLE_LAYOUT(default layout name [, extra vars]) -dnl -AC_DEFUN([APR_ENABLE_LAYOUT], [ -AC_ARG_ENABLE(layout, -[ --enable-layout=LAYOUT],[ - LAYOUT=$enableval -]) - -if test -z "$LAYOUT"; then - LAYOUT="$1" -fi -APR_LAYOUT($srcdir/config.layout, $LAYOUT, $2) - -AC_MSG_CHECKING(for chosen layout) -AC_MSG_RESULT($layout_name) -]) - - -dnl -dnl APR_PARSE_ARGUMENTS -dnl a reimplementation of autoconf's argument parser, -dnl used here to allow us to co-exist layouts and argument based -dnl set ups. -AC_DEFUN([APR_PARSE_ARGUMENTS], [ -ac_prev= -# Retrieve the command-line arguments. The eval is needed because -# the arguments are quoted to preserve accuracy. -eval "set x $ac_configure_args" -shift -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" - ac_prev= - continue - fi - - ac_optarg=`expr "x$ac_option" : 'x[[^=]]*=\(.*\)'` - - case $ac_option in - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir="$ac_optarg" ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir="$ac_optarg" ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix="$ac_optarg" ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir="$ac_optarg" ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir="$ac_optarg" ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir="$ac_optarg" ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir="$ac_optarg" ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir="$ac_optarg" ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir="$ac_optarg" ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix="$ac_optarg" ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir="$ac_optarg" ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir="$ac_optarg" ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir="$ac_optarg" ;; - - esac -done - -# Be sure to have absolute paths. -for ac_var in exec_prefix prefix -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [[\\/$]]* | ?:[[\\/]]* | NONE | '' ) ;; - *) AC_MSG_ERROR([expected an absolute path for --$ac_var: $ac_val]);; - esac -done - -])dnl - -dnl -dnl APR_CHECK_DEPEND -dnl -dnl Determine what program we can use to generate .deps-style dependencies -dnl -AC_DEFUN([APR_CHECK_DEPEND], [ -dnl Try to determine what depend program we can use -dnl All GCC-variants should have -MM. -dnl If not, then we can check on those, too. -if test "$GCC" = "yes"; then - MKDEP='$(CC) -MM' -else - rm -f conftest.c -dnl should be available everywhere! - cat > conftest.c < - int main() { return 0; } -EOF - MKDEP="true" - for i in "$CC -MM" "$CC -M" "$CPP -MM" "$CPP -M" "cpp -M"; do - AC_MSG_CHECKING([if $i can create proper make dependencies]) - if $i conftest.c 2>/dev/null | grep 'conftest.o: conftest.c' >/dev/null; then - MKDEP=$i - AC_MSG_RESULT(yes) - break; - fi - AC_MSG_RESULT(no) - done - rm -f conftest.c -fi - -AC_SUBST(MKDEP) -]) - -dnl -dnl APR_CHECK_TYPES_COMPATIBLE(TYPE-1, TYPE-2, [ACTION-IF-TRUE]) -dnl -dnl Try to determine whether two types are the same. Only works -dnl for gcc and icc. -dnl -AC_DEFUN([APR_CHECK_TYPES_COMPATIBLE], [ -define([apr_cvname], apr_cv_typematch_[]translit([$1], [ ], [_])_[]translit([$2], [ ], [_])) -AC_CACHE_CHECK([whether $1 and $2 are the same], apr_cvname, [ -AC_TRY_COMPILE(AC_INCLUDES_DEFAULT, [ - int foo[0 - !__builtin_types_compatible_p($1, $2)]; -], [apr_cvname=yes -$3], [apr_cvname=no])]) -]) diff --git a/libs/unimrcp/build/acmacros/apu.m4 b/libs/unimrcp/build/acmacros/apu.m4 deleted file mode 100644 index 0399751157..0000000000 --- a/libs/unimrcp/build/acmacros/apu.m4 +++ /dev/null @@ -1,2 +0,0 @@ -dnl The macro UNIMRCP_CHECK_APU() has been merged with the macro UNIMRCP_CHECK_APR(). -dnl This file is no longer used and pending for removal. diff --git a/libs/unimrcp/build/acmacros/ax_compiler_vendor.m4 b/libs/unimrcp/build/acmacros/ax_compiler_vendor.m4 deleted file mode 100644 index 2f8d080249..0000000000 --- a/libs/unimrcp/build/acmacros/ax_compiler_vendor.m4 +++ /dev/null @@ -1,41 +0,0 @@ -dnl Determine the vendor of the C/C++ compiler, e.g., gnu, intel, ibm, sun, -dnl hp, borland, comeau, dec, cray, kai, lcc, metrowerks, sgi, microsoft, -dnl watcom, etc. The vendor is returned in the cache variable -dnl $ax_cv_c_compiler_vendor for C and $ax_cv_cxx_compiler_vendor for C++. - -AC_DEFUN([AX_COMPILER_VENDOR], -[AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor, - [dnl note: don't check for gcc first since some other compilers define __GNUC__ - vendors="intel: __ICC,__ECC,__INTEL_COMPILER - ibm: __xlc__,__xlC__,__IBMC__,__IBMCPP__ - pathscale: __PATHCC__,__PATHSCALE__ - clang: __clang__ - gnu: __GNUC__ - sun: __SUNPRO_C,__SUNPRO_CC - hp: __HP_cc,__HP_aCC - dec: __DECC,__DECCXX,__DECC_VER,__DECCXX_VER - borland: __BORLANDC__,__TURBOC__ - comeau: __COMO__ - cray: _CRAYC - kai: __KCC - lcc: __LCC__ - sgi: __sgi,sgi - microsoft: _MSC_VER - metrowerks: __MWERKS__ - watcom: __WATCOMC__ - portland: __PGI - unknown: UNKNOWN" - for ventest in $vendors; do - case $ventest in - *:) vendor=$ventest; continue ;; - *) vencpp="defined("`echo $ventest | sed 's/,/) || defined(/g'`")" ;; - esac - AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[ - #if !($vencpp) - thisisanerror; - #endif - ])], [break]) - done - ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=`echo $vendor | cut -d: -f1` - ]) -]) diff --git a/libs/unimrcp/build/acmacros/find_apr.m4 b/libs/unimrcp/build/acmacros/find_apr.m4 deleted file mode 100644 index 048cb7bfc8..0000000000 --- a/libs/unimrcp/build/acmacros/find_apr.m4 +++ /dev/null @@ -1,167 +0,0 @@ -dnl -------------------------------------------------------- -*- autoconf -*- -dnl Licensed to the Apache Software Foundation (ASF) under one or more -dnl contributor license agreements. See the NOTICE file distributed with -dnl this work for additional information regarding copyright ownership. -dnl The ASF licenses this file to You under the Apache License, Version 2.0 -dnl (the "License"); you may not use this file except in compliance with -dnl the License. You may obtain a copy of the License at -dnl -dnl http://www.apache.org/licenses/LICENSE-2.0 -dnl -dnl Unless required by applicable law or agreed to in writing, software -dnl distributed under the License is distributed on an "AS IS" BASIS, -dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -dnl See the License for the specific language governing permissions and -dnl limitations under the License. - -dnl -dnl find_apr.m4 : locate the APR include files and libraries -dnl -dnl This macro file can be used by applications to find and use the APR -dnl library. It provides a standardized mechanism for using APR. It supports -dnl embedding APR into the application source, or locating an installed -dnl copy of APR. -dnl -dnl APR_FIND_APR(srcdir, builddir, implicit-install-check, acceptable-majors) -dnl -dnl where srcdir is the location of the bundled APR source directory, or -dnl empty if source is not bundled. -dnl -dnl where builddir is the location where the bundled APR will will be built, -dnl or empty if the build will occur in the srcdir. -dnl -dnl where implicit-install-check set to 1 indicates if there is no -dnl --with-apr option specified, we will look for installed copies. -dnl -dnl where acceptable-majors is a space separated list of acceptable major -dnl version numbers. Often only a single major version will be acceptable. -dnl If multiple versions are specified, and --with-apr=PREFIX or the -dnl implicit installed search are used, then the first (leftmost) version -dnl in the list that is found will be used. Currently defaults to [0 1]. -dnl -dnl Sets the following variables on exit: -dnl -dnl apr_found : "yes", "no", "reconfig" -dnl -dnl apr_config : If the apr-config tool exists, this refers to it. If -dnl apr_found is "reconfig", then the bundled directory -dnl should be reconfigured *before* using apr_config. -dnl -dnl Note: this macro file assumes that apr-config has been installed; it -dnl is normally considered a required part of an APR installation. -dnl -dnl If a bundled source directory is available and needs to be (re)configured, -dnl then apr_found is set to "reconfig". The caller should reconfigure the -dnl (passed-in) source directory, placing the result in the build directory, -dnl as appropriate. -dnl -dnl If apr_found is "yes" or "reconfig", then the caller should use the -dnl value of apr_config to fetch any necessary build/link information. -dnl - -AC_DEFUN([APR_FIND_APR], [ - apr_found="no" - - if test "$target_os" = "os2-emx"; then - # Scripts don't pass test -x on OS/2 - TEST_X="test -f" - else - TEST_X="test -x" - fi - - ifelse([$4], [], [ - ifdef(AC_WARNING,AC_WARNING([$0: missing argument 4 (acceptable-majors): Defaulting to APR 0.x then APR 1.x])) - acceptable_majors="0 1"], - [acceptable_majors="$4"]) - - apr_temp_acceptable_apr_config="" - for apr_temp_major in $acceptable_majors - do - case $apr_temp_major in - 0) - apr_temp_acceptable_apr_config="$apr_temp_acceptable_apr_config apr-config" - ;; - *) - apr_temp_acceptable_apr_config="$apr_temp_acceptable_apr_config apr-$apr_temp_major-config" - ;; - esac - done - - AC_MSG_CHECKING(for APR) - AC_ARG_WITH(apr, - [ --with-apr=PATH prefix for installed APR, path to APR build tree, - or the full path to apr-config], - [ - if test "$withval" = "no" || test "$withval" = "yes"; then - AC_MSG_ERROR([--with-apr requires a directory or file to be provided]) - fi - - for apr_temp_apr_config_file in $apr_temp_acceptable_apr_config - do - for lookdir in "$withval/bin" "$withval" - do - if $TEST_X "$lookdir/$apr_temp_apr_config_file"; then - apr_found="yes" - apr_config="$lookdir/$apr_temp_apr_config_file" - break 2 - fi - done - done - - if test "$apr_found" != "yes" && $TEST_X "$withval" && $withval --help > /dev/null 2>&1 ; then - apr_found="yes" - apr_config="$withval" - fi - - dnl if --with-apr is used, it is a fatal error for its argument - dnl to be invalid - if test "$apr_found" != "yes"; then - AC_MSG_ERROR([the --with-apr parameter is incorrect. It must specify an install prefix, a build directory, or an apr-config file.]) - fi - ],[ - dnl If we allow installed copies, check those before using bundled copy. - if test -n "$3" && test "$3" = "1"; then - for apr_temp_apr_config_file in $apr_temp_acceptable_apr_config - do - if $apr_temp_apr_config_file --help > /dev/null 2>&1 ; then - apr_found="yes" - apr_config="$apr_temp_apr_config_file" - break - else - dnl look in some standard places - for lookdir in /usr /usr/local /usr/local/apr /opt/apr; do - if $TEST_X "$lookdir/bin/$apr_temp_apr_config_file"; then - apr_found="yes" - apr_config="$lookdir/bin/$apr_temp_apr_config_file" - break 2 - fi - done - fi - done - fi - dnl if we have not found anything yet and have bundled source, use that - if test "$apr_found" = "no" && test -d "$1"; then - apr_temp_abs_srcdir="`cd $1 && pwd`" - apr_found="reconfig" - apr_bundled_major="`sed -n '/#define.*APR_MAJOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p' \"$1/include/apr_version.h\"`" - case $apr_bundled_major in - "") - AC_MSG_ERROR([failed to find major version of bundled APR]) - ;; - 0) - apr_temp_apr_config_file="apr-config" - ;; - *) - apr_temp_apr_config_file="apr-$apr_bundled_major-config" - ;; - esac - if test -n "$2"; then - apr_config="$2/$apr_temp_apr_config_file" - else - apr_config="$1/$apr_temp_apr_config_file" - fi - fi - ]) - - AC_MSG_RESULT($apr_found) -]) diff --git a/libs/unimrcp/build/acmacros/find_apu.m4 b/libs/unimrcp/build/acmacros/find_apu.m4 deleted file mode 100644 index e29bc60923..0000000000 --- a/libs/unimrcp/build/acmacros/find_apu.m4 +++ /dev/null @@ -1,176 +0,0 @@ -dnl -------------------------------------------------------- -*- autoconf -*- -dnl Copyright 2002-2005 The Apache Software Foundation or its licensors, as -dnl applicable. -dnl -dnl Licensed under the Apache License, Version 2.0 (the "License"); -dnl you may not use this file except in compliance with the License. -dnl You may obtain a copy of the License at -dnl -dnl http://www.apache.org/licenses/LICENSE-2.0 -dnl -dnl Unless required by applicable law or agreed to in writing, software -dnl distributed under the License is distributed on an "AS IS" BASIS, -dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -dnl See the License for the specific language governing permissions and -dnl limitations under the License. - -dnl -dnl find_apu.m4 : locate the APR-util (APU) include files and libraries -dnl -dnl This macro file can be used by applications to find and use the APU -dnl library. It provides a standardized mechanism for using APU. It supports -dnl embedding APU into the application source, or locating an installed -dnl copy of APU. -dnl -dnl APR_FIND_APU(srcdir, builddir, implicit-install-check, acceptable-majors) -dnl -dnl where srcdir is the location of the bundled APU source directory, or -dnl empty if source is not bundled. -dnl -dnl where builddir is the location where the bundled APU will be built, -dnl or empty if the build will occur in the srcdir. -dnl -dnl where implicit-install-check set to 1 indicates if there is no -dnl --with-apr-util option specified, we will look for installed copies. -dnl -dnl where acceptable-majors is a space separated list of acceptable major -dnl version numbers. Often only a single major version will be acceptable. -dnl If multiple versions are specified, and --with-apr-util=PREFIX or the -dnl implicit installed search are used, then the first (leftmost) version -dnl in the list that is found will be used. Currently defaults to [0 1]. -dnl -dnl Sets the following variables on exit: -dnl -dnl apu_found : "yes", "no", "reconfig" -dnl -dnl apu_config : If the apu-config tool exists, this refers to it. If -dnl apu_found is "reconfig", then the bundled directory -dnl should be reconfigured *before* using apu_config. -dnl -dnl Note: this macro file assumes that apr-config has been installed; it -dnl is normally considered a required part of an APR installation. -dnl -dnl Note: At this time, we cannot find *both* a source dir and a build dir. -dnl If both are available, the build directory should be passed to -dnl the --with-apr-util switch. -dnl -dnl Note: the installation layout is presumed to follow the standard -dnl PREFIX/lib and PREFIX/include pattern. If the APU config file -dnl is available (and can be found), then non-standard layouts are -dnl possible, since it will be described in the config file. -dnl -dnl If a bundled source directory is available and needs to be (re)configured, -dnl then apu_found is set to "reconfig". The caller should reconfigure the -dnl (passed-in) source directory, placing the result in the build directory, -dnl as appropriate. -dnl -dnl If apu_found is "yes" or "reconfig", then the caller should use the -dnl value of apu_config to fetch any necessary build/link information. -dnl - -AC_DEFUN([APR_FIND_APU], [ - apu_found="no" - - if test "$target_os" = "os2-emx"; then - # Scripts don't pass test -x on OS/2 - TEST_X="test -f" - else - TEST_X="test -x" - fi - - ifelse([$4], [], - [ - ifdef(AC_WARNING,([$0: missing argument 4 (acceptable-majors): Defaulting to APU 0.x then APU 1.x])) - acceptable_majors="0 1" - ], [acceptable_majors="$4"]) - - apu_temp_acceptable_apu_config="" - for apu_temp_major in $acceptable_majors - do - case $apu_temp_major in - 0) - apu_temp_acceptable_apu_config="$apu_temp_acceptable_apu_config apu-config" - ;; - *) - apu_temp_acceptable_apu_config="$apu_temp_acceptable_apu_config apu-$apu_temp_major-config" - ;; - esac - done - - AC_MSG_CHECKING(for APR-util) - AC_ARG_WITH(apr-util, - [ --with-apr-util=PATH prefix for installed APU, path to APU build tree, - or the full path to apu-config], - [ - if test "$withval" = "no" || test "$withval" = "yes"; then - AC_MSG_ERROR([--with-apr-util requires a directory or file to be provided]) - fi - - for apu_temp_apu_config_file in $apu_temp_acceptable_apu_config - do - for lookdir in "$withval/bin" "$withval" - do - if $TEST_X "$lookdir/$apu_temp_apu_config_file"; then - apu_found="yes" - apu_config="$lookdir/$apu_temp_apu_config_file" - break 2 - fi - done - done - - if test "$apu_found" != "yes" && $TEST_X "$withval" && $withval --help > /dev/null 2>&1 ; then - apu_found="yes" - apu_config="$withval" - fi - - dnl if --with-apr-util is used, it is a fatal error for its argument - dnl to be invalid - if test "$apu_found" != "yes"; then - AC_MSG_ERROR([the --with-apr-util parameter is incorrect. It must specify an install prefix, a build directory, or an apu-config file.]) - fi - ],[ - if test -n "$3" && test "$3" = "1"; then - for apu_temp_apu_config_file in $apu_temp_acceptable_apu_config - do - if $apu_temp_apu_config_file --help > /dev/null 2>&1 ; then - apu_found="yes" - apu_config="$apu_temp_apu_config_file" - break - else - dnl look in some standard places (apparently not in builtin/default) - for lookdir in /usr /usr/local /usr/local/apr /opt/apr /usr/local/apache2 ; do - if $TEST_X "$lookdir/bin/$apu_temp_apu_config_file"; then - apu_found="yes" - apu_config="$lookdir/bin/$apu_temp_apu_config_file" - break 2 - fi - done - fi - done - fi - dnl if we have not found anything yet and have bundled source, use that - if test "$apu_found" = "no" && test -d "$1"; then - apu_temp_abs_srcdir="`cd $1 && pwd`" - apu_found="reconfig" - apu_bundled_major="`sed -n '/#define.*APU_MAJOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p' \"$1/include/apu_version.h\"`" - case $apu_bundled_major in - "") - AC_MSG_ERROR([failed to find major version of bundled APU]) - ;; - 0) - apu_temp_apu_config_file="apu-config" - ;; - *) - apu_temp_apu_config_file="apu-$apu_bundled_major-config" - ;; - esac - if test -n "$2"; then - apu_config="$2/$apu_temp_apu_config_file" - else - apu_config="$1/$apu_temp_apu_config_file" - fi - fi - ]) - - AC_MSG_RESULT($apu_found) -]) diff --git a/libs/unimrcp/build/acmacros/sofia-sip.m4 b/libs/unimrcp/build/acmacros/sofia-sip.m4 deleted file mode 100644 index ef1dfcb8d9..0000000000 --- a/libs/unimrcp/build/acmacros/sofia-sip.m4 +++ /dev/null @@ -1,85 +0,0 @@ -dnl -dnl UNIMRCP_CHECK_SOFIA -dnl -dnl This macro attempts to find the Sofia-SIP library and -dnl set corresponding variables on exit. -dnl -AC_DEFUN([UNIMRCP_CHECK_SOFIA], -[ - AC_MSG_NOTICE([Sofia SIP library configuration]) - - AC_MSG_CHECKING([for Sofia-SIP]) - AC_ARG_WITH(sofia-sip, - [ --with-sofia-sip=PATH prefix for installed Sofia-SIP, - path to Sofia-SIP source/build tree, - or the full path to Sofia-SIP pkg-config], - [sofia_path=$withval], - [sofia_path="/usr/local"] - ) - - found_sofia="no" - - if test -n "$PKG_CONFIG"; then - dnl Check for installed Sofia-SIP - for dir in $sofia_path ; do - sofia_config_path=$dir/lib/pkgconfig/sofia-sip-ua.pc - if test -f "$sofia_config_path" && $PKG_CONFIG $sofia_config_path > /dev/null 2>&1; then - found_sofia="yes" - break - fi - done - - dnl Check for installed Sofia-SIP in PKG_CONFIG_PATH - if test "$found_sofia" != "yes" && $PKG_CONFIG sofia-sip-ua > /dev/null 2>&1 ; then - found_sofia="yes" - sofia_config_path="sofia-sip-ua" - fi - - dnl Check for full path to Sofia-SIP pkg-config file - if test "$found_sofia" != "yes" && test -f "$sofia_path" && $PKG_CONFIG $sofia_path > /dev/null 2>&1 ; then - found_sofia="yes" - sofia_config_path=$sofia_path - fi - - if test "$found_sofia" = "yes" ; then - UNIMRCP_SOFIA_INCLUDES="`$PKG_CONFIG --cflags $sofia_config_path`" - UNIMRCP_SOFIA_LIBS="`$PKG_CONFIG --libs $sofia_config_path`" - sofia_version="`$PKG_CONFIG --modversion $sofia_config_path`" - fi - fi - - if test "$found_sofia" != "yes" ; then - dnl Check for path to Sofia-SIP source/build tree - for dir in $sofia_path ; do - sofia_uadir="$dir/libsofia-sip-ua" - if test -d "$sofia_uadir"; then - found_sofia="yes" - sofia_abs_uadir="`cd $sofia_uadir && pwd`" - UNIMRCP_SOFIA_INCLUDES="-I$sofia_abs_uadir -I$sofia_abs_uadir/bnf -I$sofia_abs_uadir/features -I$sofia_abs_uadir/http -I$sofia_abs_uadir/ipt -I$sofia_abs_uadir/iptsec -I$sofia_abs_uadir/msg -I$sofia_abs_uadir/nea -I$sofia_abs_uadir/nta -I$sofia_abs_uadir/nth -I$sofia_abs_uadir/nua -I$sofia_abs_uadir/sdp -I$sofia_abs_uadir/sip -I$sofia_abs_uadir/soa -I$sofia_abs_uadir/sresolv -I$sofia_abs_uadir/stun -I$sofia_abs_uadir/su -I$sofia_abs_uadir/tport -I$sofia_abs_uadir/url" - UNIMRCP_SOFIA_LIBS="$sofia_abs_uadir/libsofia-sip-ua.la" - sofia_version="`sed -n 's/#define SOFIA_SIP_VERSION.* "\(.*\)"/\1/p' $sofia_uadir/features/sofia-sip/sofia_features.h`" - break - fi - done - fi - - if test $found_sofia != "yes" ; then - if test -n "$PKG_CONFIG"; then - AC_MSG_ERROR(Cannot find Sofia-SIP - looked for sofia-config and libsofia-sip-ua in $sofia_path) - else - AC_MSG_ERROR(Cannot find Sofia-SIP - pkg-config not available, looked for libsofia-sip-ua in $sofia_path) - fi - else - AC_MSG_RESULT([$found_sofia]) - AC_MSG_RESULT([$sofia_version]) - -case "$host" in - *darwin*) - UNIMRCP_SOFIA_LIBS="$UNIMRCP_SOFIA_LIBS -framework CoreFoundation -framework SystemConfiguration" - ;; -esac - - AC_SUBST(UNIMRCP_SOFIA_INCLUDES) - AC_SUBST(UNIMRCP_SOFIA_LIBS) - fi -]) diff --git a/libs/unimrcp/build/acmacros/uni_plugin.m4 b/libs/unimrcp/build/acmacros/uni_plugin.m4 deleted file mode 100644 index 6a33b1b638..0000000000 --- a/libs/unimrcp/build/acmacros/uni_plugin.m4 +++ /dev/null @@ -1,45 +0,0 @@ -dnl -dnl UNI_PLUGIN_ENABLED(name) -dnl -dnl where name is the name of the plugin. -dnl -dnl This macro can be used for a plugin which must be enabled by default. -dnl -dnl Adds the following argument to the configure script: -dnl -dnl --disable-$1-plugin -dnl -dnl Sets the following variable on exit: -dnl -dnl enable_$1_plugin : "yes" or "no" -dnl -AC_DEFUN([UNI_PLUGIN_ENABLED],[ - AC_ARG_ENABLE( - [$1-plugin], - [AC_HELP_STRING([--disable-$1-plugin],[exclude $1 plugin from build])], - [enable_$1_plugin="$enableval"], - [enable_$1_plugin="yes"]) -]) - -dnl -dnl UNI_PLUGIN_DISABLED(name) -dnl -dnl where name is the name of the plugin. -dnl -dnl This macro can be used for a plugin which must be disabled by default. -dnl -dnl Adds the following argument to the configure script: -dnl -dnl --enable-$1-plugin -dnl -dnl Sets the following variable on exit: -dnl -dnl enable_$1_plugin : "yes" or "no" -dnl -AC_DEFUN([UNI_PLUGIN_DISABLED],[ - AC_ARG_ENABLE( - [$1-plugin], - [AC_HELP_STRING([--enable-$1-plugin],[include $1 plugin in build])], - [enable_$1_plugin="$enableval"], - [enable_$1_plugin="no"]) -]) diff --git a/libs/unimrcp/build/get-version.sh b/libs/unimrcp/build/get-version.sh deleted file mode 100755 index fd685b22a8..0000000000 --- a/libs/unimrcp/build/get-version.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh -# -# extract version numbers from a header file -# -# USAGE: get-version.sh CMD VERSION_HEADER PREFIX -# where CMD is one of: all, major, libtool -# where PREFIX is the prefix to {MAJOR|MINOR|PATCH}_VERSION defines -# -# get-version.sh all returns a dotted version number -# get-version.sh major returns just the major version number -# get-version.sh libtool returns a version "libtool -version-info" format -# - -if test $# != 3; then - echo "USAGE: $0 CMD VERSION_HEADER PREFIX" - echo " where CMD is one of: all, major, libtool" - exit 1 -fi - -major_sed="/#define.*$3_MAJOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p" -minor_sed="/#define.*$3_MINOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p" -patch_sed="/#define.*$3_PATCH_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p" -major="`sed -n $major_sed $2`" -minor="`sed -n $minor_sed $2`" -patch="`sed -n $patch_sed $2`" - -if test "$1" = "all"; then - echo ${major}.${minor}.${patch} -elif test "$1" = "major"; then - echo ${major} -elif test "$1" = "libtool"; then - # Yes, ${minor}:${patch}:${minor} is correct due to libtool idiocy. - echo ${minor}:${patch}:${minor} -else - echo "ERROR: unknown version CMD ($1)" - exit 1 -fi diff --git a/libs/unimrcp/build/init.d/unimrcp-server b/libs/unimrcp/build/init.d/unimrcp-server deleted file mode 100755 index 3518e23fa1..0000000000 --- a/libs/unimrcp/build/init.d/unimrcp-server +++ /dev/null @@ -1,270 +0,0 @@ -#!/bin/sh -# -# unimrcp-server This shell script takes care of starting and stopping the UniMRCP server. -# -# chkconfig: 2345 65 35 -# description: UniMRCP is an open source MRCP v1 & v2 server. - -# Some global variables - -# Application -APP_NAME="unimrcpserver" -APP_LONG_NAME="UniMRCP Server" -UNIMRCP_DIR="/usr/local/unimrcp/" -DAEMON_ARGS="-d -r ${UNIMRCP_DIR}" -APP_ARGS="-o 2" - -EXEC="${UNIMRCP_DIR}bin/${APP_NAME}" - -# sudo user -USERNAME=root - -# Priority at which to run the server. See "man nice" for valid priorities. -# nice is only used if a priority is specified. -PRIORITY= - -# Location of the pid file. -PIDDIR="/var/run/" -pid= - -if [ -e $PIDDIR ]; then - echo -else - mkdir $PIDDIR -fi - -# Allow configuration overrides in /etc/sysconfig/$APP_NAME -CONFIGFILE=/etc/sysconfig/$APP_NAME - -[ -x $CONFIGFILE ] && . $CONFIGFILE - -# Do not modify anything beyond this point -#----------------------------------------------------------------------------- - -# Get the fully qualified path to the script -case $0 in - /*) - SCRIPT="$0" - ;; - *) - PWD=`pwd` - SCRIPT="$PWD/$0" - ;; -esac - -# Change spaces to ":" so the tokens can be parsed. -SCRIPT=`echo $SCRIPT | sed -e 's; ;:;g'` -# Get the real path to this script, resolving any symbolic links -TOKENS=`echo $SCRIPT | sed -e 's;/; ;g'` -REALPATH= -for C in $TOKENS; do - REALPATH="$REALPATH/$C" - while [ -h "$REALPATH" ] ; do - LS="`ls -ld "$REALPATH"`" - LINK="`expr "$LS" : '.*-> \(.*\)$'`" - if expr "$LINK" : '/.*' > /dev/null; then - REALPATH="$LINK" - else - REALPATH="`dirname "$REALPATH"`""/$LINK" - fi - done -done -# Change ":" chars back to spaces. -REALPATH=`echo $REALPATH | sed -e 's;:; ;g'` - -# Change the current directory to the location of the script -cd "`dirname "$REALPATH"`" - -chown $USERNAME $PIDDIR - -# Process ID -PIDFILE="$PIDDIR/$APP_NAME.pid" - -# Resolve the location of the 'ps' command -PSEXE="/usr/bin/ps" -if [ ! -x $PSEXE ] -then - PSEXE="/bin/ps" - if [ ! -x $PSEXE ] - then - echo "Unable to locate 'ps'." - echo "Please report this with the location on your system." - exit 1 - fi -fi - -# Build the nice clause -if [ "X$PRIORITY" = "X" ] -then - CMDNICE="" -else - CMDNICE="nice -$PRIORITY" -fi - -getpid() { - if [ -f $PIDFILE ] - then - if [ -r $PIDFILE ] - then - pid=`cat $PIDFILE` - if [ "X$pid" != "X" ] - then - # Verify that a process with this pid is still running. - pid=`$PSEXE -p $pid | grep $pid | grep -v grep | awk '{print $1}' | tail -1` - if [ "X$pid" = "X" ] - then - # This is a stale pid file. - rm -f $PIDFILE - echo "Removed stale pid file: $PIDFILE" - fi - fi - else - echo "Cannot read $PIDFILE." - exit 1 - fi - fi -} - -testpid() { - pid=`$PSEXE -p $pid | grep $pid | grep -v grep | awk '{print $1}' | tail -1` - if [ "X$pid" = "X" ] - then - # Process is gone so remove the pid file. - rm -f $PIDFILE - fi -} - -console() { - echo "Running $APP_LONG_NAME..." - getpid - if [ "X$pid" = "X" ] - then - exec sudo -u $USERNAME $CMDNICE $EXEC $APP_ARGS - echo $pid > $PIDFILE - else - echo "$APP_LONG_NAME is already running." - exit 1 - fi -} - -start() { - echo "Starting $APP_LONG_NAME..." - getpid - if [ "X$pid" = "X" ] - then - sudo -u $USERNAME $CMDNICE $EXEC $DAEMON_ARGS $APP_ARGS - pid=`$PSEXE -C $APP_NAME -o pid=` - echo $pid > $PIDFILE - else - echo "$APP_LONG_NAME is already running." - exit 1 - fi -} - -stopit() { - echo "Stopping $APP_LONG_NAME..." - getpid - if [ "X$pid" = "X" ] - then - echo "$APP_LONG_NAME was not running." - else - # Running so try to stop it. - sudo -u $USERNAME kill $pid - if [ $? -ne 0 ] - then - # An explanation for the failure should have been given - echo "Unable to stop $APP_LONG_NAME." - exit 1 - fi - - # We can not predict how long it will take for the wrapper to - # actually stop as it depends on settings in wrapper.conf. - # Loop until it does. - savepid=$pid - CNT=0 - TOTCNT=0 - while [ "X$pid" != "X" ] - do - # Loop for up to 5 minutes - if [ "$TOTCNT" -lt "300" ] - then - if [ "$CNT" -lt "5" ] - then - CNT=`expr $CNT + 1` - else - echo "Waiting for $APP_LONG_NAME to exit..." - CNT=0 - fi - TOTCNT=`expr $TOTCNT + 1` - - sleep 1 - - testpid - else - pid= - fi - done - - pid=$savepid - testpid - if [ "X$pid" != "X" ] - then - echo "Timed out waiting for $APP_LONG_NAME to exit." - echo " Attempting a forced exit..." - kill -9 $pid - fi - - pid=$savepid - testpid - if [ "X$pid" != "X" ] - then - echo "Failed to stop $APP_LONG_NAME." - exit 1 - else - echo "Stopped $APP_LONG_NAME." - fi - fi -} - -status() { - getpid - if [ "X$pid" = "X" ] - then - echo "$APP_LONG_NAME is not running." - exit 1 - else - echo "$APP_LONG_NAME is running ($pid)." - exit 0 - fi -} - -case "$1" in - - 'console') - console - ;; - - 'start') - start - ;; - - 'stop') - stopit - ;; - - 'restart') - stopit - start - ;; - - 'status') - status - ;; - - *) - echo "Usage: $0 { console | start | stop | restart | status }" - exit 1 - ;; -esac - -exit 0 diff --git a/libs/unimrcp/build/pkgconfig/Makefile.am b/libs/unimrcp/build/pkgconfig/Makefile.am deleted file mode 100644 index ce3a063c05..0000000000 --- a/libs/unimrcp/build/pkgconfig/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = unimrcpclient.pc unimrcpserver.pc unimrcpplugin.pc diff --git a/libs/unimrcp/build/pkgconfig/unimrcpclient.pc.in b/libs/unimrcp/build/pkgconfig/unimrcpclient.pc.in deleted file mode 100644 index 7fe3f1c130..0000000000 --- a/libs/unimrcp/build/pkgconfig/unimrcpclient.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ @UNIMRCP_APR_INCLUDES@ - -Name: unimrcpclient -Description: UniMRCP Client Stack -Requires: -Version: @UNI_DOTTED_VERSION@ -Libs: -L${libdir} -lunimrcpclient -Cflags: @CPPFLAGS@ @CFLAGS@ -I${includedir} diff --git a/libs/unimrcp/build/pkgconfig/unimrcpplugin.pc.in b/libs/unimrcp/build/pkgconfig/unimrcpplugin.pc.in deleted file mode 100644 index df78b8ea7f..0000000000 --- a/libs/unimrcp/build/pkgconfig/unimrcpplugin.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ @UNIMRCP_APR_INCLUDES@ - -Name: unimrcpplugin -Description: UniMRCP Server Plugin -Requires: -Version: @UNI_DOTTED_VERSION@ -Libs: -L${libdir} -lunimrcpserver -Cflags: @CPPFLAGS@ @CFLAGS@ -I${includedir} diff --git a/libs/unimrcp/build/pkgconfig/unimrcpserver.pc.in b/libs/unimrcp/build/pkgconfig/unimrcpserver.pc.in deleted file mode 100644 index 3ed91ecd02..0000000000 --- a/libs/unimrcp/build/pkgconfig/unimrcpserver.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ @UNIMRCP_APR_INCLUDES@ - -Name: unimrcpserver -Description: UniMRCP Server Stack -Requires: -Version: @UNI_DOTTED_VERSION@ -Libs: -L${libdir} -lunimrcpserver -Cflags: @CPPFLAGS@ @CFLAGS@ -I${includedir} diff --git a/libs/unimrcp/build/props/apr.props b/libs/unimrcp/build/props/apr.props deleted file mode 100644 index 8e3f475bb3..0000000000 --- a/libs/unimrcp/build/props/apr.props +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - $(LibRootDir)libs\apr - $(LibRootDir)libs\apr-util - $(LibRootDir)libs\apr-iconv - - - <_ProjectFileVersion>10.0.30319.1 - - - true - - - - $(AprDir)\include;$(AprUtilDir)\include;%(AdditionalIncludeDirectories) - - - - - $(AprDir) - - - $(AprUtilDir) - - - $(AprIconvDir) - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/apt.props b/libs/unimrcp/build/props/apt.props deleted file mode 100644 index 89c5547c33..0000000000 --- a/libs/unimrcp/build/props/apt.props +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - true - - - - $(ProjectRootDir)libs\apr-toolkit\include;%(AdditionalIncludeDirectories) - APT_STATIC_LIB;%(PreprocessorDefinitions) - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/mpf.props b/libs/unimrcp/build/props/mpf.props deleted file mode 100644 index 8e46c5dd2a..0000000000 --- a/libs/unimrcp/build/props/mpf.props +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - true - - - - $(ProjectRootDir)libs\mpf\include;%(AdditionalIncludeDirectories) - MPF_STATIC_LIB;%(PreprocessorDefinitions) - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/mrcp.props b/libs/unimrcp/build/props/mrcp.props deleted file mode 100644 index 14f8a4683d..0000000000 --- a/libs/unimrcp/build/props/mrcp.props +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - true - - - - $(ProjectRootDir)libs\mrcp\include;$(ProjectRootDir)libs\mrcp\message\include;$(ProjectRootDir)libs\mrcp\control\include;$(ProjectRootDir)libs\mrcp\resources\include;%(AdditionalIncludeDirectories) - MRCP_STATIC_LIB;%(PreprocessorDefinitions) - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/mrcpclient.props b/libs/unimrcp/build/props/mrcpclient.props deleted file mode 100644 index 4e552bd3fd..0000000000 --- a/libs/unimrcp/build/props/mrcpclient.props +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - $(ProjectRootDir)libs\mrcp-client\include;%(AdditionalIncludeDirectories) - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/mrcpengine.props b/libs/unimrcp/build/props/mrcpengine.props deleted file mode 100644 index 5b1ee1b5ca..0000000000 --- a/libs/unimrcp/build/props/mrcpengine.props +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - $(ProjectRootDir)libs\mrcp-engine\include;%(AdditionalIncludeDirectories) - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/mrcpserver.props b/libs/unimrcp/build/props/mrcpserver.props deleted file mode 100644 index 94e5e8aef2..0000000000 --- a/libs/unimrcp/build/props/mrcpserver.props +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - $(ProjectRootDir)libs\mrcp-server\include;%(AdditionalIncludeDirectories) - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/mrcpsignaling.props b/libs/unimrcp/build/props/mrcpsignaling.props deleted file mode 100644 index dbe9aa32cf..0000000000 --- a/libs/unimrcp/build/props/mrcpsignaling.props +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - $(ProjectRootDir)libs\mrcp-signaling\include;%(AdditionalIncludeDirectories) - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/mrcpv2transport.props b/libs/unimrcp/build/props/mrcpv2transport.props deleted file mode 100644 index 8b65c83982..0000000000 --- a/libs/unimrcp/build/props/mrcpv2transport.props +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - $(ProjectRootDir)libs\mrcpv2-transport\include;%(AdditionalIncludeDirectories) - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/sdk/unimrcpclient.props b/libs/unimrcp/build/props/sdk/unimrcpclient.props deleted file mode 100644 index b9e764ee52..0000000000 --- a/libs/unimrcp/build/props/sdk/unimrcpclient.props +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - libunimrcpclient.lib mrcpsofiasip.lib mrcpunirtsp.lib unirtsp.lib mrcpclient.lib mrcpv2transport.lib mrcpsignaling.lib libsofia_sip_ua.lib ws2_32.lib winmm.lib;%(AdditionalDependencies) - - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/sdk/unimrcpplugin.props b/libs/unimrcp/build/props/sdk/unimrcpplugin.props deleted file mode 100644 index 6d69aea52b..0000000000 --- a/libs/unimrcp/build/props/sdk/unimrcpplugin.props +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - mrcpengine.lib;%(AdditionalDependencies) - - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/sdk/unimrcpsdk.props b/libs/unimrcp/build/props/sdk/unimrcpsdk.props deleted file mode 100644 index 0334d6a0fe..0000000000 --- a/libs/unimrcp/build/props/sdk/unimrcpsdk.props +++ /dev/null @@ -1,23 +0,0 @@ - - - - - C:\Program Files\UniMRCP - - - - - $(ProjectRootDir)\include;%(AdditionalIncludeDirectories) - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) - - - $(ProjectRootDir)\lib;%(AdditionalLibraryDirectories) - mrcp.lib;mpf.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - - - - - $(ProjectRootDir) - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/sdk/unimrcpserver.props b/libs/unimrcp/build/props/sdk/unimrcpserver.props deleted file mode 100644 index 979a32781e..0000000000 --- a/libs/unimrcp/build/props/sdk/unimrcpserver.props +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - libunimrcpserver.lib mrcpsofiasip.lib mrcpunirtsp.lib unirtsp.lib mrcpserver.lib mrcpv2transport.lib mrcpsignaling.lib mrcpengine.lib libsofia_sip_ua.lib ws2_32.lib winmm.lib;%(AdditionalDependencies) - - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/sofiasip.props b/libs/unimrcp/build/props/sofiasip.props deleted file mode 100644 index 0620099b0c..0000000000 --- a/libs/unimrcp/build/props/sofiasip.props +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - $(LibRootDir)libs\sofia-sip - - - <_ProjectFileVersion>10.0.30319.1 - - - true - - - - $(SofiaDir)\win32;$(SofiaDir)\libsofia-sip-ua\su;$(SofiaDir)\libsofia-sip-ua\nua;$(SofiaDir)\libsofia-sip-ua\url;$(SofiaDir)\libsofia-sip-ua\sip;$(SofiaDir)\libsofia-sip-ua\msg;$(SofiaDir)\libsofia-sip-ua\sdp;$(SofiaDir)\libsofia-sip-ua\nta;$(SofiaDir)\libsofia-sip-ua\nea;$(SofiaDir)\libsofia-sip-ua\soa;$(SofiaDir)\libsofia-sip-ua\iptsec;$(SofiaDir)\libsofia-sip-ua\bnf;$(SofiaDir)\libsofia-sip-ua\features;$(SofiaDir)\libsofia-sip-ua\tport;%(AdditionalIncludeDirectories) - - - - - $(SofiaDir) - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/unibase.props b/libs/unimrcp/build/props/unibase.props deleted file mode 100644 index 2573021220..0000000000 --- a/libs/unimrcp/build/props/unibase.props +++ /dev/null @@ -1,29 +0,0 @@ - - - - $(ProjectDir)..\..\ - $(SolutionDir) - - - <_ProjectFileVersion>10.0.30319.1 - - - true - - - - WIN32;%(PreprocessorDefinitions) - Level4 - true - 4100;%(DisableSpecificWarnings) - - - - - $(ProjectRootDir) - - - $(LibRootDir) - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/unibin-x64.props b/libs/unimrcp/build/props/unibin-x64.props deleted file mode 100644 index 0d5b4dda41..0000000000 --- a/libs/unimrcp/build/props/unibin-x64.props +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)$(PlatformName)\$(Configuration)\bin\ - $(PlatformName)\$(Configuration)\ - - - - _WIN64;%(PreprocessorDefinitions) - - - $(AprDir)\$(Platform)\$(Configuration);$(AprUtilDir)\$(Platform)\$(Configuration);$(SofiaDir)\win32\libsofia-sip-ua\$(Platform)\$(Configuration);$(SolutionDir)$(Platform)\$(Configuration)\lib;$(SolutionDir)$(Platform)\$(Configuration)\bin;%(AdditionalLibraryDirectories) - MachineX64 - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/unibin.props b/libs/unimrcp/build/props/unibin.props deleted file mode 100644 index bb83b9ed65..0000000000 --- a/libs/unimrcp/build/props/unibin.props +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)$(Configuration)\bin\ - $(Configuration)\ - - - - $(AprDir)\$(Configuration);$(AprUtilDir)\$(Configuration);$(SofiaDir)\win32\libsofia-sip-ua\$(Configuration);$(SolutionDir)$(Configuration)\lib;$(SolutionDir)$(Configuration)\bin;%(AdditionalLibraryDirectories) - MachineX86 - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/unidebug.props b/libs/unimrcp/build/props/unidebug.props deleted file mode 100644 index 7c3d8d81fe..0000000000 --- a/libs/unimrcp/build/props/unidebug.props +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - <_ProjectFileVersion>10.0.30319.1 - true - - - - Disabled - _DEBUG;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - - ProgramDatabase - - - true - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/unilib-x64.props b/libs/unimrcp/build/props/unilib-x64.props deleted file mode 100644 index e5e25acc2e..0000000000 --- a/libs/unimrcp/build/props/unilib-x64.props +++ /dev/null @@ -1,13 +0,0 @@ - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)$(PlatformName)\$(Configuration)\lib\ - $(PlatformName)\$(Configuration)\ - - - - _WIN64;%(PreprocessorDefinitions) - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/unilib.props b/libs/unimrcp/build/props/unilib.props deleted file mode 100644 index c77e94699e..0000000000 --- a/libs/unimrcp/build/props/unilib.props +++ /dev/null @@ -1,8 +0,0 @@ - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)$(Configuration)\lib\ - $(Configuration)\ - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/unimrcpclient.props b/libs/unimrcp/build/props/unimrcpclient.props deleted file mode 100644 index 78f2b87025..0000000000 --- a/libs/unimrcp/build/props/unimrcpclient.props +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - libunimrcpclient.lib;mrcpsofiasip.lib;mrcpunirtsp.lib;unirtsp.lib;mrcpclient.lib;mrcpv2transport.lib;mrcpsignaling.lib;mrcp.lib;mpf.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;libsofia_sip_ua.lib;ws2_32.lib;winmm.lib - - - <_ProjectFileVersion>10.0.30319.1 - - - - $(ProjectRootDir)platforms\libunimrcp-client\include;$(ProjectRootDir)build;%(AdditionalIncludeDirectories) - - - - - $(UniMRCPClientLibs) - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/unimrcpserver.props b/libs/unimrcp/build/props/unimrcpserver.props deleted file mode 100644 index 97c0f9808f..0000000000 --- a/libs/unimrcp/build/props/unimrcpserver.props +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - libunimrcpserver.lib;mrcpsofiasip.lib;mrcpunirtsp.lib;unirtsp.lib;mrcpserver.lib;mrcpv2transport.lib;mrcpsignaling.lib;mrcpengine.lib;mrcp.lib;mpf.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;libsofia_sip_ua.lib;ws2_32.lib;winmm.lib - - - <_ProjectFileVersion>10.0.30319.1 - - - - $(ProjectRootDir)platforms\libunimrcp-server\include;$(ProjectRootDir)build;%(AdditionalIncludeDirectories) - - - - - $(UniMRCPServerLibs) - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/uniplugin-x64.props b/libs/unimrcp/build/props/uniplugin-x64.props deleted file mode 100644 index 7dc181ca94..0000000000 --- a/libs/unimrcp/build/props/uniplugin-x64.props +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)$(PlatformName)\$(Configuration)\plugin\ - $(PlatformName)\$(Configuration)\ - - - - _WIN64;%(PreprocessorDefinitions) - - - $(AprDir)\$(Platform)\$(Configuration);$(AprUtilDir)\$(Platform)\$(Configuration);$(SolutionDir)$(Platform)\$(Configuration)\lib;%(AdditionalLibraryDirectories) - mrcpengine.lib;mrcp.lib;mpf.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;ws2_32.lib;%(AdditionalDependencies) - MachineX64 - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/uniplugin.props b/libs/unimrcp/build/props/uniplugin.props deleted file mode 100644 index 09dbe53c17..0000000000 --- a/libs/unimrcp/build/props/uniplugin.props +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)$(Configuration)\plugin\ - $(Configuration)\ - - - - $(AprDir)\$(Configuration);$(AprUtilDir)\$(Configuration);$(SolutionDir)$(Configuration)\lib;%(AdditionalLibraryDirectories) - mrcpengine.lib;mrcp.lib;mpf.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;ws2_32.lib;%(AdditionalDependencies) - MachineX86 - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/unirelease.props b/libs/unimrcp/build/props/unirelease.props deleted file mode 100644 index a2a832025a..0000000000 --- a/libs/unimrcp/build/props/unirelease.props +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - NDEBUG;%(PreprocessorDefinitions) - MultiThreadedDLL - - - ProgramDatabase - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/unirtsp.props b/libs/unimrcp/build/props/unirtsp.props deleted file mode 100644 index c872838994..0000000000 --- a/libs/unimrcp/build/props/unirtsp.props +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - $(ProjectRootDir)libs\uni-rtsp\include;%(AdditionalIncludeDirectories) - RTSP_STATIC_LIB;%(PreprocessorDefinitions) - - - \ No newline at end of file diff --git a/libs/unimrcp/build/rules/uniclientapp.am b/libs/unimrcp/build/rules/uniclientapp.am deleted file mode 100644 index 2b1b97d1c3..0000000000 --- a/libs/unimrcp/build/rules/uniclientapp.am +++ /dev/null @@ -1,24 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -# Includes -UNIMRCP_CLIENTAPP_INCLUDES = -I$(top_srcdir)/platforms/libunimrcp-client/include \ - -I$(top_srcdir)/libs/mrcp-client/include \ - -I$(top_srcdir)/libs/mrcp-signaling/include \ - -I$(top_srcdir)/libs/mrcpv2-transport/include \ - -I$(top_srcdir)/libs/mrcp/include \ - -I$(top_srcdir)/libs/mrcp/message/include \ - -I$(top_srcdir)/libs/mrcp/control/include \ - -I$(top_srcdir)/libs/mrcp/resources/include \ - -I$(top_srcdir)/libs/mpf/include \ - -I$(top_srcdir)/libs/apr-toolkit/include \ - -I$(top_srcdir)/build \ - $(UNIMRCP_APR_INCLUDES) - -# Libraries (LDADD) -UNIMRCP_CLIENTAPP_LIBS = $(top_builddir)/platforms/libunimrcp-client/libunimrcpclient.la - -# Linker options (LDFLAGS) -UNIMRCP_CLIENTAPP_OPTS = -if ISMAC -UNIMRCP_CLIENTAPP_OPTS += -framework CoreFoundation -framework SystemConfiguration -endif diff --git a/libs/unimrcp/build/rules/uniclientlib.am b/libs/unimrcp/build/rules/uniclientlib.am deleted file mode 100644 index 89d173e61a..0000000000 --- a/libs/unimrcp/build/rules/uniclientlib.am +++ /dev/null @@ -1,30 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -# Includes -UNIMRCP_CLIENTLIB_INCLUDES = -I$(top_srcdir)/modules/mrcp-sofiasip/include \ - -I$(top_srcdir)/modules/mrcp-unirtsp/include \ - -I$(top_srcdir)/libs/mrcp-client/include \ - -I$(top_srcdir)/libs/mrcp-signaling/include \ - -I$(top_srcdir)/libs/mrcpv2-transport/include \ - -I$(top_srcdir)/libs/mrcp/include \ - -I$(top_srcdir)/libs/mrcp/message/include \ - -I$(top_srcdir)/libs/mrcp/control/include \ - -I$(top_srcdir)/libs/mrcp/resources/include \ - -I$(top_srcdir)/libs/mpf/include \ - -I$(top_srcdir)/libs/apr-toolkit/include \ - -I$(top_srcdir)/build \ - $(UNIMRCP_APR_INCLUDES) - -# Libraries (LIBADD) -UNIMRCP_CLIENTLIB_LIBS = $(top_builddir)/modules/mrcp-sofiasip/libmrcpsofiasip.la \ - $(top_builddir)/modules/mrcp-unirtsp/libmrcpunirtsp.la \ - $(top_builddir)/libs/mrcpv2-transport/libmrcpv2transport.la \ - $(top_builddir)/libs/mrcp-client/libmrcpclient.la \ - $(top_builddir)/libs/mrcp-signaling/libmrcpsignaling.la \ - $(top_builddir)/libs/mrcp/libmrcp.la \ - $(top_builddir)/libs/mpf/libmpf.la \ - $(top_builddir)/libs/apr-toolkit/libaprtoolkit.la \ - $(UNIMRCP_APR_LIBS) $(UNIMRCP_SOFIA_LIBS) -lm - -# Linker options (LDFLAGS) -UNIMRCP_CLIENTLIB_OPTS = $(UNI_LT_VERSION) diff --git a/libs/unimrcp/build/rules/uniplugin.am b/libs/unimrcp/build/rules/uniplugin.am deleted file mode 100644 index caf0de48ad..0000000000 --- a/libs/unimrcp/build/rules/uniplugin.am +++ /dev/null @@ -1,14 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -# Includes -UNIMRCP_PLUGIN_INCLUDES = -I$(top_srcdir)/libs/mrcp-engine/include \ - -I$(top_srcdir)/libs/mrcp/include \ - -I$(top_srcdir)/libs/mrcp/message/include \ - -I$(top_srcdir)/libs/mrcp/control/include \ - -I$(top_srcdir)/libs/mrcp/resources/include \ - -I$(top_srcdir)/libs/mpf/include \ - -I$(top_srcdir)/libs/apr-toolkit/include \ - $(UNIMRCP_APR_INCLUDES) - -# Linker options (LDFLAGS) -UNIMRCP_PLUGIN_OPTS = -module $(PLUGIN_LT_VERSION) diff --git a/libs/unimrcp/build/rules/uniserverapp.am b/libs/unimrcp/build/rules/uniserverapp.am deleted file mode 100644 index 957b0e75cd..0000000000 --- a/libs/unimrcp/build/rules/uniserverapp.am +++ /dev/null @@ -1,25 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -# Includes -UNIMRCP_SERVERAPP_INCLUDES = -I$(top_srcdir)/platforms/libunimrcp-server/include \ - -I$(top_srcdir)/libs/mrcp-server/include \ - -I$(top_srcdir)/libs/mrcp-engine/include \ - -I$(top_srcdir)/libs/mrcp-signaling/include \ - -I$(top_srcdir)/libs/mrcpv2-transport/include \ - -I$(top_srcdir)/libs/mrcp/include \ - -I$(top_srcdir)/libs/mrcp/message/include \ - -I$(top_srcdir)/libs/mrcp/control/include \ - -I$(top_srcdir)/libs/mrcp/resources/include \ - -I$(top_srcdir)/libs/mpf/include \ - -I$(top_srcdir)/libs/apr-toolkit/include \ - -I$(top_srcdir)/build \ - $(UNIMRCP_APR_INCLUDES) - -# Libraries (LDADD) -UNIMRCP_SERVERAPP_LIBS = $(top_builddir)/platforms/libunimrcp-server/libunimrcpserver.la - -# Linker options (LDFLAGS) -UNIMRCP_SERVERAPP_OPTS = -if ISMAC -UNIMRCP_SERVERAPP_OPTS += -framework CoreFoundation -framework SystemConfiguration -endif diff --git a/libs/unimrcp/build/rules/uniserverlib.am b/libs/unimrcp/build/rules/uniserverlib.am deleted file mode 100644 index b933796e42..0000000000 --- a/libs/unimrcp/build/rules/uniserverlib.am +++ /dev/null @@ -1,32 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -# Includes -UNIMRCP_SERVERLIB_INCLUDES = -I$(top_srcdir)/modules/mrcp-sofiasip/include \ - -I$(top_srcdir)/modules/mrcp-unirtsp/include \ - -I$(top_srcdir)/libs/mrcp-server/include \ - -I$(top_srcdir)/libs/mrcp-engine/include \ - -I$(top_srcdir)/libs/mrcp-signaling/include \ - -I$(top_srcdir)/libs/mrcpv2-transport/include \ - -I$(top_srcdir)/libs/mrcp/include \ - -I$(top_srcdir)/libs/mrcp/message/include \ - -I$(top_srcdir)/libs/mrcp/control/include \ - -I$(top_srcdir)/libs/mrcp/resources/include \ - -I$(top_srcdir)/libs/mpf/include \ - -I$(top_srcdir)/libs/apr-toolkit/include \ - -I$(top_srcdir)/build \ - $(UNIMRCP_APR_INCLUDES) - -# Libraries (LIBADD) -UNIMRCP_SERVERLIB_LIBS = $(top_builddir)/modules/mrcp-sofiasip/libmrcpsofiasip.la \ - $(top_builddir)/modules/mrcp-unirtsp/libmrcpunirtsp.la \ - $(top_builddir)/libs/mrcp-server/libmrcpserver.la \ - $(top_builddir)/libs/mrcp-signaling/libmrcpsignaling.la \ - $(top_builddir)/libs/mrcpv2-transport/libmrcpv2transport.la \ - $(top_builddir)/libs/mrcp-engine/libmrcpengine.la \ - $(top_builddir)/libs/mrcp/libmrcp.la \ - $(top_builddir)/libs/mpf/libmpf.la \ - $(top_builddir)/libs/apr-toolkit/libaprtoolkit.la \ - $(UNIMRCP_APR_LIBS) $(UNIMRCP_SOFIA_LIBS) -lm - -# Linker options (LDFLAGS) -UNIMRCP_SERVERLIB_OPTS = $(UNI_LT_VERSION) diff --git a/libs/unimrcp/build/tools/prepare.vcproj b/libs/unimrcp/build/tools/prepare.vcproj deleted file mode 100644 index 3b03c54a93..0000000000 --- a/libs/unimrcp/build/tools/prepare.vcproj +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/build/tools/prepare.vcxproj b/libs/unimrcp/build/tools/prepare.vcxproj deleted file mode 100644 index b9ab80fc50..0000000000 --- a/libs/unimrcp/build/tools/prepare.vcxproj +++ /dev/null @@ -1,205 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {01D63BF5-7798-4746-852A-4B45229BB735} - prepare - Win32Proj - - - - Utility - Unicode - true - - - Utility - Unicode - - - Utility - Unicode - true - - - Utility - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - true - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - true - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - - - - xcopy "$(AprDir)\$(Configuration)\libapr-1.dll" "$(SolutionDir)$(Configuration)\bin\" /Y -xcopy "$(AprUtilDir)\$(Configuration)\libaprutil-1.dll" "$(SolutionDir)$(Configuration)\bin\" /Y - -if exist "$(AprIconvDir)\$(Configuration)\libapriconv-1.dll" ( -xcopy "$(AprIconvDir)\$(Configuration)\libapriconv-1.dll" "$(SolutionDir)$(Configuration)\bin\" /Y -if exist "$(AprIconvDir)\$(Configuration)\iconv" ( -if not exist "$(SolutionDir)$(Configuration)\bin\iconv" mkdir "$(SolutionDir)$(Configuration)\bin\iconv" -xcopy "$(AprIconvDir)\$(Configuration)\iconv\*.so" "$(SolutionDir)$(Configuration)\bin\iconv\" /Y -) -) - -xcopy "$(SofiaDir)\win32\libsofia-sip-ua\$(Configuration)\libsofia_sip_ua.dll" "$(SolutionDir)$(Configuration)\bin\" /Y -xcopy "$(SofiaDir)\win32\pthread\$(Configuration)\pthreadVC2.dll" "$(SolutionDir)$(Configuration)\bin\" /Y - -if not exist "$(SolutionDir)$(Configuration)\conf" ( -xcopy "$(SolutionDir)conf\*.xml" "$(SolutionDir)$(Configuration)\conf\" /Y -xcopy "$(SolutionDir)conf\*.xsd" "$(SolutionDir)$(Configuration)\conf\" /Y -xcopy "$(SolutionDir)conf\client-profiles\*.xml" "$(SolutionDir)$(Configuration)\conf\client-profiles\" /Y -) - -if not exist "$(SolutionDir)$(Configuration)\data" xcopy "$(SolutionDir)data\*" "$(SolutionDir)$(Configuration)\data\" /Y -if not exist "$(SolutionDir)$(Configuration)\log" mkdir "$(SolutionDir)$(Configuration)\log\" -if not exist "$(SolutionDir)$(Configuration)\var" mkdir "$(SolutionDir)$(Configuration)\var\" - - - - - - xcopy "$(AprDir)\$(Platform)\$(Configuration)\libapr-1.dll" "$(SolutionDir)$(Platform)\$(Configuration)\bin\" /Y -xcopy "$(AprUtilDir)\$(Platform)\$(Configuration)\libaprutil-1.dll" "$(SolutionDir)$(Platform)\$(Configuration)\bin\" /Y - -if exist "$(AprIconvDir)\$(Platform)\$(Configuration)\libapriconv-1.dll" ( -xcopy "$(AprIconvDir)\$(Platform)\$(Configuration)\libapriconv-1.dll" "$(SolutionDir)$(Platform)\$(Configuration)\bin\" /Y -if exist "$(AprIconvDir)\$(Platform)\$(Configuration)\iconv" ( -if not exist "$(SolutionDir)$(Platform)\$(Configuration)\bin\iconv" mkdir "$(SolutionDir)$(Platform)\$(Configuration)\bin\iconv" -xcopy "$(AprIconvDir)\$(Platform)\$(Configuration)\iconv\*.so" "$(SolutionDir)$(Platform)\$(Configuration)\bin\iconv\" /Y -) -) - -xcopy "$(SofiaDir)\win32\libsofia-sip-ua\$(Platform)\$(Configuration)\libsofia_sip_ua.dll" "$(SolutionDir)$(Platform)\$(Configuration)\bin\" /Y -xcopy "$(SofiaDir)\win32\pthread\$(Platform)\$(Configuration)\pthreadVC2.dll" "$(SolutionDir)$(Platform)\$(Configuration)\bin\" /Y - -if not exist "$(SolutionDir)$(Platform)\$(Configuration)\conf" ( -xcopy "$(SolutionDir)conf\*.xml" "$(SolutionDir)$(Platform)\$(Configuration)\conf\" /Y -xcopy "$(SolutionDir)conf\*.xsd" "$(SolutionDir)$(Platform)\$(Configuration)\conf\" /Y -xcopy "$(SolutionDir)conf\client-profiles\*.xml" "$(SolutionDir)$(Platform)\$(Configuration)\conf\client-profiles\" /Y -) - -if not exist "$(SolutionDir)$(Platform)\$(Configuration)\data" xcopy "$(SolutionDir)data\*" "$(SolutionDir)$(Platform)\$(Configuration)\data\" /Y -if not exist "$(SolutionDir)$(Platform)\$(Configuration)\log" mkdir "$(SolutionDir)$(Platform)\$(Configuration)\log\" -if not exist "$(SolutionDir)$(Platform)\$(Configuration)\var" mkdir "$(SolutionDir)$(Platform)\$(Configuration)\var\" - - - - X64 - - - - - xcopy "$(AprDir)\$(Configuration)\libapr-1.dll" "$(SolutionDir)$(Configuration)\bin\" /Y -xcopy "$(AprUtilDir)\$(Configuration)\libaprutil-1.dll" "$(SolutionDir)$(Configuration)\bin\" /Y - -if exist "$(AprIconvDir)\$(Configuration)\libapriconv-1.dll" ( -xcopy "$(AprIconvDir)\$(Configuration)\libapriconv-1.dll" "$(SolutionDir)$(Configuration)\bin\" /Y -if exist "$(AprIconvDir)\$(Configuration)\iconv" ( -if not exist "$(SolutionDir)$(Configuration)\bin\iconv" mkdir "$(SolutionDir)$(Configuration)\bin\iconv" -xcopy "$(AprIconvDir)\$(Configuration)\iconv\*.so" "$(SolutionDir)$(Configuration)\bin\iconv\" /Y -) -) - -xcopy "$(SofiaDir)\win32\libsofia-sip-ua\$(Configuration)\libsofia_sip_ua.dll" "$(SolutionDir)$(Configuration)\bin\" /Y -xcopy "$(SofiaDir)\win32\pthread\$(Configuration)\pthreadVC2.dll" "$(SolutionDir)$(Configuration)\bin\" /Y - -if not exist "$(SolutionDir)$(Configuration)\conf" ( -xcopy "$(SolutionDir)conf\*.xml" "$(SolutionDir)$(Configuration)\conf\" /Y -xcopy "$(SolutionDir)conf\*.xsd" "$(SolutionDir)$(Configuration)\conf\" /Y -xcopy "$(SolutionDir)conf\client-profiles\*.xml" "$(SolutionDir)$(Configuration)\conf\client-profiles\" /Y -) - -if not exist "$(SolutionDir)$(Configuration)\data" xcopy "$(SolutionDir)data\*" "$(SolutionDir)$(Configuration)\data\" /Y -if not exist "$(SolutionDir)$(Configuration)\log" mkdir "$(SolutionDir)$(Configuration)\log\" -if not exist "$(SolutionDir)$(Configuration)\var" mkdir "$(SolutionDir)$(Configuration)\var\" - - - - - - xcopy "$(AprDir)\$(Platform)\$(Configuration)\libapr-1.dll" "$(SolutionDir)$(Platform)\$(Configuration)\bin\" /Y -xcopy "$(AprUtilDir)\$(Platform)\$(Configuration)\libaprutil-1.dll" "$(SolutionDir)$(Platform)\$(Configuration)\bin\" /Y - -if exist "$(AprIconvDir)\$(Platform)\$(Configuration)\libapriconv-1.dll" ( -xcopy "$(AprIconvDir)\$(Platform)\$(Configuration)\libapriconv-1.dll" "$(SolutionDir)$(Platform)\$(Configuration)\bin\" /Y -if exist "$(AprIconvDir)\$(Platform)\$(Configuration)\iconv" ( -if not exist "$(SolutionDir)$(Platform)\$(Configuration)\bin\iconv" mkdir "$(SolutionDir)$(Platform)\$(Configuration)\bin\iconv" -xcopy "$(AprIconvDir)\$(Platform)\$(Configuration)\iconv\*.so" "$(SolutionDir)$(Platform)\$(Configuration)\bin\iconv\" /Y -) -) - -xcopy "$(SofiaDir)\win32\libsofia-sip-ua\$(Platform)\$(Configuration)\libsofia_sip_ua.dll" "$(SolutionDir)$(Platform)\$(Configuration)\bin\" /Y -xcopy "$(SofiaDir)\win32\pthread\$(Platform)\$(Configuration)\pthreadVC2.dll" "$(SolutionDir)$(Platform)\$(Configuration)\bin\" /Y - -if not exist "$(SolutionDir)$(Platform)\$(Configuration)\conf" ( -xcopy "$(SolutionDir)conf\*.xml" "$(SolutionDir)$(Platform)\$(Configuration)\conf\" /Y -xcopy "$(SolutionDir)conf\*.xsd" "$(SolutionDir)$(Platform)\$(Configuration)\conf\" /Y -xcopy "$(SolutionDir)conf\client-profiles\*.xml" "$(SolutionDir)$(Platform)\$(Configuration)\conf\client-profiles\" /Y -) - -if not exist "$(SolutionDir)$(Platform)\$(Configuration)\data" xcopy "$(SolutionDir)data\*" "$(SolutionDir)$(Platform)\$(Configuration)\data\" /Y -if not exist "$(SolutionDir)$(Platform)\$(Configuration)\log" mkdir "$(SolutionDir)$(Platform)\$(Configuration)\log\" -if not exist "$(SolutionDir)$(Platform)\$(Configuration)\var" mkdir "$(SolutionDir)$(Platform)\$(Configuration)\var\" - - - - X64 - - - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/build/tools/unimrcp_service.c b/libs/unimrcp/build/tools/unimrcp_service.c deleted file mode 100644 index db2ed39bab..0000000000 --- a/libs/unimrcp/build/tools/unimrcp_service.c +++ /dev/null @@ -1,446 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: unimrcp_service.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include -#include -#include -#include "apt.h" -#include "apt_pool.h" - -#define WIN_SERVICE_NAME "unimrcp" - -/** UniMRCP service register command enumeration */ -typedef enum uni_service_register_e { - USR_NONE, USR_REGISTER, USR_UNREGISTER -} uni_service_register_e; - -/** UniMRCP service control command enumeration */ -typedef enum uni_service_control_e { - USC_NONE, USC_START, USC_STOP -} uni_service_control_e; - - -/** Display error message with Windows error code and description */ -static void winerror(const char *msg) -{ - char buf[128]; - DWORD err = GetLastError(); - int ret = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - err, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - buf, sizeof(buf), NULL); - printf("%s: %lu %.*s\n", msg, err, ret, buf); -} - -/** Register/install service in SCM */ -static apt_bool_t uni_service_register(const char *root_dir_path, apr_pool_t *pool, - const char *name, - apt_bool_t autostart, - unsigned long recover, - int log_priority, - const char *disp_name, - const char *description) -{ - apr_status_t status; - char buf[4096]; - static const size_t len = sizeof(buf); - size_t pos = 0; - char *root_dir; - SERVICE_DESCRIPTION desc; - SC_HANDLE sch_service; - SC_HANDLE sch_manager; - - /* Normalize root directory path and make it absolute */ - status = apr_filepath_merge(&root_dir, NULL, root_dir_path, - APR_FILEPATH_NOTRELATIVE | APR_FILEPATH_NATIVE | APR_FILEPATH_TRUENAME, pool); - if (status != APR_SUCCESS) { - printf("Error making root directory absolute: %d %.512s\n", status, - apr_strerror(status, buf, 512)); - return FALSE; - } - buf[pos++] = '"'; - pos = apr_cpystrn(buf + pos, root_dir, len - pos) - buf; - if ((buf[pos - 1] != '\\') && (pos < len)) - /* Add trailing backslash */ - buf[pos++] = '\\'; - pos = apr_cpystrn(buf + pos, "bin\\unimrcpserver.exe\" --service -o 2", len - pos) - buf; - if (log_priority >= 0) { - pos = apr_cpystrn(buf + pos, " -l ", len - pos) - buf; - if (pos < len - 34) - pos += strlen(itoa(log_priority, buf + pos, 10)); - } - if (name) { - pos = apr_cpystrn(buf + pos, " --name \"", len - pos) - buf; - pos = apr_cpystrn(buf + pos, name, len - pos) - buf; - if ((buf[pos - 1] == '\\') && (pos < len)) - /* `\"' might be misinterpreted as escape, so replace `\' with `\\' */ - buf[pos++] = '\\'; - if (pos < len) - buf[pos++] = '"'; - } - pos = apr_cpystrn(buf + pos, " --root-dir \"", len - pos) - buf; - pos = apr_cpystrn(buf + pos, root_dir, len - pos) - buf; - if ((buf[pos - 1] == '\\') && (pos < len)) - /* `\"' might be misinterpreted as escape, so replace `\' with `\\' */ - buf[pos++] = '\\'; - if (pos < len) - buf[pos++] = '"'; - if (pos < len) - buf[pos] = 0; - else { - puts("Service Command Too Long"); - return FALSE; - } - if (!disp_name || !*disp_name) { - if (name) - disp_name = apr_pstrcat(pool, name, " ", "UniMRCP Server", NULL); - else - disp_name = "UniMRCP Server"; - } - if (!description || !*description) - description = "Launches UniMRCP Server"; - - sch_manager = OpenSCManager(0,0,SC_MANAGER_ALL_ACCESS); - if(!sch_manager) { - winerror("Failed to Open SCManager"); - return FALSE; - } - sch_service = CreateService( - sch_manager, - name ? name : WIN_SERVICE_NAME, - disp_name, - GENERIC_EXECUTE | SERVICE_CHANGE_CONFIG, - SERVICE_WIN32_OWN_PROCESS, - autostart ? SERVICE_AUTO_START : SERVICE_DEMAND_START, - SERVICE_ERROR_NORMAL, - buf,0,0,0,0,0); - if(!sch_service) { - winerror("Failed to Create Service"); - CloseServiceHandle(sch_manager); - return FALSE; - } - - desc.lpDescription = (char *) description; - if(!ChangeServiceConfig2(sch_service,SERVICE_CONFIG_DESCRIPTION,&desc)) { - winerror("Failed to Set Service Description"); - } - - if (recover) { - SERVICE_FAILURE_ACTIONS sfa; - SC_ACTION action; - sfa.dwResetPeriod = 0; - sfa.lpCommand = ""; - sfa.lpRebootMsg = ""; - sfa.cActions = 1; - sfa.lpsaActions = &action; - action.Delay = recover * 1000; - action.Type = SC_ACTION_RESTART; - if (!ChangeServiceConfig2(sch_service,SERVICE_CONFIG_FAILURE_ACTIONS,&sfa)) { - winerror("Failed to Set Service Restart on Failure"); - } - } - - CloseServiceHandle(sch_service); - CloseServiceHandle(sch_manager); - printf("UniMRCP service %s registered\n", name ? name : WIN_SERVICE_NAME); - return TRUE; -} - -/** Unregister/uninstall service from SCM */ -static apt_bool_t uni_service_unregister(const char *name) -{ - apt_bool_t status = TRUE; - SERVICE_STATUS ss_status; - SC_HANDLE sch_service; - SC_HANDLE sch_manager = OpenSCManager(0,0,SC_MANAGER_ALL_ACCESS); - if (!name) name = WIN_SERVICE_NAME; - if(!sch_manager) { - winerror("Failed to Open SCManager"); - return FALSE; - } - - sch_service = OpenService(sch_manager,name,DELETE|SERVICE_STOP); - if(!sch_service) { - winerror("Failed to Open Service"); - CloseServiceHandle(sch_manager); - return FALSE; - } - - ControlService(sch_service,SERVICE_CONTROL_STOP,&ss_status); - if(!DeleteService(sch_service)) { - winerror("Failed to Delete Service"); - status = FALSE; - } else - printf("UniMRCP service %s unregistered\n", name); - CloseServiceHandle(sch_service); - CloseServiceHandle(sch_manager); - return status; -} - -/** Start service */ -static apt_bool_t uni_service_start(const char *name) -{ - apt_bool_t status = TRUE; - SC_HANDLE sch_service; - SC_HANDLE sch_manager = OpenSCManager(0,0,SC_MANAGER_ALL_ACCESS); - if (!name) name = WIN_SERVICE_NAME; - if(!sch_manager) { - winerror("Failed to Open SCManager"); - return FALSE; - } - - sch_service = OpenService(sch_manager,name,SERVICE_START); - if(!sch_service) { - winerror("Failed to Open Service"); - CloseServiceHandle(sch_manager); - return FALSE; - } - - if(!StartService(sch_service,0,NULL)) { - winerror("Failed to Start Service"); - status = FALSE; - } else - printf("UniMRCP service %s started\n", name); - CloseServiceHandle(sch_service); - CloseServiceHandle(sch_manager); - return status; -} - -/** Stop service */ -static apt_bool_t uni_service_stop(const char *name) -{ - apt_bool_t status = TRUE; - SERVICE_STATUS ss_status; - SC_HANDLE sch_service; - SC_HANDLE sch_manager = OpenSCManager(0,0,SC_MANAGER_ALL_ACCESS); - if (!name) name = WIN_SERVICE_NAME; - if(!sch_manager) { - winerror("Failed to Open SCManager"); - return FALSE; - } - - sch_service = OpenService(sch_manager,name,SERVICE_STOP); - if(!sch_service) { - winerror("Failed to Open Service"); - CloseServiceHandle(sch_manager); - return FALSE; - } - - if(!ControlService(sch_service,SERVICE_CONTROL_STOP,&ss_status)) { - winerror("Failed to Stop Service"); - status = FALSE; - } else - printf("UniMRCP service %s stopped\n", name); - - CloseServiceHandle(sch_service); - CloseServiceHandle(sch_manager); - return status; -} - - -static void usage() -{ - static apt_bool_t written = FALSE; - if (written) return; - printf( - "\n" - "Usage:\n" - "\n" - " unimrcpservice [options]\n" - "\n" - " Available options:\n" - "\n" - " -r [--register] rootdir : Register the Windows service.\n" - "\n" - " -u [--unregister] : Unregister the Windows service.\n" - "\n" - " -s [--start] : Start the Windows service.\n" - "\n" - " -t [--stop] : Stop the Windows service.\n" - "\n" - " -n [--name] svcname : Service name (default: unimrcp)\n" - "\n" - " -a [--autostart] : Start service after boot-up\n" - "\n" - " -f [--fail-restart] n : If crashed, restart after n secs\n" - "\n" - " -l [--log-prio] priority: Set the log priority.\n" - " (0-emergency, ..., 7-debug)\n" - " -p [--disp-name] title : Set service display name\n" - " (default: [svcname] UniMRCP Server)\n" - " -c [--description] desc : Set service description\n" - " (default: Launches UniMRCP Server)\n" - " -h [--help] : Show the help.\n" - "\n"); - written = TRUE; -} - -int main(int argc, const char * const *argv) -{ - apr_pool_t *pool; - apr_status_t rv; - apr_getopt_t *opt; - apt_bool_t ret = TRUE; - uni_service_register_e reg = USR_NONE; - uni_service_control_e control = USC_NONE; - const char *root_dir = ".."; - const char *name = NULL; - apt_bool_t autostart = FALSE; - unsigned long recover = 0; - int log_priority = -1; - const char *disp_name = NULL; - const char *description = NULL; - - static const apr_getopt_option_t opt_option[] = { - /* long-option, short-option, has-arg flag, description */ - { "register", 'r', TRUE, "register service" }, /* -r or --register arg */ - { "unregister", 'u', FALSE, "unregister service" }, /* -u or --unregister */ - { "start", 's', FALSE, "start service" }, /* -s or --start */ - { "stop", 't', FALSE, "stop service" }, /* -t or --stop */ - { "name", 'n', TRUE, "service name" }, /* -n or --name arg */ - { "autostart", 'a', FALSE, "start automatically" },/* -a or --autostart */ - { "fail-restart",'f', TRUE, "restart if fails" }, /* -f or --fail-restart arg */ - { "log-prio", 'l', TRUE, "log priority" }, /* -l arg or --log-prio arg */ - { "disp-name", 'p', TRUE, "display name" }, /* -p arg or --disp-name arg */ - { "description", 'c', TRUE, "description" }, /* -c arg or --description arg */ - { "help", 'h', FALSE, "show help" }, /* -h or --help */ - { NULL, 0, 0, NULL }, /* end */ - }; - - /* APR global initialization */ - if(apr_initialize() != APR_SUCCESS) { - apr_terminate(); - return 1; - } - - /* create APR pool */ - pool = apt_pool_create(); - if(!pool) { - apr_terminate(); - return 1; - } - - rv = apr_getopt_init(&opt, pool , argc, argv); - if(rv == APR_SUCCESS) { - int optch; - const char *optarg; - while((rv = apr_getopt_long(opt, opt_option, &optch, &optarg)) == APR_SUCCESS) { - switch(optch) { - case 'r': - if ((reg == USR_NONE) || (reg == USR_REGISTER)) { - reg = USR_REGISTER; - root_dir = optarg; - } else { - puts("Incosistent arguments"); - ret = FALSE; - } - break; - case 'u': - if ((reg == USR_NONE) || (reg == USR_UNREGISTER)) - reg = USR_UNREGISTER; - else { - puts("Incosistent arguments"); - ret = FALSE; - } - break; - case 's': - if ((control == USC_NONE) || (control == USC_START)) - control = USC_START; - else { - puts("Incosistent arguments"); - ret = FALSE; - } - break; - case 't': - if ((control == USC_NONE) || (control == USC_STOP)) - control = USC_STOP; - else { - puts("Incosistent arguments"); - ret = FALSE; - } - break; - case 'n': - name = optarg; - break; - case 'a': - autostart = TRUE; - break; - case 'f': - if (sscanf(optarg, "%lu", &recover) != 1) { - puts("Invalid value for param --fail-restart"); - ret = FALSE; - } - break; - case 'l': - if ((sscanf(optarg, "%d", &log_priority) != 1) || - (log_priority < 0) || (log_priority > 7)) - { - puts("Invalid value for param --log-prio"); - ret = FALSE; - } - break; - case 'p': - disp_name = optarg; - break; - case 'c': - description = optarg; - break; - case 'h': - usage(); - break; - } - if (!ret) break; - } - if (ret && - (((reg == USR_REGISTER) && (control == USC_STOP)) || - ((reg == USR_UNREGISTER) && (control == USC_START)))) { - ret = FALSE; - puts("Inconsistent arguments"); - } - if((rv != APR_EOF) || !ret || (!reg && !control)) { - ret = FALSE; - usage(); - } - } - - while (ret) { /* No problem so far */ - if (reg == USR_REGISTER) - ret = uni_service_register(root_dir, pool, name, autostart, recover, log_priority, disp_name, description); - if (!ret) break; - - if (control == USC_START) - ret = uni_service_start(name); - if (!ret) break; - - if (control == USC_STOP) - ret = uni_service_stop(name); - /* Do not break here, stop failure should not matter before unregistration */ - - if (reg == USR_UNREGISTER) - ret = uni_service_unregister(name); - break; - } - - /* destroy APR pool */ - apr_pool_destroy(pool); - /* APR global termination */ - apr_terminate(); - return ret ? 0 : 1; -} diff --git a/libs/unimrcp/build/tools/unimrcpservice.exe.manifest b/libs/unimrcp/build/tools/unimrcpservice.exe.manifest deleted file mode 100644 index 3a14ebfb75..0000000000 --- a/libs/unimrcp/build/tools/unimrcpservice.exe.manifest +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/libs/unimrcp/build/tools/unimrcpservice.rc b/libs/unimrcp/build/tools/unimrcpservice.rc deleted file mode 100644 index a9cebe94dc..0000000000 --- a/libs/unimrcp/build/tools/unimrcpservice.rc +++ /dev/null @@ -1,39 +0,0 @@ -#include "uni_version.h" - -1 VERSIONINFO - FILEVERSION UNI_VERSION_STRING_CSV,0 - PRODUCTVERSION UNI_VERSION_STRING_CSV,0 - FILEFLAGSMASK 0x3fL -#if defined(_DEBUG) - FILEFLAGS 0x01L -#else - FILEFLAGS 0x00L -#endif -#if defined(WINNT) || defined(WIN64) - FILEOS 0x40004L -#else - FILEOS 0x4L -#endif - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "Comments", UNI_LICENSE "\0" - VALUE "CompanyName", "UniMRCP\0" - VALUE "FileDescription", "UniMRCP Service Manager\0" - VALUE "FileVersion", UNI_VERSION_STRING "\0" - VALUE "InternalName", "unimrcpservice" "\0" - VALUE "LegalCopyright", UNI_COPYRIGHT "\0" - VALUE "OriginalFilename", "unimrcpservice.exe" "\0" - VALUE "ProductName", "UniMRCP Project\0" - VALUE "ProductVersion", UNI_VERSION_STRING "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END diff --git a/libs/unimrcp/build/tools/unimrcpservice.vcproj b/libs/unimrcp/build/tools/unimrcpservice.vcproj deleted file mode 100644 index fec552b155..0000000000 --- a/libs/unimrcp/build/tools/unimrcpservice.vcproj +++ /dev/null @@ -1,326 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/build/tools/unimrcpservice.vcxproj b/libs/unimrcp/build/tools/unimrcpservice.vcxproj deleted file mode 100644 index 63e1324ba3..0000000000 --- a/libs/unimrcp/build/tools/unimrcpservice.vcxproj +++ /dev/null @@ -1,136 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {4714EF49-BFD5-4B22-95F7-95A07F1EAC25} - unimrcpservice - - - - Application - - - Application - - - Application - - - Application - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - RequireAdministrator - - - - - aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - UseLinkTimeCodeGeneration - RequireAdministrator - - - - - X64 - - - ProgramDatabase - - - aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - RequireAdministrator - - - - - X64 - - - aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - UseLinkTimeCodeGeneration - RequireAdministrator - - - - - - - - {13deeca0-bdd4-4744-a1a2-8eb0a44df3d2} - false - - - - - ..\..\build;%(AdditionalIncludeDirectories) - ..\..\build;%(AdditionalIncludeDirectories) - ..\..\build;%(AdditionalIncludeDirectories) - ..\..\build;%(AdditionalIncludeDirectories) - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/build/tools/unimrcpservice.vcxproj.filters b/libs/unimrcp/build/tools/unimrcpservice.vcxproj.filters deleted file mode 100644 index 8a04533143..0000000000 --- a/libs/unimrcp/build/tools/unimrcpservice.vcxproj.filters +++ /dev/null @@ -1,17 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - src - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/build/uni_revision.h b/libs/unimrcp/build/uni_revision.h deleted file mode 100644 index b7680b88cf..0000000000 --- a/libs/unimrcp/build/uni_revision.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef UNI_REVISION_H -#define UNI_REVISION_H - -/** - * @file uni_revision.h - * @brief UniMRCP Revision - * - * This file contains the revision base number and other relevant information. - */ - -/** Revision base number. */ -#define UNI_REVISION 2208 - -/** Revision base string. */ -#define UNI_REVISION_STRING "2208" - -/** Revision base date. */ -#define UNI_REVISION_DATE "2014-10-31" - -/** Revision base stamp. */ -#define UNI_REVISION_STAMP 20141031L - - -/** Check at compile time if the revision base number is at least a certain level. */ -#define UNI_REVISION_AT_LEAST(rev) ((rev) < UNI_REVISION) - -#endif /* UNI_REVISION_H */ diff --git a/libs/unimrcp/build/uni_version.h b/libs/unimrcp/build/uni_version.h deleted file mode 100644 index 2e0edb9c30..0000000000 --- a/libs/unimrcp/build/uni_version.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: uni_version.h 2139 2014-07-07 05:06:19Z achaloyan@gmail.com $ - */ - -#ifndef UNI_VERSION_H -#define UNI_VERSION_H - -/** - * @file uni_version.h - * @brief UniMRCP Version - * - * UniMRCP uses a version numbering scheme derived from the APR project. - * - * APR's Version Numbering - */ - -/** major version - * Major API changes that could cause compatibility problems for older - * programs such as structure size changes. No binary compatibility is - * possible across a change in the major version. - */ -#define UNI_MAJOR_VERSION 1 - -/** minor version - * Minor API changes that do not cause binary compatibility problems. - * Reset to 0 when upgrading UNI_MAJOR_VERSION. - */ -#define UNI_MINOR_VERSION 2 - -/** patch level - * The Patch Level never includes API changes, simply bug fixes. - * Reset to 0 when upgrading UNI_MINOR_VERSION. - */ -#define UNI_PATCH_VERSION 0 - - -/** Check at compile time if the version of UniMRCP is at least a certain level. */ -#define UNI_VERSION_AT_LEAST(major,minor,patch) \ -(((major) < UNI_MAJOR_VERSION) \ - || ((major) == UNI_MAJOR_VERSION && (minor) < UNI_MINOR_VERSION) \ - || ((major) == UNI_MAJOR_VERSION && (minor) == UNI_MINOR_VERSION && (patch) <= UNI_PATCH_VERSION)) - -/** Properly quote a value as a string in the C preprocessor. */ -#define UNI_STRINGIFY(n) UNI_STRINGIFY_HELPER(n) -/** Helper macro for UNI_STRINGIFY. */ -#define UNI_STRINGIFY_HELPER(n) #n - -/** The formatted string of UniMRCP's version. */ -#define UNI_VERSION_STRING \ - UNI_STRINGIFY(UNI_MAJOR_VERSION) "." \ - UNI_STRINGIFY(UNI_MINOR_VERSION) "." \ - UNI_STRINGIFY(UNI_PATCH_VERSION) - -/** An alternative formatted string of UniMRCP's version - macro for Win32 .rc files using numeric CSV representation. */ -#define UNI_VERSION_STRING_CSV UNI_MAJOR_VERSION ##, \ - ##UNI_MINOR_VERSION ##, \ - ##UNI_PATCH_VERSION - -/** The Copyright. */ -#define UNI_COPYRIGHT "Copyright 2008-2014 Arsen Chaloyan" - -/* - * Use the brief description of the license for Win32 .rc files; - * otherwise, use the full description. - */ -#if defined(APSTUDIO_INVOKED) || defined(RC_INVOKED) -/** The License (brief description). */ -#define UNI_LICENSE "The Apache License, Version 2.0" -#else -/** The License (full description). */ -#define UNI_LICENSE \ - " * Licensed under the Apache License, Version 2.0 (the ""License"");\n" \ - " * you may not use this file except in compliance with the License.\n" \ - " * You may obtain a copy of the License at\n" \ - " * \n" \ - " * http://www.apache.org/licenses/LICENSE-2.0 \n" \ - " * \n" \ - " * Unless required by applicable law or agreed to in writing, software\n" \ - " * distributed under the License is distributed on an ""AS IS"" BASIS,\n" \ - " * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" \ - " * See the License for the specific language governing permissions and\n" \ - " * limitations under the License.\n" -#endif /* APSTUDIO_INVOKED || RC_INVOKED */ - -#endif /* UNI_VERSION_H */ diff --git a/libs/unimrcp/build/vsprops/apr.vsprops b/libs/unimrcp/build/vsprops/apr.vsprops deleted file mode 100644 index a37045dcd8..0000000000 --- a/libs/unimrcp/build/vsprops/apr.vsprops +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - diff --git a/libs/unimrcp/build/vsprops/apt.vsprops b/libs/unimrcp/build/vsprops/apt.vsprops deleted file mode 100644 index e5d8b57780..0000000000 --- a/libs/unimrcp/build/vsprops/apt.vsprops +++ /dev/null @@ -1,13 +0,0 @@ - - - - diff --git a/libs/unimrcp/build/vsprops/mpf.vsprops b/libs/unimrcp/build/vsprops/mpf.vsprops deleted file mode 100644 index 6e051d8607..0000000000 --- a/libs/unimrcp/build/vsprops/mpf.vsprops +++ /dev/null @@ -1,13 +0,0 @@ - - - - diff --git a/libs/unimrcp/build/vsprops/mrcp.vsprops b/libs/unimrcp/build/vsprops/mrcp.vsprops deleted file mode 100644 index c51b241a53..0000000000 --- a/libs/unimrcp/build/vsprops/mrcp.vsprops +++ /dev/null @@ -1,13 +0,0 @@ - - - - diff --git a/libs/unimrcp/build/vsprops/mrcpclient.vsprops b/libs/unimrcp/build/vsprops/mrcpclient.vsprops deleted file mode 100644 index 0a866442f2..0000000000 --- a/libs/unimrcp/build/vsprops/mrcpclient.vsprops +++ /dev/null @@ -1,12 +0,0 @@ - - - - diff --git a/libs/unimrcp/build/vsprops/mrcpengine.vsprops b/libs/unimrcp/build/vsprops/mrcpengine.vsprops deleted file mode 100644 index 5108cf30d3..0000000000 --- a/libs/unimrcp/build/vsprops/mrcpengine.vsprops +++ /dev/null @@ -1,12 +0,0 @@ - - - - diff --git a/libs/unimrcp/build/vsprops/mrcpserver.vsprops b/libs/unimrcp/build/vsprops/mrcpserver.vsprops deleted file mode 100644 index 11932f804c..0000000000 --- a/libs/unimrcp/build/vsprops/mrcpserver.vsprops +++ /dev/null @@ -1,12 +0,0 @@ - - - - diff --git a/libs/unimrcp/build/vsprops/mrcpsignaling.vsprops b/libs/unimrcp/build/vsprops/mrcpsignaling.vsprops deleted file mode 100644 index 170a8ea14d..0000000000 --- a/libs/unimrcp/build/vsprops/mrcpsignaling.vsprops +++ /dev/null @@ -1,12 +0,0 @@ - - - - diff --git a/libs/unimrcp/build/vsprops/mrcpv2transport.vsprops b/libs/unimrcp/build/vsprops/mrcpv2transport.vsprops deleted file mode 100644 index 88d046158d..0000000000 --- a/libs/unimrcp/build/vsprops/mrcpv2transport.vsprops +++ /dev/null @@ -1,12 +0,0 @@ - - - - diff --git a/libs/unimrcp/build/vsprops/sdk/unimrcpclient.vsprops b/libs/unimrcp/build/vsprops/sdk/unimrcpclient.vsprops deleted file mode 100644 index 09ca2cd194..0000000000 --- a/libs/unimrcp/build/vsprops/sdk/unimrcpclient.vsprops +++ /dev/null @@ -1,12 +0,0 @@ - - - - diff --git a/libs/unimrcp/build/vsprops/sdk/unimrcpplugin.vsprops b/libs/unimrcp/build/vsprops/sdk/unimrcpplugin.vsprops deleted file mode 100644 index 96fb0cfed1..0000000000 --- a/libs/unimrcp/build/vsprops/sdk/unimrcpplugin.vsprops +++ /dev/null @@ -1,12 +0,0 @@ - - - - diff --git a/libs/unimrcp/build/vsprops/sdk/unimrcpsdk.vsprops b/libs/unimrcp/build/vsprops/sdk/unimrcpsdk.vsprops deleted file mode 100644 index f5cd0d311a..0000000000 --- a/libs/unimrcp/build/vsprops/sdk/unimrcpsdk.vsprops +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - diff --git a/libs/unimrcp/build/vsprops/sdk/unimrcpserver.vsprops b/libs/unimrcp/build/vsprops/sdk/unimrcpserver.vsprops deleted file mode 100644 index df5df74f97..0000000000 --- a/libs/unimrcp/build/vsprops/sdk/unimrcpserver.vsprops +++ /dev/null @@ -1,12 +0,0 @@ - - - - diff --git a/libs/unimrcp/build/vsprops/sofiasip.vsprops b/libs/unimrcp/build/vsprops/sofiasip.vsprops deleted file mode 100644 index 2b5b65653b..0000000000 --- a/libs/unimrcp/build/vsprops/sofiasip.vsprops +++ /dev/null @@ -1,16 +0,0 @@ - - - - - diff --git a/libs/unimrcp/build/vsprops/unibase.vsprops b/libs/unimrcp/build/vsprops/unibase.vsprops deleted file mode 100644 index 2d64884ea8..0000000000 --- a/libs/unimrcp/build/vsprops/unibase.vsprops +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - diff --git a/libs/unimrcp/build/vsprops/unibin-x64.vsprops b/libs/unimrcp/build/vsprops/unibin-x64.vsprops deleted file mode 100644 index 6348c8dac2..0000000000 --- a/libs/unimrcp/build/vsprops/unibin-x64.vsprops +++ /dev/null @@ -1,19 +0,0 @@ - - - - - diff --git a/libs/unimrcp/build/vsprops/unibin.vsprops b/libs/unimrcp/build/vsprops/unibin.vsprops deleted file mode 100644 index 016f9973db..0000000000 --- a/libs/unimrcp/build/vsprops/unibin.vsprops +++ /dev/null @@ -1,15 +0,0 @@ - - - - diff --git a/libs/unimrcp/build/vsprops/unidebug.vsprops b/libs/unimrcp/build/vsprops/unidebug.vsprops deleted file mode 100644 index 0cbede51a2..0000000000 --- a/libs/unimrcp/build/vsprops/unidebug.vsprops +++ /dev/null @@ -1,23 +0,0 @@ - - - - - diff --git a/libs/unimrcp/build/vsprops/unilib-x64.vsprops b/libs/unimrcp/build/vsprops/unilib-x64.vsprops deleted file mode 100644 index ba029c0699..0000000000 --- a/libs/unimrcp/build/vsprops/unilib-x64.vsprops +++ /dev/null @@ -1,17 +0,0 @@ - - - - - diff --git a/libs/unimrcp/build/vsprops/unilib.vsprops b/libs/unimrcp/build/vsprops/unilib.vsprops deleted file mode 100644 index 32ea070327..0000000000 --- a/libs/unimrcp/build/vsprops/unilib.vsprops +++ /dev/null @@ -1,13 +0,0 @@ - - - - diff --git a/libs/unimrcp/build/vsprops/unimrcpclient.vsprops b/libs/unimrcp/build/vsprops/unimrcpclient.vsprops deleted file mode 100644 index 8f1edceebd..0000000000 --- a/libs/unimrcp/build/vsprops/unimrcpclient.vsprops +++ /dev/null @@ -1,16 +0,0 @@ - - - - - diff --git a/libs/unimrcp/build/vsprops/unimrcpserver.vsprops b/libs/unimrcp/build/vsprops/unimrcpserver.vsprops deleted file mode 100644 index 8f812676ea..0000000000 --- a/libs/unimrcp/build/vsprops/unimrcpserver.vsprops +++ /dev/null @@ -1,16 +0,0 @@ - - - - - diff --git a/libs/unimrcp/build/vsprops/uniplugin-x64.vsprops b/libs/unimrcp/build/vsprops/uniplugin-x64.vsprops deleted file mode 100644 index 44f4057e3f..0000000000 --- a/libs/unimrcp/build/vsprops/uniplugin-x64.vsprops +++ /dev/null @@ -1,20 +0,0 @@ - - - - - diff --git a/libs/unimrcp/build/vsprops/uniplugin.vsprops b/libs/unimrcp/build/vsprops/uniplugin.vsprops deleted file mode 100644 index a794952a06..0000000000 --- a/libs/unimrcp/build/vsprops/uniplugin.vsprops +++ /dev/null @@ -1,16 +0,0 @@ - - - - diff --git a/libs/unimrcp/build/vsprops/unirelease.vsprops b/libs/unimrcp/build/vsprops/unirelease.vsprops deleted file mode 100644 index bb1f511e93..0000000000 --- a/libs/unimrcp/build/vsprops/unirelease.vsprops +++ /dev/null @@ -1,15 +0,0 @@ - - - - diff --git a/libs/unimrcp/build/vsprops/unirtsp.vsprops b/libs/unimrcp/build/vsprops/unirtsp.vsprops deleted file mode 100644 index b46259472a..0000000000 --- a/libs/unimrcp/build/vsprops/unirtsp.vsprops +++ /dev/null @@ -1,13 +0,0 @@ - - - - diff --git a/libs/unimrcp/conf/Makefile.am b/libs/unimrcp/conf/Makefile.am deleted file mode 100644 index ca84a04bca..0000000000 --- a/libs/unimrcp/conf/Makefile.am +++ /dev/null @@ -1,31 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -CONFFILES = logger.xml dirlayout.xml - -if UNIMRCP_CLIENT_LIB -CONFFILES += unimrcpclient.xml unimrcpclient.xsd -endif - -if UNIMRCP_SERVER_LIB -CONFFILES += unimrcpserver.xml unimrcpserver.xsd -endif - -if UMC -CONFFILES += umcscenarios.xml -endif - -def-conf: - test -d $(DESTDIR)$(sysconfdir) || $(mkinstalldirs) $(DESTDIR)$(sysconfdir) - for conffile in $(CONFFILES) ; do \ - $(INSTALL) -m 644 $(top_srcdir)/conf/$$conffile $(DESTDIR)$(sysconfdir); \ - done -if UNIMRCP_CLIENT_LIB - test -d $(DESTDIR)$(sysconfdir)/client-profiles || $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/client-profiles - for conffile in `find $(top_srcdir)/conf/client-profiles/ -maxdepth 1 -name \*.xml -o -name \*.xsd` ; do \ - filename=`echo $$conffile | sed -e 's|^.*/||'`; \ - $(INSTALL) -m 644 $(top_srcdir)/conf/client-profiles/$$filename $(DESTDIR)$(sysconfdir)/client-profiles; \ - done -endif - -install-data-local: - test -d $(DESTDIR)$(sysconfdir) || $(MAKE) def-conf diff --git a/libs/unimrcp/conf/client-profiles/lumenvox.xml b/libs/unimrcp/conf/client-profiles/lumenvox.xml deleted file mode 100644 index 4b592a5450..0000000000 --- a/libs/unimrcp/conf/client-profiles/lumenvox.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - 5060 - - - - - - - - 554 - - - - - - - - - - - - SIP-Agent-1 - MRCPv2-Agent-1 - Media-Engine-1 - RTP-Factory-1 - LumenVox-SIP-Settings - RTP-Settings-1 - - - - - RTSP-Agent-1 - Media-Engine-1 - RTP-Factory-1 - LumenVox-RTSP-Settings - RTP-Settings-1 - - - - - diff --git a/libs/unimrcp/conf/client-profiles/nuance.xml b/libs/unimrcp/conf/client-profiles/nuance.xml deleted file mode 100644 index 8725703ab0..0000000000 --- a/libs/unimrcp/conf/client-profiles/nuance.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - - 5060 - - - - - - - - - 4900 - - media - - - - - - - - - - 1 - 50 - 600 - 1 - - 20 - PCMU PCMA L16/96/8000 telephone-event/101/8000 - - - - 2 - - 5000 - - 1000 - - - - - - - - - SIP-Agent-1 - MRCPv2-Agent-1 - Media-Engine-1 - RTP-Factory-1 - Nuance-SIP-Settings - Nuance-RTP-Settings - - - - - RTSP-Agent-1 - Media-Engine-1 - RTP-Factory-1 - Nuance-RTSP-Settings - Nuance-RTP-Settings - - - - - diff --git a/libs/unimrcp/conf/client-profiles/speechpro.xml b/libs/unimrcp/conf/client-profiles/speechpro.xml deleted file mode 100644 index 9f765bef61..0000000000 --- a/libs/unimrcp/conf/client-profiles/speechpro.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - 8000 - - - - - - - - - - - - - RTSP-Agent-1 - Media-Engine-1 - RTP-Factory-1 - SpeechPro-RTSP-Settings - RTP-Settings-1 - - - - - diff --git a/libs/unimrcp/conf/client-profiles/unimrcp.xml b/libs/unimrcp/conf/client-profiles/unimrcp.xml deleted file mode 100644 index e29d8784fd..0000000000 --- a/libs/unimrcp/conf/client-profiles/unimrcp.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - 8060 - - - - - - - - 1554 - - media - - - - - - - - - - - SIP-Agent-1 - MRCPv2-Agent-1 - Media-Engine-1 - RTP-Factory-1 - UniMRCP-SIP-Settings - RTP-Settings-1 - - - - - RTSP-Agent-1 - Media-Engine-1 - RTP-Factory-1 - UniMRCP-RTSP-Settings - RTP-Settings-1 - - - - - diff --git a/libs/unimrcp/conf/dirlayout.xml b/libs/unimrcp/conf/dirlayout.xml deleted file mode 100644 index 45df55ba7e..0000000000 --- a/libs/unimrcp/conf/dirlayout.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - conf - plugin - log - data - var - diff --git a/libs/unimrcp/conf/logger.xml b/libs/unimrcp/conf/logger.xml deleted file mode 100644 index 73ae9b5cac..0000000000 --- a/libs/unimrcp/conf/logger.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - INFO - - - CONSOLE - - - DATE,TIME,PRIORITY - - - NONE - diff --git a/libs/unimrcp/conf/umcscenarios.xml b/libs/unimrcp/conf/umcscenarios.xml deleted file mode 100644 index d5c713e201..0000000000 --- a/libs/unimrcp/conf/umcscenarios.xml +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/conf/unimrcpclient.xml b/libs/unimrcp/conf/unimrcpclient.xml deleted file mode 100644 index cc23b9bc03..0000000000 --- a/libs/unimrcp/conf/unimrcpclient.xml +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 8062 - udp - UniMRCP SofiaSIP - UniMRCPClient - - - - - - - - - - - 100 - - UniMRCPClient - - - - - 100 - false - 1024 - 1024 - - - - - - 1 - - - - - - - - 4000 - 5000 - - - - - - - - 1 - 50 - 600 - 1 - - 20 - PCMU PCMA L16/96/8000 telephone-event/101/8000 - - - - - 1 - - 5000 - - 1000 - - - - diff --git a/libs/unimrcp/conf/unimrcpclient.xsd b/libs/unimrcp/conf/unimrcpclient.xsd deleted file mode 100644 index b8e53bbf1f..0000000000 --- a/libs/unimrcp/conf/unimrcpclient.xsd +++ /dev/null @@ -1,277 +0,0 @@ - - - - - UniMRCP client document - - - - - - Generic properties - - - - - - - - - - - - - - - - - - - - - - - - Common components - - - - - - Factory of MRCP resources - - - - - - - - - - - - - - - SIP signaling agent - - - - - - - - - - - - - - - - - - - - - - - - RTSP signaling agent - - - - - - - - - - - - - - - MRCPv2 connection agent - - - - - - - - - - - - - - - - Media processing engine - - - - - - - - - - - - Factory of RTP terminations - - - - - - - - - - - - - - - - - - Settings - - - - - - SIP settings - - - - - - - - - - - - - - - RTSP settings - - - - - - - - - - - - - - - - - - - - - - - - - - - RTP settings - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Profiles - - - - - - MRCPv2 profile - - - - - - - - - - - - - - - - - MRCPv1 profile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/conf/unimrcpserver.xml b/libs/unimrcp/conf/unimrcpserver.xml deleted file mode 100644 index b431acf313..0000000000 --- a/libs/unimrcp/conf/unimrcpserver.xml +++ /dev/null @@ -1,166 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 8060 - udp,tcp - - UniMRCP SofiaSIP - UniMRCPServer - - - - - - - - - - - - - - 1554 - - - - - - 100 - UniMRCPServer - - - - - - - 1544 - 100 - false - 1024 - 1024 - - - - - 1 - - - - - - - - 5000 - 6000 - - - - - - - - - - - - - - - - - - 1 - 50 - 600 - 1 - - 20 - PCMU PCMA L16/96/8000 telephone-event/101/8000 - - - - - 1 - - 5000 - - 1000 - - - - - - - - - SIP-Agent-1 - MRCPv2-Agent-1 - Media-Engine-1 - RTP-Factory-1 - RTP-Settings-1 - - - - - - - RTSP-Agent-1 - Media-Engine-1 - RTP-Factory-1 - RTP-Settings-1 - - - - - diff --git a/libs/unimrcp/conf/unimrcpserver.xsd b/libs/unimrcp/conf/unimrcpserver.xsd deleted file mode 100644 index f8222c84d5..0000000000 --- a/libs/unimrcp/conf/unimrcpserver.xsd +++ /dev/null @@ -1,277 +0,0 @@ - - - - - UniMRCP server document - - - - - - Generic properties - - - - - - - - - - - - - - - - - - - Common components - - - - - - Factory of MRCP resources - - - - - - - - - - - - - - - SIP signaling agent - - - - - - - - - - - - - - - - - - - - - - - - - RTSP signaling agent - - - - - - - - - - - - - - - - - - - - - - - - - - - - - MRCPv2 connection agent - - - - - - - - - - - - - - - - - Media processing engine - - - - - - - - - - - - Factory of RTP terminations - - - - - - - - - - - - - - - Factory of plugins (MRCP engines) - - - - - - - - - - - - - - - - - - - - - - - - - - - - Settings - - - - - - RTP settings - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Profiles - - - - - - MRCPv2 profile - - - - - - - - - - - - - - - - MRCPv1 profile - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/config.layout b/libs/unimrcp/config.layout deleted file mode 100644 index 1d3472c1e9..0000000000 --- a/libs/unimrcp/config.layout +++ /dev/null @@ -1,26 +0,0 @@ -## -## config.layout -- Pre-defined Installation Path Layouts -## -## Hints: -## - layouts can be loaded with configure's --enable-layout=ID option -## - when no --enable-layout option is given, the default layout is `classic' - -# Classical UniMRCP path layout. - - prefix: /usr/local/unimrcp - exec_prefix: ${prefix} - bindir: ${exec_prefix}/bin - sbindir: ${exec_prefix}/bin - libdir: ${exec_prefix}/lib - libexecdir: ${exec_prefix}/modules - mandir: ${prefix}/man - sysconfdir: ${prefix}/conf - confdir: ${prefix}/conf - datadir: ${prefix}/data - plugindir: ${exec_prefix}/plugin - logdir: ${exec_prefix}/log - vardir: ${exec_prefix}/var - installbuilddir: ${exec_prefix}/build - includedir: ${prefix}/include - localstatedir: ${prefix} - diff --git a/libs/unimrcp/configure.ac b/libs/unimrcp/configure.ac deleted file mode 100644 index 851f56d71b..0000000000 --- a/libs/unimrcp/configure.ac +++ /dev/null @@ -1,285 +0,0 @@ -dnl -dnl Autoconf configuration file for UniMRCP. -dnl -dnl Use ./bootstrap to produce a configure script. -dnl - -AC_PREREQ(2.59) - -AC_INIT([unimrcp],[1.2.0]) - -AC_CONFIG_AUX_DIR([build]) -AC_CONFIG_MACRO_DIR([build/acmacros]) - -dnl Set ac_macro_dir variable manually for autoconf 2.61 and above. -ac_macro_dir="build/acmacros" - -AC_SUBST(ac_aux_dir) -AC_SUBST(ac_macro_dir) - -dnl Include m4 macros for libtool 2. -sinclude(build/acmacros/libtool.m4) -sinclude(build/acmacros/ltoptions.m4) -sinclude(build/acmacros/ltsugar.m4) -sinclude(build/acmacros/ltversion.m4) -sinclude(build/acmacros/lt~obsolete.m4) - -AC_PREFIX_DEFAULT(/usr/local/unimrcp) - -dnl Define the directory layout. -APR_ENABLE_LAYOUT(classic, [plugindir logdir vardir]) -AC_SUBST(plugindir) -AC_SUBST(logdir) -AC_SUBST(vardir) - -dnl Reparse the configure arguments. -APR_PARSE_ARGUMENTS - -dnl Generate ./config.nice to reuse ./configure command-line. -APR_CONFIG_NICE(config.nice) - -AM_INIT_AUTOMAKE([no-define nostdinc foreign subdir-objects]) - -dnl Enable silent build rules available since automake 1.11. -m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) - -dnl Set default language. -AC_LANG_C - -AC_PROG_CC -AC_PROG_CXX -AM_PROG_CC_C_O -AC_PROG_INSTALL - -dnl Skip detection of Fortran. -m4_undefine([AC_PROG_F77]) -m4_defun([AC_PROG_F77],[]) -AC_PROG_LIBTOOL - -dnl Do not use autoconf generated compiler DEFS. -rm confdefs.h -touch confdefs.h - -dnl Check for C compiler vendor. -AX_COMPILER_VENDOR - -dnl Search for pkg-config. -AC_PATH_PROG(PKG_CONFIG, pkg-config) - -dnl Get version information. -get_version="$srcdir/build/get-version.sh" -version_hdr="$srcdir/build/uni_version.h" -plugin_version_hdr="$srcdir/libs/mrcp-engine/include/mrcp_engine_plugin.h" -UNI_DOTTED_VERSION="`$get_version all $version_hdr UNI`" -UNI_LT_VERSION="-version-info `$get_version libtool $version_hdr UNI`" -PLUGIN_LT_VERSION="-version-info `$get_version libtool $plugin_version_hdr PLUGIN`" - -AC_SUBST(UNI_DOTTED_VERSION) -AC_SUBST(UNI_LT_VERSION) -AC_SUBST(PLUGIN_LT_VERSION) - -echo "UniMRCP Version: ${UNI_DOTTED_VERSION}" - -dnl Check for the APR and APR-util libraries. -UNIMRCP_CHECK_APR -dnl Check for the Sofia-SIP library. -UNIMRCP_CHECK_SOFIA - -dnl Enable inter-library dependencies. -AC_ARG_ENABLE(interlib-deps, - [AC_HELP_STRING([--disable-interlib-deps ],[disable inter-library dependencies (might break builds)])], - [enable_interlib_deps="$enableval"], - [enable_interlib_deps="yes"]) - -AC_MSG_NOTICE([enable inter-library dependencies: $enable_interlib_deps]) -if test "${enable_interlib_deps}" = "yes"; then - link_all_deplibs=yes - link_all_deplibs_CXX=yes -else - link_all_deplibs=no - link_all_deplibs_CXX=no -fi - -dnl Enable maintainer mode. -AC_ARG_ENABLE(maintainer-mode, - [AC_HELP_STRING([--enable-maintainer-mode ],[turn on debugging and compile time warnings])], - [enable_maintainer_mode="$enableval"], - [enable_maintainer_mode="no"]) - -AC_MSG_NOTICE([enable maintainer mode: $enable_maintainer_mode]) -if test "${enable_maintainer_mode}" != "no"; then - APR_ADDTO(CFLAGS,-g) - if test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then - APR_ADDTO(CFLAGS,-Wall -Werror) - fi -fi - -dnl UniMRCP client library. -AC_ARG_ENABLE(client-lib, - [AC_HELP_STRING([--disable-client-lib ],[exclude unimrcpclient lib from build])], - [enable_client_lib="$enableval"], - [enable_client_lib="yes"]) - -AM_CONDITIONAL([UNIMRCP_CLIENT_LIB],[test "${enable_client_lib}" = "yes"]) - -dnl Sample UniMRCP client application in C. -AC_ARG_ENABLE(client-app, - [AC_HELP_STRING([--disable-client-app ],[exclude sample unimrcpclient app from build])], - [enable_client_app="$enableval"], - [enable_client_app="yes"]) - -AM_CONDITIONAL([UNIMRCP_CLIENT_APP],[test "${enable_client_lib}" = "yes" && test "${enable_client_app}" = "yes"]) - -dnl Sample UniMRCP client application in C++. -AC_ARG_ENABLE(umc, - [AC_HELP_STRING([--disable-umc ],[exclude sample unimrcpclient C++ app from build])], - [enable_umc="$enableval"], - [enable_umc="yes"]) - -AM_CONDITIONAL([UMC],[test "${enable_client_lib}" = "yes" && test "${enable_umc}" = "yes"]) - -dnl Miscellaneous ASR client library and application. -AC_ARG_ENABLE(asr-client, - [AC_HELP_STRING([--disable-asr-client ],[exclude misc ASR client lib and app from build])], - [enable_asr_client="$enableval"], - [enable_asr_client="yes"]) - -AM_CONDITIONAL([ASR_CLIENT],[test "${enable_client_lib}" = "yes" && test "${enable_asr_client}" = "yes"]) - -AM_CONDITIONAL([COMMON_CLIENT_DATA],[test "${enable_client_app}" = "yes" || test "${enable_umc}" = "yes" ||test "${enable_asr_client}" = "yes"]) - -dnl UniMRCP server library. -AC_ARG_ENABLE(server-lib, - [AC_HELP_STRING([--disable-server-lib ],[exclude unimrcpserver lib from build])], - [enable_server_lib="$enableval"], - [enable_server_lib="yes"]) - -AM_CONDITIONAL([UNIMRCP_SERVER_LIB],[test "${enable_server_lib}" = "yes"]) - -dnl UniMRCP server application. -AC_ARG_ENABLE(server-app, - [AC_HELP_STRING([--disable-server-app ],[exclude unimrcpserver app from build])], - [enable_server_app="$enableval"], - [enable_server_app="yes"]) - -AM_CONDITIONAL([UNIMRCP_SERVER_APP],[test "${enable_server_lib}" = "yes" && test "${enable_server_app}" = "yes"]) - -dnl Demo synthesizer plugin. -UNI_PLUGIN_ENABLED(demosynth) - -AM_CONDITIONAL([DEMOSYNTH_PLUGIN],[test "${enable_demosynth_plugin}" = "yes"]) - -dnl Demo recognizer plugin. -UNI_PLUGIN_ENABLED(demorecog) - -AM_CONDITIONAL([DEMORECOG_PLUGIN],[test "${enable_demorecog_plugin}" = "yes"]) - -dnl Demo verifier plugin. -UNI_PLUGIN_ENABLED(demoverifier) - -AM_CONDITIONAL([DEMOVERIFIER_PLUGIN],[test "${enable_demoverifier_plugin}" = "yes"]) - -dnl Recorder plugin. -UNI_PLUGIN_ENABLED(recorder) - -AM_CONDITIONAL([RECORDER_PLUGIN],[test "${enable_recorder_plugin}" = "yes"]) - -dnl Enable test suites. -AC_ARG_ENABLE(test-suites, - [AC_HELP_STRING([--enable-test-suites ],[build test suites])], - [enable_test_suites="$enableval"], - [enable_test_suites="no"]) - -# Enable clang address sanitizer bit build -AC_ARG_ENABLE(address_sanitizer, - [AC_HELP_STRING([--enable-address-sanitizer],[build with address sanitizer])], - [enable_address_sanitizer="$enable_address_sanitizer"], - [enable_address_sanitizer="no"]) - -if test "${enable_address_sanitizer}" = "yes"; then - APR_ADDTO(CFLAGS, -fsanitize=address -fno-omit-frame-pointer) - APR_ADDTO(CXXFLAGS, -fsanitize=address -fno-omit-frame-pointer) - APR_ADDTO(LDFLAGS, -fsanitize=address) -fi - -AM_CONDITIONAL([TEST_SUITES],[test "${enable_test_suites}" != "no"]) - -AM_CONDITIONAL(ISMAC, [test `uname -s` = Darwin]) - -AC_CONFIG_FILES([ - Makefile - libs/Makefile - libs/apr-toolkit/Makefile - libs/mpf/Makefile - libs/mrcp/Makefile - libs/mrcp-signaling/Makefile - libs/mrcpv2-transport/Makefile - libs/mrcp-engine/Makefile - libs/mrcp-server/Makefile - libs/mrcp-client/Makefile - libs/uni-rtsp/Makefile - modules/Makefile - modules/mrcp-sofiasip/Makefile - modules/mrcp-unirtsp/Makefile - plugins/Makefile - plugins/mrcp-recorder/Makefile - plugins/demo-synth/Makefile - plugins/demo-recog/Makefile - plugins/demo-verifier/Makefile - platforms/Makefile - platforms/libunimrcp-server/Makefile - platforms/libunimrcp-client/Makefile - platforms/unimrcp-server/Makefile - platforms/unimrcp-client/Makefile - platforms/libasr-client/Makefile - platforms/asr-client/Makefile - platforms/umc/Makefile - tests/Makefile - tests/apttest/Makefile - tests/mpftest/Makefile - tests/mrcptest/Makefile - tests/rtsptest/Makefile - tests/strtablegen/Makefile - build/Makefile - build/pkgconfig/Makefile - build/pkgconfig/unimrcpclient.pc - build/pkgconfig/unimrcpserver.pc - build/pkgconfig/unimrcpplugin.pc - conf/Makefile - data/Makefile - docs/doxygen.conf -]) - -AC_OUTPUT - -echo -echo '****************************** REPORT ******************************' -echo -echo UniMRCP version............... : $UNI_DOTTED_VERSION -echo -echo APR version................... : $apr_version -echo APR-util version.............. : $apu_version -echo Sofia-SIP version............. : $sofia_version -echo -echo Compiler...................... : $CC -echo Compiler flags................ : $CFLAGS -echo Preprocessor definitions...... : $CPPFLAGS -echo Linker flags.................. : $LDFLAGS -echo -echo UniMRCP client lib............ : $enable_client_lib -echo Sample UniMRCP client app..... : $enable_client_app -echo Sample UMC C++ client app..... : $enable_umc -echo Misc ASR client lib and app... : $enable_asr_client -echo -echo UniMRCP server lib............ : $enable_server_lib -echo UniMRCP server app............ : $enable_server_app -echo -echo Demo synthesizer plugin....... : $enable_demosynth_plugin -echo Demo recognizer plugin........ : $enable_demorecog_plugin -echo Demo verifier plugin.......... : $enable_demoverifier_plugin -echo Recorder plugin............... : $enable_recorder_plugin -echo -echo Installation layout........... : $layout_name -echo Installation directory........ : $prefix -echo -echo '********************************************************************' diff --git a/libs/unimrcp/configure.gnu b/libs/unimrcp/configure.gnu deleted file mode 100755 index eaca53b7f7..0000000000 --- a/libs/unimrcp/configure.gnu +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -srcpath=$(dirname $0 2>/dev/null ) || srcpath="." -$srcpath/configure "$@" --with-apr=../apr --disable-shared --with-pic --with-apr-util=../apr-util --with-sofia-sip=/usr diff --git a/libs/unimrcp/data/Makefile.am b/libs/unimrcp/data/Makefile.am deleted file mode 100644 index 60b540646b..0000000000 --- a/libs/unimrcp/data/Makefile.am +++ /dev/null @@ -1,31 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -DATAFILES = - -if COMMON_CLIENT_DATA -DATAFILES += grammar.jsgf grammar.mixed grammar.srgs grammar.xml \ - speak.txt speak.xml \ - one-16kHz.pcm one-8kHz.pcm \ - johnsmith-16kHz.pcm johnsmith-8kHz.pcm -endif - -if DEMOSYNTH_PLUGIN -DATAFILES += demo-16kHz.pcm demo-8kHz.pcm -endif - -if DEMORECOG_PLUGIN -DATAFILES += result.xml -endif - -if DEMOVERIFIER_PLUGIN -DATAFILES += result-verification.xml -endif - -def-data: - test -d $(DESTDIR)$(datadir) || $(mkinstalldirs) $(DESTDIR)$(datadir) - for datafile in $(DATAFILES) ; do \ - $(INSTALL) -m 644 $(top_srcdir)/data/$$datafile $(DESTDIR)$(datadir); \ - done - -install-data-local: - test -d $(DESTDIR)$(datadir) || $(MAKE) def-data diff --git a/libs/unimrcp/data/demo-16kHz.pcm b/libs/unimrcp/data/demo-16kHz.pcm deleted file mode 100644 index 5341461c25df7f50f246e75e41748b576eea5431..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 70444 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 diff --git a/libs/unimrcp/data/grammar.jsgf b/libs/unimrcp/data/grammar.jsgf deleted file mode 100644 index 9257ecdca2..0000000000 --- a/libs/unimrcp/data/grammar.jsgf +++ /dev/null @@ -1,3 +0,0 @@ -#JSGF V1.0; -grammar digits; -public = (one | two | three); diff --git a/libs/unimrcp/data/grammar.mixed b/libs/unimrcp/data/grammar.mixed deleted file mode 100644 index dabe3a1c88..0000000000 --- a/libs/unimrcp/data/grammar.mixed +++ /dev/null @@ -1,19 +0,0 @@ - ---break -Content-Type:text/uri-list -Content-Length: 22 - -builtin:grammar/digits - ---break -Content-Type:application/srgs+xml -Content-Length: 230 - - - - - one two three four five - - ---break-- \ No newline at end of file diff --git a/libs/unimrcp/data/grammar.srgs b/libs/unimrcp/data/grammar.srgs deleted file mode 100644 index 6457d725d3..0000000000 --- a/libs/unimrcp/data/grammar.srgs +++ /dev/null @@ -1,4 +0,0 @@ -#ABNF 1.0; -language en-US; -mode voice; -public $digit = one | two | three; \ No newline at end of file diff --git a/libs/unimrcp/data/grammar.xml b/libs/unimrcp/data/grammar.xml deleted file mode 100644 index a6dbf88fa3..0000000000 --- a/libs/unimrcp/data/grammar.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - one - two - three - - - \ No newline at end of file diff --git a/libs/unimrcp/data/johnsmith-16kHz.pcm b/libs/unimrcp/data/johnsmith-16kHz.pcm deleted file mode 100644 index 235338077d8e1351bf6bab14ae6a3275d0271914..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 33214 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 RU;7#PPy7Fr%^wLv{2$A$1%?0s diff --git a/libs/unimrcp/data/johnsmith-8kHz.pcm b/libs/unimrcp/data/johnsmith-8kHz.pcm deleted file mode 100644 index 8332f4073271869feb40e757b8d2942c69648e5e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16000 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 diff --git a/libs/unimrcp/data/one-16kHz.pcm b/libs/unimrcp/data/one-16kHz.pcm deleted file mode 100644 index 44e0b3431a17b81373af5eb6fc6df6ff7528b58a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 64508 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

meF} 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 XphBQRphBQRphBQRphDpP00RF5%|jb; diff --git a/libs/unimrcp/data/result-verification.xml b/libs/unimrcp/data/result-verification.xml deleted file mode 100644 index 8ab8a32fb6..0000000000 --- a/libs/unimrcp/data/result-verification.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - 500 - cellular-phone - male - accepted - 0.85 - - - 1500 - cellular-phone - male - accepted - 0.75 - - - - \ No newline at end of file diff --git a/libs/unimrcp/data/result.xml b/libs/unimrcp/data/result.xml deleted file mode 100644 index 74a1171e3c..0000000000 --- a/libs/unimrcp/data/result.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - one - one - - \ No newline at end of file diff --git a/libs/unimrcp/data/speak.txt b/libs/unimrcp/data/speak.txt deleted file mode 100644 index 894d43a75f..0000000000 --- a/libs/unimrcp/data/speak.txt +++ /dev/null @@ -1 +0,0 @@ -Welcome to Uni MRCP. \ No newline at end of file diff --git a/libs/unimrcp/data/speak.xml b/libs/unimrcp/data/speak.xml deleted file mode 100644 index 2a49ff048c..0000000000 --- a/libs/unimrcp/data/speak.xml +++ /dev/null @@ -1,6 +0,0 @@ - - -

- Welcome to Uni MRCP. -

-
\ No newline at end of file diff --git a/libs/unimrcp/docs/doxygen.conf.in b/libs/unimrcp/docs/doxygen.conf.in deleted file mode 100644 index b405be48f0..0000000000 --- a/libs/unimrcp/docs/doxygen.conf.in +++ /dev/null @@ -1,34 +0,0 @@ -PROJECT_NAME="UniMRCP" -PROJECT_NUMBER = @VERSION@ - -INPUT=. docs/mainpage.docs -QUIET=YES -RECURSIVE=YES -FILE_PATTERNS=*.h - -OUTPUT_DIRECTORY=docs/dox - -MACRO_EXPANSION=YES -EXPAND_ONLY_PREDEF=YES - -PREDEFINED="APT_DECLARE(x)=x" \ - "MPF_DECLARE(x)=x" \ - "MRCP_DECLARE(x)=x" \ - "RTSP_DECLARE(x)=x" - -OPTIMIZE_OUTPUT_FOR_C=YES -STRIP_CODE_COMMENTS=NO - -FULL_PATH_NAMES=NO -CASE_SENSE_NAMES=NO - -EXCLUDE=platforms/umc platforms/libasr-client platforms/asr-client -EXCLUDE_PATTERNS="*/acconfig.h" \ - "*/test/*" \ - "*/arch/*" - -GENERATE_HTML=YES -GENERATE_LATEX=NO -GENERATE_RTF=NO -GENERATE_MAN=NO -GENERATE_XML=NO diff --git a/libs/unimrcp/docs/mainpage.docs b/libs/unimrcp/docs/mainpage.docs deleted file mode 100644 index 7081702f57..0000000000 --- a/libs/unimrcp/docs/mainpage.docs +++ /dev/null @@ -1,71 +0,0 @@ -/** -@mainpage UniMRCP API Reference - -
-@section Introduction - -UniMRCP is an open source project compliant with the IETF RFC6787 (MRCPv2) and RFC4463 (MRCPv1) specifications. -The project encapsulates SIP, RTSP, SDP, MRCPv2, and RTP/RTCP stacks and provides integrators with a protocol version consistent interface. - -- Compliance: MRCPv1, MRCPv2 (client and server) -- Resources: Synthesizer (TTS), Recognizer (ASR), Verifier (SVI), Recorder -- License: Apache 2.0 -- OS: Cross-platform (Windows, Linux, ...) -- Language: C, C++ -
-
-@section _ Source Tree Structure - -
-@subsection Libraries - -- apr-toolkit - Set of utilities built on top of the APR and APR-util libraries (task abstraction, logging, etc). -- mpf - Media processing framework. -- mrcp - Implementation of MRCP basics (message, parser, resources). -- mrcpv2-transport - Implementation of the MRCPv2 transport layer. -- mrcp-signaling - Abstract MRCP signaling (session management) interface. -- mrcp-engine - Abstract resource engine interface. -- mrcp-client - Implementation of an MRCP client stack based on the abstract signaling interface. -- mrcp-server - Implementation of an MRCP server stack based on the abstract signaling and engine interfaces. -- uni-rtsp - Implementation of a minimal RTSP stack required for MRCPv1. - -
-@subsection Modules - -- mrcp-sofiasip - Implementation of the abstract signaling interface using the SofiaSIP library. -- mrcp-unirtsp - Implementation of the abstract signaling interface using the UniRTSP library. - -
-@subsection Plugins - -- demo-synth - Implementation of a TTS plugin which simulates synthesis. -- demo-recog - Implementation of an ASR plugin which simulates recognition. -- demo-verif - Implementation of an SVI plugin which simulates speaker verification. -- mrcp-recorder - Implementation of a recorder plugin. - -
-@subsection Platforms - -- libunimrcpclient - The UniMRCP client stack built on top of the underlying mrcp-client library using the mrcp-sofiasip and mrcp-unirtsp modules. -- libunimrcpserver - The UniMRCP server stack based on top of the underlying mrcp-server library using the mrcp-sofiasip and mrcp-unirtsp modules. -- unimrcpclient - Sample C application based on the UniMRCP client stack. -- umc - Sample C++ application based on the UniMRCP client stack. -- unimrcpserver - The UniMRCP server application. - -
-@section Dependencies - -- APR - Apache Portable Runtime Library -- Sofia-SIP - SIP User Agent Library - -
-@section Project Links - -- Website -- Downloads -- Documentation -- Issue Tracker -- Discussion Group -
- -*/ diff --git a/libs/unimrcp/libs/Makefile.am b/libs/unimrcp/libs/Makefile.am deleted file mode 100644 index ce33be3016..0000000000 --- a/libs/unimrcp/libs/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -SUBDIRS = apr-toolkit mpf mrcp mrcp-signaling mrcpv2-transport mrcp-engine mrcp-server mrcp-client uni-rtsp diff --git a/libs/unimrcp/libs/apr-toolkit/Makefile.am b/libs/unimrcp/libs/apr-toolkit/Makefile.am deleted file mode 100644 index aed07a7fb2..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/Makefile.am +++ /dev/null @@ -1,50 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -AM_CPPFLAGS = -I$(top_srcdir)/libs/apr-toolkit/include \ - $(UNIMRCP_APR_INCLUDES) - -noinst_LTLIBRARIES = libaprtoolkit.la - -include_HEADERS = include/apt.h \ - include/apt_obj_list.h \ - include/apt_cyclic_queue.h \ - include/apt_dir_layout.h \ - include/apt_task.h \ - include/apt_task_msg.h \ - include/apt_consumer_task.h \ - include/apt_pollset.h \ - include/apt_poller_task.h \ - include/apt_pool.h \ - include/apt_log.h \ - include/apt_pair.h \ - include/apt_string.h \ - include/apt_string_table.h \ - include/apt_header_field.h \ - include/apt_text_stream.h \ - include/apt_text_message.h \ - include/apt_net.h \ - include/apt_nlsml_doc.h \ - include/apt_multipart_content.h \ - include/apt_timer_queue.h \ - include/apt_test_suite.h - -libaprtoolkit_la_SOURCES = src/apt_obj_list.c \ - src/apt_cyclic_queue.c \ - src/apt_dir_layout.c \ - src/apt_task.c \ - src/apt_task_msg.c \ - src/apt_consumer_task.c \ - src/apt_pollset.c \ - src/apt_poller_task.c \ - src/apt_pool.c \ - src/apt_log.c \ - src/apt_pair.c \ - src/apt_string_table.c \ - src/apt_header_field.c \ - src/apt_text_stream.c \ - src/apt_text_message.c \ - src/apt_net.c \ - src/apt_nlsml_doc.c \ - src/apt_multipart_content.c \ - src/apt_timer_queue.c \ - src/apt_test_suite.c diff --git a/libs/unimrcp/libs/apr-toolkit/aprtoolkit.2017.vcxproj b/libs/unimrcp/libs/apr-toolkit/aprtoolkit.2017.vcxproj deleted file mode 100644 index 804f4ee41e..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/aprtoolkit.2017.vcxproj +++ /dev/null @@ -1,167 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - aprtoolkit - {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2} - aprtoolkit - Win32Proj - - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(SolutionDir)$(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(SolutionDir)$(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - - - - APT_STATIC_LIB;%(PreprocessorDefinitions) - - - - - X64 - - - APT_STATIC_LIB;%(PreprocessorDefinitions) - ProgramDatabase - - - - - APT_STATIC_LIB;%(PreprocessorDefinitions) - - - - - X64 - - - APT_STATIC_LIB;%(PreprocessorDefinitions) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {f057da7f-79e5-4b00-845c-ef446ef055e3} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcproj b/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcproj deleted file mode 100644 index bb2746e815..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcproj +++ /dev/null @@ -1,417 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcxproj b/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcxproj deleted file mode 100644 index 29980e1941..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcxproj +++ /dev/null @@ -1,139 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2} - aprtoolkit - Win32Proj - - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcxproj.filters b/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcxproj.filters deleted file mode 100644 index 3a67d6084e..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcxproj.filters +++ /dev/null @@ -1,143 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {4e9335ac-20e8-4284-ad77-20ad9190c94d} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt.h b/libs/unimrcp/libs/apr-toolkit/include/apt.h deleted file mode 100644 index a25a6e28f1..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef APT_H -#define APT_H - -/** - * @file apt.h - * @brief APR Toolkit Definitions - */ - -#include -#include -#include - -#ifdef __cplusplus -/** Begin of extern "C" block */ -#define APT_BEGIN_EXTERN_C extern "C" { -/** End of extern "C" block */ -#define APT_END_EXTERN_C } -#else -/** Begin of extern "C" block */ -#define APT_BEGIN_EXTERN_C -/** End of extern "C" block */ -#define APT_END_EXTERN_C -#endif - -/** Lib export/import defines (win32) */ -#ifdef WIN32 -#ifdef APT_STATIC_LIB -#define APT_DECLARE(type) type __stdcall -#else -#ifdef APT_LIB_EXPORT -#define APT_DECLARE(type) __declspec(dllexport) type __stdcall -#else -#define APT_DECLARE(type) __declspec(dllimport) type __stdcall -#endif -#endif -#else -#define APT_DECLARE(type) type -#endif - -/** Boolean value */ -typedef int apt_bool_t; - -#endif /* APT_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_consumer_task.h b/libs/unimrcp/libs/apr-toolkit/include/apt_consumer_task.h deleted file mode 100644 index 2f33426737..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_consumer_task.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_consumer_task.h 2175 2014-09-12 04:56:09Z achaloyan@gmail.com $ - */ - -#ifndef APT_CONSUMER_TASK_H -#define APT_CONSUMER_TASK_H - -/** - * @file apt_consumer_task.h - * @brief Consumer Task Definition - */ - -#include "apt_task.h" -#include "apt_timer_queue.h" - -APT_BEGIN_EXTERN_C - -/** Opaque consumer task declaration */ -typedef struct apt_consumer_task_t apt_consumer_task_t; - -/** - * Create consumer task. - * @param obj the external object to associate with the task - * @param msg_pool the pool of task messages - * @param pool the pool to allocate memory from - */ -APT_DECLARE(apt_consumer_task_t*) apt_consumer_task_create( - void *obj, - apt_task_msg_pool_t *msg_pool, - apr_pool_t *pool); - -/** - * Get task base. - * @param task the consumer task to get base for - */ -APT_DECLARE(apt_task_t*) apt_consumer_task_base_get(const apt_consumer_task_t *task); - -/** - * Get task vtable. - * @param task the consumer task to get vtable for - */ -APT_DECLARE(apt_task_vtable_t*) apt_consumer_task_vtable_get(const apt_consumer_task_t *task); - -/** - * Get consumer task object. - * @param task the consumer task to get object from - */ -APT_DECLARE(void*) apt_consumer_task_object_get(const apt_consumer_task_t *task); - -/** - * Create timer. - * @param task the consumer task to create timer for - * @param proc the timer callback - * @param obj the object to pass to callback - * @param pool the pool to allocate memory from - */ -APT_DECLARE(apt_timer_t*) apt_consumer_task_timer_create( - apt_consumer_task_t *task, - apt_timer_proc_f proc, - void *obj, - apr_pool_t *pool); - -APT_END_EXTERN_C - -#endif /* APT_CONSUMER_TASK_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_cyclic_queue.h b/libs/unimrcp/libs/apr-toolkit/include/apt_cyclic_queue.h deleted file mode 100644 index bf803e2dde..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_cyclic_queue.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_cyclic_queue.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef APT_CYCLIC_QUEUE_H -#define APT_CYCLIC_QUEUE_H - -/** - * @file apt_cyclic_queue.h - * @brief Cyclic FIFO Queue of Opaque void* Objects - */ - -#include "apt.h" - -APT_BEGIN_EXTERN_C - -/** Default size (number of elements) of cyclic queue */ -#define CYCLIC_QUEUE_DEFAULT_SIZE 100 - -/** Opaque cyclic queue declaration */ -typedef struct apt_cyclic_queue_t apt_cyclic_queue_t; - -/** - * Create cyclic queue. - * @param size the initial size of the queue - * @return the created queue - */ -APT_DECLARE(apt_cyclic_queue_t*) apt_cyclic_queue_create(apr_size_t size); - -/** - * Destroy cyclic queue. - * @param queue the queue to destroy - */ -APT_DECLARE(void) apt_cyclic_queue_destroy(apt_cyclic_queue_t *queue); - -/** - * Push object to the queue. - * @param queue the queue to push object to - * @param obj the object to push - */ -APT_DECLARE(apt_bool_t) apt_cyclic_queue_push(apt_cyclic_queue_t *queue, void *obj); - -/** - * Pop object from the queue. - * @param queue the queue to pop message from - */ -APT_DECLARE(void*) apt_cyclic_queue_pop(apt_cyclic_queue_t *queue); - -/** - * Clear the queue (remove all the elements from the queue). - * @param queue the queue to clear - */ -APT_DECLARE(void) apt_cyclic_queue_clear(apt_cyclic_queue_t *queue); - -/** - * Query whether the queue is empty. - * @param queue the queue to query - * @return TRUE if empty, otherwise FALSE - */ -APT_DECLARE(apt_bool_t) apt_cyclic_queue_is_empty(const apt_cyclic_queue_t *queue); - - -APT_END_EXTERN_C - -#endif /* APT_CYCLIC_QUEUE_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_dir_layout.h b/libs/unimrcp/libs/apr-toolkit/include/apt_dir_layout.h deleted file mode 100644 index ba2fa16421..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_dir_layout.h +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_dir_layout.h 2204 2014-10-31 01:01:42Z achaloyan@gmail.com $ - */ - -#ifndef APT_DIR_LAYOUT_H -#define APT_DIR_LAYOUT_H - -/** - * @file apt_dir_layout.h - * @brief Directories Layout - */ - -#include "apt.h" - -APT_BEGIN_EXTERN_C - -/* - * This define allows user applications to support both the old interface, - * where members of apt_dir_layout_t structure were accessable to the - * application, and the new opaque interface, where OPAQUE_DIR_LAYOUT - * is defined. - */ -#define OPAQUE_DIR_LAYOUT - -/** Directories layout declaration */ -typedef struct apt_dir_layout_t apt_dir_layout_t; - -/** Enumeration of directories the layout is composed of */ -typedef enum { - APT_LAYOUT_CONF_DIR, /**< configuration directory */ - APT_LAYOUT_PLUGIN_DIR, /**< plugin directory */ - APT_LAYOUT_LOG_DIR, /**< log directory */ - APT_LAYOUT_DATA_DIR, /**< data directory */ - APT_LAYOUT_VAR_DIR, /**< var directory */ - - APT_LAYOUT_DIR_COUNT, /**< number of directories in the default layout */ - - APT_LAYOUT_EXT_DIR = APT_LAYOUT_DIR_COUNT -} apt_dir_entry_id; - -/** - * Create the default directories layout based on the specified root directory. - * @param root_dir_path the path to the root directory - * @param pool the memory pool to use - */ -APT_DECLARE(apt_dir_layout_t*) apt_default_dir_layout_create(const char *root_dir_path, apr_pool_t *pool); - -/** - * Create a custom directories layout based on the specified individual directories. - * @param conf_dir_path the path to the config dir - * @param plugin_dir_path the path to the plugin dir - * @param log_dir_path the path to the log dir - * @param var_dir_path the path to the var dir - * @param pool the memory pool to use - */ -APT_DECLARE(apt_dir_layout_t*) apt_custom_dir_layout_create( - const char *conf_dir_path, - const char *plugin_dir_path, - const char *log_dir_path, - const char *data_dir_path, - const char *var_dir_path, - apr_pool_t *pool); - -/** - * Create a bare directories layout. - * @param pool the memory pool to use - */ -APT_DECLARE(apt_dir_layout_t*) apt_dir_layout_create(apr_pool_t *pool); - -/** - * Create am extended bare directories layout. - * @param count the number of directories in the layout - * @param pool the memory pool to use - */ -APT_DECLARE(apt_dir_layout_t*) apt_dir_layout_create_ext(apr_size_t count, apr_pool_t *pool); - -/** - * Load directories layout from the specified configuration file. - * @param dir_layout the directory layout - * @param config_file the path to the configuration file - * @param pool the memory pool to use - */ -APT_DECLARE(apt_bool_t) apt_dir_layout_load(apt_dir_layout_t *dir_layout, const char *config_file, apr_pool_t *pool); - -/** - * Load directories layout from the specified configuration file using the provided labels. - * @param dir_layout the directory layout - * @param config_file the path to the configuration file - * @param labels the array of directory labels (configuration entries) - * @param count the number of labels (normally equals the number of directories in the layout) - * @param pool the memory pool to use - */ -APT_DECLARE(apt_bool_t) apt_dir_layout_load_ext(apt_dir_layout_t *dir_layout, const char *config_file, const char **labels, apr_size_t count, apr_pool_t *pool); - -/** - * Set the path to the individual directory in the layout. - * @param dir_layout the directory layout - * @param dir_entry_id the directory id (apt_dir_entry_id) - * @param path the directory path - * @param pool the memory pool to use - */ -APT_DECLARE(apt_bool_t) apt_dir_layout_path_set(apt_dir_layout_t *dir_layout, apr_size_t dir_entry_id, const char *path, apr_pool_t *pool); - -/** - * Get the path to the individual directory in the layout. - * @param dir_layout the directory layout - * @param dir_entry_id the directory id (apt_dir_entry_id) - */ -APT_DECLARE(const char*) apt_dir_layout_path_get(const apt_dir_layout_t *dir_layout, apr_size_t dir_entry_id); - -/** - * Compose a file path relative to the specified directory in the layout. - * @param dir_layout the directory layout - * @param dir_entry_id the directory id (apt_dir_entry_id) - * @param file_name the file name to append to the directory path - * @param pool the memory pool to use - */ -APT_DECLARE(char*) apt_dir_layout_path_compose(const apt_dir_layout_t *dir_layout, apr_size_t dir_entry_id, const char *file_name, apr_pool_t *pool); - - -/** - * Compose a file path relative to config dir. - * @param dir_layout the directory layout - * @param file_name the file name - * @param pool the memory pool to use - */ -APT_DECLARE(char*) apt_confdir_filepath_get(const apt_dir_layout_t *dir_layout, const char *file_name, apr_pool_t *pool); - -/** - * Compose a file path relative to data dir. - * @param dir_layout the directory layout - * @param file_name the file name - * @param pool the memory pool to use - */ -APT_DECLARE(char*) apt_datadir_filepath_get(const apt_dir_layout_t *dir_layout, const char *file_name, apr_pool_t *pool); - -/** - * Compose a file path relative to var dir. - * @param dir_layout the directory layout - * @param file_name the file name - * @param pool the memory pool to use - */ -APT_DECLARE(char*) apt_vardir_filepath_get(const apt_dir_layout_t *dir_layout, const char *file_name, apr_pool_t *pool); - - -APT_END_EXTERN_C - -#endif /* APT_DIR_LAYOUT_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_header_field.h b/libs/unimrcp/libs/apr-toolkit/include/apt_header_field.h deleted file mode 100644 index b2e7053748..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_header_field.h +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_header_field.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef APT_HEADER_FIELD_H -#define APT_HEADER_FIELD_H - -/** - * @file apt_header_field.h - * @brief Header Field Declaration (RFC5322) - */ - -#ifdef WIN32 -#pragma warning(disable: 4127) -#endif -#include -#include "apt_string.h" - -APT_BEGIN_EXTERN_C - -/** Header field declaration */ -typedef struct apt_header_field_t apt_header_field_t; -/** Header section declaration */ -typedef struct apt_header_section_t apt_header_section_t; - -/** Header field */ -struct apt_header_field_t { - /** Ring entry */ - APR_RING_ENTRY(apt_header_field_t) link; - - /** Name of the header field */ - apt_str_t name; - /** Value of the header field */ - apt_str_t value; - - /** Numeric identifier associated with name */ - apr_size_t id; -}; - -/** - * Header section - * @remark The header section is a collection of header fields. - * The header fields are stored in both a ring and an array. - * The goal is to ensure efficient access and manipulation on the header fields. - */ -struct apt_header_section_t { - /** List of header fields (name-value pairs) */ - APR_RING_HEAD(apt_head_t, apt_header_field_t) ring; - /** Array of pointers to header fields */ - apt_header_field_t **arr; - /** Max number of header fields */ - apr_size_t arr_size; -}; - - -/** - * Allocate an empty header field. - * @param pool the pool to allocate memory from - */ -APT_DECLARE(apt_header_field_t*) apt_header_field_alloc(apr_pool_t *pool); - -/** - * Create a header field using given name and value APT strings. - * @param name the name of the header field - * @param value the value of the header field - * @param pool the pool to allocate memory from - */ -APT_DECLARE(apt_header_field_t*) apt_header_field_create(const apt_str_t *name, const apt_str_t *value, apr_pool_t *pool); - -/** - * Create a header field using given name and value C strings. - * @param name the name of the header field - * @param value the value of the header field - * @param pool the pool to allocate memory from - */ -APT_DECLARE(apt_header_field_t*) apt_header_field_create_c(const char *name, const char *value, apr_pool_t *pool); - -/** - * Create a header field from entire text line consisting of a name and value pair. - * @param line the text line, which consists of a name and value pair - * @param separator the name and value separator - * @param pool the pool to allocate memory from - */ -APT_DECLARE(apt_header_field_t*) apt_header_field_create_from_line(const apt_str_t *line, char separator, apr_pool_t *pool); - -/** - * Copy specified header field. - * @param src_header_field the header field to copy - * @param pool the pool to allocate memory from - */ -APT_DECLARE(apt_header_field_t*) apt_header_field_copy(const apt_header_field_t *src_header_field, apr_pool_t *pool); - -/** - * Initialize header section (collection of header fields). - * @param header the header section to initialize - */ -APT_DECLARE(void) apt_header_section_init(apt_header_section_t *header); - -/** - * Allocate header section to set/get header fields by numeric identifiers. - * @param header the header section to allocate - * @param max_field_count the max number of header fields in the section (protocol dependent) - * @param pool the pool to allocate memory from - */ -APT_DECLARE(apt_bool_t) apt_header_section_array_alloc(apt_header_section_t *header, apr_size_t max_field_count, apr_pool_t *pool); - -/** - * Add (append) header field to header section. - * @param header the header section to add field to - * @param header_field the header field to add - */ -APT_DECLARE(apt_bool_t) apt_header_section_field_add(apt_header_section_t *header, apt_header_field_t *header_field); - -/** - * Insert header field to header section based on numreic identifier if specified. - * @param header the header section to insert field into - * @param header_field the header field to insert - */ -APT_DECLARE(apt_bool_t) apt_header_section_field_insert(apt_header_section_t *header, apt_header_field_t *header_field); - -/** - * Set header field in the array of header fields using associated numeric identifier. - * @param header the header section to set field for - * @param header_field the header field to set - * @remark Typically, the header field should be already added to the header section using apt_header_section_field_add() - */ -APT_DECLARE(apt_bool_t) apt_header_section_field_set(apt_header_section_t *header, apt_header_field_t *header_field); - -/** - * Remove header field from header section. - * @param header the header section to remove field from - * @param header_field the header field to remove - */ -APT_DECLARE(apt_bool_t) apt_header_section_field_remove(apt_header_section_t *header, apt_header_field_t *header_field); - -/** - * Check whether specified header field is set. - * @param header the header section to use - * @param id the identifier associated with the header_field to check - */ -static APR_INLINE apt_bool_t apt_header_section_field_check(const apt_header_section_t *header, apr_size_t id) -{ - if(id < header->arr_size) { - return header->arr[id] ? TRUE : FALSE; - } - return FALSE; -} - -/** - * Get header field by specified identifier. - * @param header the header section to use - * @param id the identifier associated with the header_field - */ -static APR_INLINE apt_header_field_t* apt_header_section_field_get(const apt_header_section_t *header, apr_size_t id) -{ - if(id < header->arr_size) { - return header->arr[id]; - } - return NULL; -} - -APT_END_EXTERN_C - -#endif /* APT_HEADER_FIELD_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_log.h b/libs/unimrcp/libs/apr-toolkit/include/apt_log.h deleted file mode 100644 index 9e022c3163..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_log.h +++ /dev/null @@ -1,274 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_log.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef APT_LOG_H -#define APT_LOG_H - -/** - * @file apt_log.h - * @brief Basic Logger - */ - -#include -#include -#include "apt.h" - -APT_BEGIN_EXTERN_C - -/** Default max size of the log file (8Mb) */ -#define MAX_LOG_FILE_SIZE (8 * 1024 * 1024) -/** Default max number of log files used in rotation */ -#define MAX_LOG_FILE_COUNT 100 - -/** File:line mark */ -#define APT_LOG_MARK __FILE__,__LINE__ - -/* - * Definition of common formats used with apt_log(). - * - * Note that the generic %p format can not be used for pointers - * since apr_vformatter doesn't accept it. The format %pp introduced - * by apr_vformatter can not be used either since it breaks compatibility - * with generic printf style loggers. - */ -#if defined(WIN32) && APR_SIZEOF_VOIDP == 8 -/** Format to log pointer values on Win x64 */ -#define APT_PTR_FMT "0x%I64x" -#else -/** Format to log pointer values */ -#define APT_PTR_FMT "0x%lx" -#endif -/** Format to log string identifiers */ -#define APT_SID_FMT "<%s>" -/** Format to log string identifiers and resources */ -#define APT_SIDRES_FMT "<%s@%s>" -/** Format to log pointers and identifiers */ -#define APT_PTRSID_FMT APT_PTR_FMT" " APT_SID_FMT -/** Format to log pointers and identifiers */ -#define APT_NAMESID_FMT "%s " APT_SID_FMT -/** Format to log names, identifiers and resources */ -#define APT_NAMESIDRES_FMT "%s " APT_SIDRES_FMT - -/** Priority of log messages ordered from highest priority to lowest (rfc3164) */ -typedef enum { - APT_PRIO_EMERGENCY, /**< system is unusable */ - APT_PRIO_ALERT, /**< action must be taken immediately */ - APT_PRIO_CRITICAL, /**< critical condition */ - APT_PRIO_ERROR, /**< error condition */ - APT_PRIO_WARNING, /**< warning condition */ - APT_PRIO_NOTICE, /**< normal, but significant condition */ - APT_PRIO_INFO, /**< informational message */ - APT_PRIO_DEBUG, /**< debug-level message */ - - APT_PRIO_COUNT /**< number of priorities */ -} apt_log_priority_e; - -/** Header (format) of log messages */ -typedef enum { - APT_LOG_HEADER_NONE = 0x00, /**< disable optional headers output */ - APT_LOG_HEADER_DATE = 0x01, /**< enable date output */ - APT_LOG_HEADER_TIME = 0x02, /**< enable time output */ - APT_LOG_HEADER_PRIORITY = 0x04, /**< enable priority name output */ - APT_LOG_HEADER_MARK = 0x08, /**< enable file:line mark output */ - APT_LOG_HEADER_THREAD = 0x10, /**< enable thread identifier output */ - - APT_LOG_HEADER_DEFAULT = APT_LOG_HEADER_DATE | APT_LOG_HEADER_TIME | APT_LOG_HEADER_PRIORITY -} apt_log_header_e; - -/** Mode of log output */ -typedef enum { - APT_LOG_OUTPUT_NONE = 0x00, /**< disable logging */ - APT_LOG_OUTPUT_CONSOLE = 0x01, /**< enable console output */ - APT_LOG_OUTPUT_FILE = 0x02 /**< enable log file output */ -} apt_log_output_e; - -/** Masking mode of private data */ -typedef enum { - APT_LOG_MASKING_NONE, /**< log everything as is */ - APT_LOG_MASKING_COMPLETE, /**< mask private data completely */ - APT_LOG_MASKING_ENCRYPTED /**< encrypt private data */ -} apt_log_masking_e; - -/** Opaque logger declaration */ -typedef struct apt_logger_t apt_logger_t; - -/** Prototype of extended log handler function */ -typedef apt_bool_t (*apt_log_ext_handler_f)(const char *file, int line, - const char *obj, apt_log_priority_e priority, - const char *format, va_list arg_ptr); - -/** - * Create the singleton instance of the logger. - * @param mode the log output mode - * @param priority the log priority level - * @param pool the memory pool to use - */ -APT_DECLARE(apt_bool_t) apt_log_instance_create(apt_log_output_e mode, apt_log_priority_e priority, apr_pool_t *pool); - -/** - * Create and load the singleton instance of the logger. - * @param config_file the path to configuration file to load settings from - * @param pool the memory pool to use - */ -APT_DECLARE(apt_bool_t) apt_log_instance_load(const char *config_file, apr_pool_t *pool); - -/** - * Destroy the singleton instance of the logger. - */ -APT_DECLARE(apt_bool_t) apt_log_instance_destroy(void); - -/** - * Get the singleton instance of the logger. - */ -APT_DECLARE(apt_logger_t*) apt_log_instance_get(void); - -/** - * Set the singleton instance of the logger. - */ -APT_DECLARE(apt_bool_t) apt_log_instance_set(apt_logger_t *logger); - -/** - * Open the log file. - * @param dir_path the path to the log directory - * @param file_name the name of the log file - * @param max_file_size the max size of the log file - * @param max_file_count the max number of files used in log rotation - * @param append whether to append or to truncate (start over) the log file - * @param pool the memory pool to use - */ -APT_DECLARE(apt_bool_t) apt_log_file_open( - const char *dir_path, - const char *file_name, - apr_size_t max_file_size, - apr_size_t max_file_count, - apt_bool_t append, - apr_pool_t *pool); - -/** - * Close the log file. - */ -APT_DECLARE(apt_bool_t) apt_log_file_close(void); - -/** - * Set the logging output mode. - * @param mode the mode to set - */ -APT_DECLARE(apt_bool_t) apt_log_output_mode_set(apt_log_output_e mode); - -/** - * Check the logging output mode to be enabled (set) or not. - * @param mode the mode to check - */ -APT_DECLARE(apt_bool_t) apt_log_output_mode_check(apt_log_output_e mode); - -/** - * Translate the output mode string to bitmask of apt_log_output_e values. - * @param str the string to translate - */ -APT_DECLARE(int) apt_log_output_mode_translate(char *str); - -/** - * Set the logging priority (log level). - * @param priority the priority to set - */ -APT_DECLARE(apt_bool_t) apt_log_priority_set(apt_log_priority_e priority); - -/** - * Translate the priority (log level) string to enum. - * @param str the string to translate - */ -APT_DECLARE(apt_log_priority_e) apt_log_priority_translate(const char *str); - -/** - * Set the header (format) for log messages. - * @param header the header to set (used as bitmask) - */ -APT_DECLARE(apt_bool_t) apt_log_header_set(int header); - -/** - * Translate the header string to bitmask of apt_log_header_e values. - * @param str the string to translate - */ -APT_DECLARE(int) apt_log_header_translate(char *str); - -/** - * Set the masking mode of private data. - * @param masking the masking mode to set - */ -APT_DECLARE(apt_bool_t) apt_log_masking_set(apt_log_masking_e masking); - -/** - * Get the current masking mode of private data. - */ -APT_DECLARE(apt_log_masking_e) apt_log_masking_get(void); - -/** - * Translate the masking mode string to enum. - * @param str the string to translate - */ -APT_DECLARE(apt_log_masking_e) apt_log_masking_translate(const char *str); - -/** - * Mask private data based on the masking mode - * @param data_in the data to mask - * @param length the length of the data to mask on input, the length of the masked data on output - * @param pool the memory pool to use if needed - * @return The masked data. - */ -APT_DECLARE(const char*) apt_log_data_mask(const char *data_in, apr_size_t *length, apr_pool_t *pool); - -/** - * Set the extended external log handler. - * @param handler the handler to pass log events to - * @remark default logger is used to output the logs to stdout and/or log file, - * if external log handler isn't set - */ -APT_DECLARE(apt_bool_t) apt_log_ext_handler_set(apt_log_ext_handler_f handler); - -/** - * Do logging. - * @param file the file name log entry is generated from - * @param line the line number log entry is generated from - * @param priority the priority of the entire log entry - * @param format the format of the entire log entry - */ -APT_DECLARE(apt_bool_t) apt_log(const char *file, int line, apt_log_priority_e priority, const char *format, ...); - -/** - * Do logging (this version uses an object externally associated with the logger). - * @param file the file name log entry is generated from - * @param line the line number log entry is generated from - * @param priority the priority of the entire log entry - * @param obj the associated object - * @param format the format of the entire log entry - */ -APT_DECLARE(apt_bool_t) apt_obj_log(const char *file, int line, apt_log_priority_e priority, void *obj, const char *format, ...); - -/** - * Do logging (this version accepts va_list argument). - * @param file the file name log entry is generated from - * @param line the line number log entry is generated from - * @param priority the priority of the entire log entry - * @param format the format of the entire log entry - * @param arg_ptr the arguments - */ -APT_DECLARE(apt_bool_t) apt_va_log(const char *file, int line, apt_log_priority_e priority, const char *format, va_list arg_ptr); - -APT_END_EXTERN_C - -#endif /* APT_LOG_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_multipart_content.h b/libs/unimrcp/libs/apr-toolkit/include/apt_multipart_content.h deleted file mode 100644 index dd4c646d83..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_multipart_content.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_multipart_content.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef APT_MULTIPART_CONTENT_H -#define APT_MULTIPART_CONTENT_H - -/** - * @file apt_multipart_content.h - * @brief Multipart Content Routine - */ - -#include "apt_header_field.h" - -APT_BEGIN_EXTERN_C - -/** Opaque multipart content declaration */ -typedef struct apt_multipart_content_t apt_multipart_content_t; - -/** Content part declaration */ -typedef struct apt_content_part_t apt_content_part_t; - -/** Content part */ -struct apt_content_part_t { - /** Header section */ - apt_header_section_t header; - /** Body */ - apt_str_t body; - - /** Pointer to parsed content-type header field */ - apt_str_t *type; - /** Pointer to parsed content-id header field */ - apt_str_t *id; - /** Pointer to parsed content-length header field */ - apt_str_t *length; -}; - -/** - * Create an empty multipart content - * @param max_content_size the max size of the content (body) - * @param boundary the boundary to separate content parts - * @param pool the pool to allocate memory from - * @return an empty multipart content - */ -APT_DECLARE(apt_multipart_content_t*) apt_multipart_content_create(apr_size_t max_content_size, const apt_str_t *boundary, apr_pool_t *pool); - -/** - * Add content part to multipart content - * @param multipart_content the multipart content to add content part to - * @param content_part the content part to add - * @return TRUE on success - */ -APT_DECLARE(apt_bool_t) apt_multipart_content_add(apt_multipart_content_t *multipart_content, const apt_content_part_t *content_part); - -/** - * Add content part to multipart content by specified header fields and body - * @param multipart_content the multipart content to add content part to - * @param content_type the type of content part - * @param content_id the identifier of content part - * @param body the body of content part - * @return TRUE on success - */ -APT_DECLARE(apt_bool_t) apt_multipart_content_add2(apt_multipart_content_t *multipart_content, const apt_str_t *content_type, const apt_str_t *content_id, const apt_str_t *body); - -/** - * Finalize multipart content generation - * @param multipart_content the multipart content to finalize - * @return generated multipart content - */ -APT_DECLARE(apt_str_t*) apt_multipart_content_finalize(apt_multipart_content_t *multipart_content); - - -/** - * Assign body to multipart content to get (parse) each content part from - * @param body the body of multipart content to parse - * @param boundary the boundary to separate content parts - * @param pool the pool to allocate memory from - * @return multipart content with assigned body - */ -APT_DECLARE(apt_multipart_content_t*) apt_multipart_content_assign(const apt_str_t *body, const apt_str_t *boundary, apr_pool_t *pool); - -/** - * Get the next content part - * @param multipart_content the multipart content to get the next content part from - * @param content_part the parsed content part - * @param is_final indicates the final boundary is reached - * @return TRUE on success - */ -APT_DECLARE(apt_bool_t) apt_multipart_content_get(apt_multipart_content_t *multipart_content, apt_content_part_t *content_part, apt_bool_t *is_final); - - -APT_END_EXTERN_C - -#endif /* APT_MULTIPART_CONTENT_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_net.h b/libs/unimrcp/libs/apr-toolkit/include/apt_net.h deleted file mode 100644 index 6527c8fc7d..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_net.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_net.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef APT_NET_H -#define APT_NET_H - -/** - * @file apt_net.h - * @brief Network Utilities - */ - -#include "apt.h" - -APT_BEGIN_EXTERN_C - -/** - * Get the IP address (in numeric address string format) by hostname. - * @param addr the IP address to return - * @param pool the pool to allocate memory from - */ -apt_bool_t apt_ip_get(char **addr, apr_pool_t *pool); - -/** - * Get the IP address (in numeric address string format) by network interface name. - * @param iface_name the network interface name (eth0, Local Area Connection, etc) - * @param addr the IP address to return - * @param pool the pool to allocate memory from - */ -apt_bool_t apt_ip_get_by_iface(const char *iface_name, char **addr, apr_pool_t *pool); - -/** - * Get current NTP time - * @param sec the seconds of the NTP time to return - * @param frac the fractions of the NTP time to return - */ -void apt_ntp_time_get(apr_uint32_t *sec, apr_uint32_t *frac); - -APT_END_EXTERN_C - -#endif /* APT_NET_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_nlsml_doc.h b/libs/unimrcp/libs/apr-toolkit/include/apt_nlsml_doc.h deleted file mode 100644 index d6b87c87d9..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_nlsml_doc.h +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_nlsml_doc.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef APT_NLSML_DOC_H -#define APT_NLSML_DOC_H - -/** - * @file apt_nlsml_doc.h - * @brief NLSML Result Handling - * @remark This is an MRCP version independent and vendor consistent implementation - * of the NSLML parser. The interface reflects the NLSML schema defined in - * http://tools.ietf.org/html/rfc6787#section-16.1. - */ - -#include -#include "apt.h" - -APT_BEGIN_EXTERN_C - -/* Forward declarations */ -typedef struct nlsml_result_t nlsml_result_t; -typedef struct nlsml_interpretation_t nlsml_interpretation_t; -typedef struct nlsml_enrollment_result_t nlsml_enrollment_result_t; -typedef struct nlsml_verification_result_t nlsml_verification_result_t; -typedef struct nlsml_instance_t nlsml_instance_t; -typedef struct nlsml_input_t nlsml_input_t; - -/** - * Parse NLSML result - * @param data the data to parse - * @param length the length of the data - * @param pool the memory pool to use - * @return the parsed NLSML result. - */ -APT_DECLARE(nlsml_result_t*) nlsml_result_parse(const char *data, apr_size_t length, apr_pool_t *pool); - -/** - * Trace parsed NLSML result (for debug purposes only) - * @param result the parsed result to output - * @param pool the memory pool to use - */ -APT_DECLARE(void) nlsml_result_trace(const nlsml_result_t *result, apr_pool_t *pool); - -/* - * Accessors of the NLSML element. - * Each element may contain one or more , , - * elements, and an optional attribute. - */ - -/** - * Get first interpretation - * @param result the parsed NLSML result which holds the list of interpretation elements - */ -APT_DECLARE(nlsml_interpretation_t*) nlsml_first_interpretation_get(const nlsml_result_t *result); - -/** - * Get next interpretation - * @param result the parsed NLSML result which holds the list of interpretation elements - * @param interpretation the current interpretation element - */ -APT_DECLARE(nlsml_interpretation_t*) nlsml_next_interpretation_get(const nlsml_result_t *result, const nlsml_interpretation_t *interpretation); - -/** - * Get first enrollment result - * @param result the parsed NLSML result which holds the list of enrollment-result elements - */ -APT_DECLARE(nlsml_enrollment_result_t*) nlsml_first_enrollment_result_get(const nlsml_result_t *result); - -/** - * Get next enrollment result - * @param result the parsed NLSML result which holds the list of enrollment-result elements - * @param enrollment_result the current enrollment-result element - */ -APT_DECLARE(nlsml_enrollment_result_t*) nlsml_next_enrollment_result_get(const nlsml_result_t *result, const nlsml_enrollment_result_t *enrollment_result); - -/** - * Get first verification result - * @param result the parsed NLSML result which holds the list of verification-result elements - */ -APT_DECLARE(nlsml_verification_result_t*) nlsml_first_verification_result_get(const nlsml_result_t *result); - -/** - * Get next verification result - * @param result the parsed NLSML result which holds the list of verification-result elements - * @param verification_result the current verification-result element - */ -APT_DECLARE(nlsml_verification_result_t*) nlsml_next_verification_result_get(const nlsml_result_t *result, const nlsml_verification_result_t *verification_result); - -/** - * Get the grammar attribute of the NLSML result - * @param result the parsed result - */ -APT_DECLARE(const char*) nlsml_result_grammar_get(const nlsml_result_t *result); - -/* - * Accessors of the element. - */ - -/** - * Get first instance - * @param interpretation the parsed interpretation element which holds the list of instance elements - */ -APT_DECLARE(nlsml_instance_t*) nlsml_interpretation_first_instance_get(const nlsml_interpretation_t *interpretation); - -/** - * Get next instance - * @param interpretation the parsed interpretation element which holds the list of instance elements - * @param instance the current instance element - */ -APT_DECLARE(nlsml_instance_t*) nlsml_interpretation_next_instance_get(const nlsml_interpretation_t *interpretation, const nlsml_instance_t *instance); - -/** - * Get input - * @param interpretation the parsed interpretation element which may have 0 or 1 input elements - */ -APT_DECLARE(nlsml_input_t*) nlsml_interpretation_input_get(const nlsml_interpretation_t *interpretation); - -/** - * Get interpretation confidence - * @param interpretation the parsed interpretation element - * @remark the confidence is stored and returned as a float value for both MRCPv2 and MRCPv1 - */ -APT_DECLARE(float) nlsml_interpretation_confidence_get(const nlsml_interpretation_t *interpretation); - -/** - * Get interpretation grammar - * @param interpretation the parsed interpretation element - */ -APT_DECLARE(const char*) nlsml_interpretation_grammar_get(const nlsml_interpretation_t *interpretation); - -/* - * Accessors of the and elements. - */ - -/** - * Get an XML representation of the instance element - * @param instance the parsed instance element - */ -APT_DECLARE(const apr_xml_elem*) nlsml_instance_elem_get(const nlsml_instance_t *instance); - -/** - * Suppress SWI elements (normalize instance) - * @param instance the parsed instance to suppress SWI sub-elements from - */ -APT_DECLARE(apt_bool_t) nlsml_instance_swi_suppress(nlsml_instance_t *instance); - -/** - * Generate a plain text content of the instance element - * @param instance the parsed instance to generate content of - * @param pool the memory pool to use - */ -APT_DECLARE(const char*) nlsml_instance_content_generate(const nlsml_instance_t *instance, apr_pool_t *pool); - -/** - * Get an XML representation of the input element - * @param input the parsed input element - */ -APT_DECLARE(const apr_xml_elem*) nlsml_input_elem_get(const nlsml_input_t *input); - -/** - * Generate a plain text content of the input element - * @param input the parsed input to generate content of - * @param pool the memory pool to use - */ -APT_DECLARE(const char*) nlsml_input_content_generate(const nlsml_input_t *input, apr_pool_t *pool); - -/** - * Get input mode - * @param input the parsed input element - * @remark the input mode is either "speech" or "dtmf" - */ -APT_DECLARE(const char*) nlsml_input_mode_get(const nlsml_input_t *input); - -/** - * Get input confidence - * @param input the parsed input element - * @remark the confidence is stored and returned as a float value for both MRCPv2 and MRCPv1 - */ -APT_DECLARE(float) nlsml_input_confidence_get(const nlsml_input_t *input); - -/** - * Get start of input timestamp - * @param input the parsed input element - */ -APT_DECLARE(const char*) nlsml_input_timestamp_start_get(const nlsml_input_t *input); - -/** - * Get end of input timestamp - * @param input the parsed input element - */ -APT_DECLARE(const char*) nlsml_input_timestamp_end_get(const nlsml_input_t *input); - -APT_END_EXTERN_C - -#endif /* APT_NLSML_DOC_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_obj_list.h b/libs/unimrcp/libs/apr-toolkit/include/apt_obj_list.h deleted file mode 100644 index 56a88d0d4b..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_obj_list.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_obj_list.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef APT_OBJ_LIST_H -#define APT_OBJ_LIST_H - -/** - * @file apt_obj_list.h - * @brief List of Opaque void* Objects - */ - -#include "apt.h" - -APT_BEGIN_EXTERN_C - - -/** Opaque list declaration */ -typedef struct apt_obj_list_t apt_obj_list_t; -/** Opaque list element declaration */ -typedef struct apt_list_elem_t apt_list_elem_t; - -/** - * Create list. - * @param pool the pool to allocate list from - * @return the created list - */ -APT_DECLARE(apt_obj_list_t*) apt_list_create(apr_pool_t *pool); - -/** - * Destroy list. - * @param list the list to destroy - */ -APT_DECLARE(void) apt_list_destroy(apt_obj_list_t *list); - -/** - * Push object to the list as first in, first out. - * @param list the list to push object to - * @param obj the object to push - * @param pool the pool to allocate list element from - * @return the inserted element - */ -APT_DECLARE(apt_list_elem_t*) apt_list_push_back(apt_obj_list_t *list, void *obj, apr_pool_t *pool); - -/** - * Pop object from the list as first in, first out. - * @param list the list to pop message from - * @return the popped object (if any) - */ -APT_DECLARE(void*) apt_list_pop_front(apt_obj_list_t *list); - -/** - * Retrieve object of the first element in the list. - * @param list the list to retrieve from - */ -APT_DECLARE(void*) apt_list_head(const apt_obj_list_t *list); - -/** - * Retrieve object of the last element in the list. - * @param list the list to retrieve from - */ -APT_DECLARE(void*) apt_obj_list_tail(const apt_obj_list_t *list); - - -/** - * Retrieve the first element of the list. - * @param list the list to retrieve from - */ -APT_DECLARE(apt_list_elem_t*) apt_list_first_elem_get(const apt_obj_list_t *list); - -/** - * Retrieve the last element of the list. - * @param list the list to retrieve from - */ -APT_DECLARE(apt_list_elem_t*) apt_list_last_elem_get(const apt_obj_list_t *list); - -/** - * Retrieve the next element of the list. - * @param list the list to retrieve from - * @param elem the element to retrieve next element from - */ -APT_DECLARE(apt_list_elem_t*) apt_list_next_elem_get(const apt_obj_list_t *list, apt_list_elem_t *elem); - -/** - * Retrieve the prev element of the list. - * @param list the list to retrieve from - * @param elem the element to retrieve prev element from - */ -APT_DECLARE(apt_list_elem_t*) apt_list_prev_elem_get(const apt_obj_list_t *list, apt_list_elem_t *elem); - -/** - * Insert element to the list. - * @param list the list to insert element to - * @param elem the element to insert before - * @param obj the object to insert - * @param pool the pool to allocate list element from - * @return the inserted element - */ -APT_DECLARE(apt_list_elem_t*) apt_list_elem_insert(apt_obj_list_t *list, apt_list_elem_t *elem, void *obj, apr_pool_t *pool); - -/** - * Remove element from the list. - * @param list the list to remove element from - * @param elem the element to remove - * @return the next element (if any) - */ -APT_DECLARE(apt_list_elem_t*) apt_list_elem_remove(apt_obj_list_t *list, apt_list_elem_t *elem); - -/** - * Query whether the list is empty. - * @param list the list to query - * @return TRUE if empty, otherwise FALSE - */ -APT_DECLARE(apt_bool_t) apt_list_is_empty(const apt_obj_list_t *list); - -/** - * Retrieve the object associated with element. - * @param elem the element to retrieve object from - */ -APT_DECLARE(void*) apt_list_elem_object_get(const apt_list_elem_t *elem); - - -APT_END_EXTERN_C - -#endif /* APT_OBJ_LIST_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_pair.h b/libs/unimrcp/libs/apr-toolkit/include/apt_pair.h deleted file mode 100644 index 737cff2157..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_pair.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_pair.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef APT_PAIR_H -#define APT_PAIR_H - -/** - * @file apt_pair.h - * @brief Generic Name-Value Pair - */ - -#include -#include "apt_string.h" - -APT_BEGIN_EXTERN_C - -/** Name-value declaration */ -typedef struct apt_pair_t apt_pair_t; - -/** Generic name-value pair definition ("name:value") */ -struct apt_pair_t { - /** The name */ - apt_str_t name; - /** The value */ - apt_str_t value; -}; - -/** Dynamic array of name-value pairs */ -typedef apr_array_header_t apt_pair_arr_t; - -/** Initialize name-value pair */ -static APR_INLINE void apt_pair_init(apt_pair_t *pair) -{ - apt_string_reset(&pair->name); - apt_string_reset(&pair->value); -} - -/** Copy name-value pair */ -static APR_INLINE void apt_pair_copy(apt_pair_t *pair, const apt_pair_t *src_pair, apr_pool_t *pool) -{ - apt_string_copy(&pair->name,&src_pair->name,pool); - apt_string_copy(&pair->value,&src_pair->value,pool); -} - -/** Create array of name-value pairs */ -APT_DECLARE(apt_pair_arr_t*) apt_pair_array_create(apr_size_t initial_size, apr_pool_t *pool); -/** Copy array of name-value pairs */ -APT_DECLARE(apt_pair_arr_t*) apt_pair_array_copy(const apt_pair_arr_t *src, apr_pool_t *pool); -/** Append name-value pair */ -APT_DECLARE(apt_bool_t) apt_pair_array_append(apt_pair_arr_t *arr, const apt_str_t *name, const apt_str_t *value, apr_pool_t *pool); -/** Find name-value pair by name */ -APT_DECLARE(const apt_pair_t*) apt_pair_array_find(const apt_pair_arr_t *arr, const apt_str_t *name); -/** Get size of pair array */ -APT_DECLARE(int) apt_pair_array_size_get(const apt_pair_arr_t *arr); -/** Get name-value pair by id */ -APT_DECLARE(const apt_pair_t*) apt_pair_array_get(const apt_pair_arr_t *arr, int id); - -APT_END_EXTERN_C - -#endif /* APT_PAIR_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_poller_task.h b/libs/unimrcp/libs/apr-toolkit/include/apt_poller_task.h deleted file mode 100644 index 3bb6052744..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_poller_task.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_poller_task.h 2176 2014-09-12 05:00:23Z achaloyan@gmail.com $ - */ - -#ifndef APT_POLLER_TASK_H -#define APT_POLLER_TASK_H - -/** - * @file apt_poller_task.h - * @brief Poller Task - */ - -#include "apt_pollset.h" -#include "apt_task.h" -#include "apt_timer_queue.h" - -APT_BEGIN_EXTERN_C - -/** Opaque poller task declaration */ -typedef struct apt_poller_task_t apt_poller_task_t; - -/** Function prototype to handle signalled descripors */ -typedef apt_bool_t (*apt_poll_signal_f)(void *obj, const apr_pollfd_t *descriptor); - - -/** - * Create poller task. - * @param max_pollset_size the maximum number of descriptors pollset can hold - * @param signal_handler the handler of signalled descriptors - * @param obj the external object to pass to callback - * @param msg_pool the pool of task messages - * @param pool the pool to allocate memory from - */ -APT_DECLARE(apt_poller_task_t*) apt_poller_task_create( - apr_size_t max_pollset_size, - apt_poll_signal_f signal_handler, - void *obj, - apt_task_msg_pool_t *msg_pool, - apr_pool_t *pool); - -/** - * Destroy poller task. - * @param task the task to destroy - */ -APT_DECLARE(apt_bool_t) apt_poller_task_destroy(apt_poller_task_t *task); - -/** - * Cleanup poller task. - * @param task the task to cleanup - * - * @remark This function should be considered in protected scope. - * It will be called on task destroy unless you override the behavior. - */ -APT_DECLARE(void) apt_poller_task_cleanup(apt_poller_task_t *task); - -/** - * Start poller task and wait for incoming messages. - * @param task the task to start - */ -APT_DECLARE(apt_bool_t) apt_poller_task_start(apt_poller_task_t *task); - -/** - * Terminate poller task. - * @param task the task to terminate - */ -APT_DECLARE(apt_bool_t) apt_poller_task_terminate(apt_poller_task_t *task); - -/** - * Get task base. - * @param task the poller task to get task base from - */ -APT_DECLARE(apt_task_t*) apt_poller_task_base_get(const apt_poller_task_t *task); - -/** - * Get task vtable. - * @param task the poller task to get vtable from - */ -APT_DECLARE(apt_task_vtable_t*) apt_poller_task_vtable_get(const apt_poller_task_t *task); - -/** - * Get external object. - * @param task the poller task to get object from - */ -APT_DECLARE(void*) apt_poller_task_object_get(const apt_poller_task_t *task); - -/** - * Add descriptor to pollset. - * @param task the task which holds the pollset - * @param descriptor the descriptor to add - */ -APT_DECLARE(apt_bool_t) apt_poller_task_descriptor_add(const apt_poller_task_t *task, const apr_pollfd_t *descriptor); - -/** - * Remove descriptor from pollset. - * @param task the task which holds the pollset - * @param descriptor the descriptor to remove - */ -APT_DECLARE(apt_bool_t) apt_poller_task_descriptor_remove(const apt_poller_task_t *task, const apr_pollfd_t *descriptor); - -/** - * Create timer. - * @param task the poller task to create timer in the scope of - * @param proc the timer callback - * @param obj the object to pass to callback - * @param pool the pool to allocate memory from - */ -APT_DECLARE(apt_timer_t*) apt_poller_task_timer_create( - apt_poller_task_t *task, - apt_timer_proc_f proc, - void *obj, - apr_pool_t *pool); - - -APT_END_EXTERN_C - -#endif /* APT_POLLER_TASK_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_pollset.h b/libs/unimrcp/libs/apr-toolkit/include/apt_pollset.h deleted file mode 100644 index 0d6a0ab356..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_pollset.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_pollset.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef APT_POLLSET_H -#define APT_POLLSET_H - -/** - * @file apt_pollset.h - * @brief Interruptable APR-Pollset - */ - -/** - * Wakeup builtin API of the pollset is introduced only in APR-1.4 - * and it is not available for APR-1.2 and APR-1.3 versions. Thus - * apt_pollset_t is an extension of apr_pollset_t and provides - * pollset wakeup capabilities the similar way as it's implemented - * in APR-1.4 trunk - */ - -#include -#include "apt.h" - -APT_BEGIN_EXTERN_C - -/** Opaque pollset declaration */ -typedef struct apt_pollset_t apt_pollset_t; - -/** - * Create interruptable pollset on top of APR pollset. - * @param size the maximum number of descriptors pollset can hold - * @param pool the pool to allocate memory from - */ -APT_DECLARE(apt_pollset_t*) apt_pollset_create(apr_uint32_t size, apr_pool_t *pool); - -/** - * Destroy pollset. - * @param pollset the pollset to destroy - */ -APT_DECLARE(apt_bool_t) apt_pollset_destroy(apt_pollset_t *pollset); - -/** - * Add pollset descriptor to a pollset. - * @param pollset the pollset to add the descriptor to - * @param descriptor the descriptor to add - */ -APT_DECLARE(apt_bool_t) apt_pollset_add(apt_pollset_t *pollset, const apr_pollfd_t *descriptor); - -/** - * Remove pollset descriptor from a pollset. - * @param pollset the pollset to remove the descriptor from - * @param descriptor the descriptor to remove - */ -APT_DECLARE(apt_bool_t) apt_pollset_remove(apt_pollset_t *pollset, const apr_pollfd_t *descriptor); - -/** - * Block for activity on the descriptor(s) in a pollset. - * @param pollset the pollset to use - * @param timeout the timeout in microseconds - * @param num the number of signalled descriptors (output parameter) - * @param descriptors the array of signalled descriptors (output parameter) - */ -APT_DECLARE(apr_status_t) apt_pollset_poll( - apt_pollset_t *pollset, - apr_interval_time_t timeout, - apr_int32_t *num, - const apr_pollfd_t **descriptors); - -/** - * Interrupt the blocked poll call. - * @param pollset the pollset to use - */ -APT_DECLARE(apt_bool_t) apt_pollset_wakeup(apt_pollset_t *pollset); - -/** - * Match against builtin wake up descriptor in a pollset. - * @param pollset the pollset to use - * @param descriptor the descriptor to match - */ -APT_DECLARE(apt_bool_t) apt_pollset_is_wakeup(apt_pollset_t *pollset, const apr_pollfd_t *descriptor); - -APT_END_EXTERN_C - -#endif /* APT_POLLSET_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_pool.h b/libs/unimrcp/libs/apr-toolkit/include/apt_pool.h deleted file mode 100644 index 56f10d4429..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_pool.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_pool.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef APT_POOL_H -#define APT_POOL_H - -/** - * @file apt_pool.h - * @brief APR pool management - */ - -/** - * Wrappers around APR pool creation - * allow to control memory allocation policy project uses - */ - -#include "apt.h" - -APT_BEGIN_EXTERN_C - -/** - * Create APR pool - */ -APT_DECLARE(apr_pool_t*) apt_pool_create(void); - -/** - * Create APR subpool pool - * @param parent the parent pool - */ -APT_DECLARE(apr_pool_t*) apt_subpool_create(apr_pool_t *parent); - -APT_END_EXTERN_C - -#endif /* APT_POOL_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_string.h b/libs/unimrcp/libs/apr-toolkit/include/apt_string.h deleted file mode 100644 index 4c919cedb6..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_string.h +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_string.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef APT_STRING_H -#define APT_STRING_H - -/** - * @file apt_string.h - * @brief String Representation - */ - -#include "apt.h" - -APT_BEGIN_EXTERN_C - -/** Empty string */ -#define APT_EMPTY_STRING "" - -/** String declaration */ -typedef struct apt_str_t apt_str_t; - -/** String representation */ -struct apt_str_t { - /** String buffer (might be not NULL terminated) */ - char *buf; - /** Length of the string (not counting terminating NULL character if exists) */ - apr_size_t length; -}; - -/** Reset string. */ -static APR_INLINE void apt_string_reset(apt_str_t *str) -{ - str->buf = NULL; - str->length = 0; -} - -/** Get string buffer. */ -static APR_INLINE const char* apt_string_buffer_get(const apt_str_t *str) -{ - if(str->buf) { - return str->buf; - } - return APT_EMPTY_STRING; -} - -/** Get string length. */ -static APR_INLINE apr_size_t apt_string_length_get(const apt_str_t *str) -{ - return str->length; -} - -/** Check whether string is empty. */ -static APR_INLINE apr_size_t apt_string_is_empty(const apt_str_t *str) -{ - return str->length ? FALSE : TRUE; -} - -/** - * Set NULL terminated string. - * @param str the destination string - * @param src the NULL terminated string to set - */ -static APR_INLINE void apt_string_set(apt_str_t *str, const char *src) -{ - str->buf = (char*)src; - str->length = src ? strlen(src) : 0; -} - -/** - * Assign (copy) NULL terminated string. - * @param str the destination string - * @param src the NULL terminated string to copy - * @param pool the pool to allocate memory from - */ -static APR_INLINE void apt_string_assign(apt_str_t *str, const char *src, apr_pool_t *pool) -{ - str->buf = NULL; - str->length = src ? strlen(src) : 0; - if(str->length) { - str->buf = apr_pstrmemdup(pool,src,str->length); - } -} - -/** - * Assign (copy) n characters from the src string. - * @param str the destination string - * @param src the NULL terminated string to copy - * @param pool the pool to allocate memory from - */ -static APR_INLINE void apt_string_assign_n(apt_str_t *str, const char *src, apr_size_t length, apr_pool_t *pool) -{ - str->buf = NULL; - str->length = length; - if(str->length) { - str->buf = apr_pstrmemdup(pool,src,str->length); - } -} - -/** - * Copy string. - * @param dest_str the destination string - * @param src_str the source string - * @param pool the pool to allocate memory from - */ -static APR_INLINE void apt_string_copy(apt_str_t *str, const apt_str_t *src_str, apr_pool_t *pool) -{ - str->buf = NULL; - str->length = src_str->length; - if(str->length) { - str->buf = apr_pstrmemdup(pool,src_str->buf,src_str->length); - } -} - -/** - * Compare two strings (case insensitive). - * @param str1 the string to compare - * @param str2 the string to compare - * @return TRUE if equal, FALSE otherwise - */ -static APR_INLINE apt_bool_t apt_string_compare(const apt_str_t *str1, const apt_str_t *str2) -{ - if(str1->length != str2->length || !str1->length) { - return FALSE; - } - return (strncasecmp(str1->buf,str2->buf,str1->length) == 0) ? TRUE : FALSE; -} - -/** - * Represent string as iovec. - * @param str the string to represent - * @param vec the iovec to set - */ -static APR_INLINE void apt_string_to_iovec(const apt_str_t *str, struct iovec *vec) -{ - vec->iov_base = str->buf; - vec->iov_len = str->length; -} - -APT_END_EXTERN_C - -#endif /* APT_STRING_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_string_table.h b/libs/unimrcp/libs/apr-toolkit/include/apt_string_table.h deleted file mode 100644 index 53ecc6e5aa..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_string_table.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_string_table.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef APT_STRING_TABLE_H -#define APT_STRING_TABLE_H - -/** - * @file apt_string_table.h - * @brief Generic String Table - */ - -#include "apt_string.h" - -APT_BEGIN_EXTERN_C - - -/** String table item declaration */ -typedef struct apt_str_table_item_t apt_str_table_item_t; - -/** String table item definition */ -struct apt_str_table_item_t { - /** String value associated with id */ - apt_str_t value; - /** Index of the unique (key) character to compare */ - apr_size_t key; -}; - - -/** - * Get the string by a given id. - * @param table the table to get string from - * @param size the size of the table - * @param id the id to get string by - * @return the string associated with the id, or NULL if the id is invalid - */ -APT_DECLARE(const apt_str_t*) apt_string_table_str_get(const apt_str_table_item_t table[], apr_size_t size, apr_size_t id); - -/** - * Find the id associated with a given string. - * @param table the table to search for the id - * @param size the size of the table - * @param value the string to search for - * @return the id associated with the string, or invalid id if string cannot be matched - */ -APT_DECLARE(apr_size_t) apt_string_table_id_find(const apt_str_table_item_t table[], apr_size_t size, const apt_str_t *value); - - -APT_END_EXTERN_C - -#endif /* APT_STRING_TABLE_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_task.h b/libs/unimrcp/libs/apr-toolkit/include/apt_task.h deleted file mode 100644 index 127529c95e..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_task.h +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_task.h 2180 2014-09-13 21:17:24Z achaloyan@gmail.com $ - */ - -#ifndef APT_TASK_H -#define APT_TASK_H - -/** - * @file apt_task.h - * @brief Thread Execution Abstraction - */ - -#include "apt.h" -#include "apt_task_msg.h" - -APT_BEGIN_EXTERN_C - -/** Opaque task declaration */ -typedef struct apt_task_t apt_task_t; -/** Opaque task virtual table declaration */ -typedef struct apt_task_vtable_t apt_task_vtable_t; -/** Opaque task method declaration */ -typedef apt_bool_t (*apt_task_method_f)(apt_task_t *task); -/** Opaque task event declaration */ -typedef void (*apt_task_event_f)(apt_task_t *task); - - -/** - * Create task. - * @param obj the external object to associate with the task - * @param msg_pool the pool of task messages - * @param pool the pool to allocate memory from - */ -APT_DECLARE(apt_task_t*) apt_task_create( - void *obj, - apt_task_msg_pool_t *msg_pool, - apr_pool_t *pool); - -/** - * Destroy task. - * @param task the task to destroy - */ -APT_DECLARE(apt_bool_t) apt_task_destroy(apt_task_t *task); - -/** - * Add child task. - * @param task the task to add child task to - * @param child_task the child task to add - */ -APT_DECLARE(apt_bool_t) apt_task_add(apt_task_t *task, apt_task_t *child_task); - -/** - * Start task. - * @param task the task to start - */ -APT_DECLARE(apt_bool_t) apt_task_start(apt_task_t *task); - -/** - * Take task offline. - * @param task the task to take offline - */ -APT_DECLARE(apt_bool_t) apt_task_offline(apt_task_t *task); - -/** - * Bring task online. - * @param task the task to bring online - */ -APT_DECLARE(apt_bool_t) apt_task_online(apt_task_t *task); - -/** - * Terminate task. - * @param task the task to terminate - * @param wait_till_complete whether to wait for task to complete or - * process termination asynchronously - */ -APT_DECLARE(apt_bool_t) apt_task_terminate(apt_task_t *task, apt_bool_t wait_till_complete); - -/** - * Wait for task till complete. - * @param task the task to wait for - */ -APT_DECLARE(apt_bool_t) apt_task_wait_till_complete(apt_task_t *task); - -/** - * Get (acquire) task message. - * @param task the task to get task message from - */ -APT_DECLARE(apt_task_msg_t*) apt_task_msg_get(apt_task_t *task); - -/** - * Signal (post) message to the task. - * @param task the task to signal message to - * @param msg the message to signal - */ -APT_DECLARE(apt_bool_t) apt_task_msg_signal(apt_task_t *task, apt_task_msg_t *msg); - -/** - * Signal (post) message to the parent of the specified task. - * @param task the task to signal message to - * @param msg the message to signal - */ -APT_DECLARE(apt_bool_t) apt_task_msg_parent_signal(apt_task_t *task, apt_task_msg_t *msg); - -/** - * Process message signaled to the task. - * @param task the task to process message - * @param msg the message to process - */ -APT_DECLARE(apt_bool_t) apt_task_msg_process(apt_task_t *task, apt_task_msg_t *msg); - -/** - * Process task start request. - * @param task the task being started - */ -APT_DECLARE(apt_bool_t) apt_task_start_request_process(apt_task_t *task); - -/** - * Process task termination request. - * @param task the task being terminated - */ -APT_DECLARE(apt_bool_t) apt_task_terminate_request_process(apt_task_t *task); - - -/** - * Get parent (master) task. - * @param task the task to get parent from - */ -APT_DECLARE(apt_task_t*) apt_task_parent_get(const apt_task_t *task); - -/** - * Get memory pool associated with task. - * @param task the task to get pool from - */ -APT_DECLARE(apr_pool_t*) apt_task_pool_get(const apt_task_t *task); - -/** - * Get external object associated with the task. - * @param task the task to get object from - */ -APT_DECLARE(void*) apt_task_object_get(const apt_task_t *task); - -/** - * Get task vtable. - * @param task the task to get vtable from - */ -APT_DECLARE(apt_task_vtable_t*) apt_task_vtable_get(apt_task_t *task); - -/** - * Give a name to the task. - * @param task the task to give name for - * @param name the name to set - */ -APT_DECLARE(void) apt_task_name_set(apt_task_t *task, const char *name); - -/** - * Get task name. - * @param task the task to get name from - */ -APT_DECLARE(const char*) apt_task_name_get(const apt_task_t *task); - -/** - * Enable/disable auto ready mode. - * @param task the task to set mode for - * @param auto_ready the enabled/disabled auto ready mode - */ -APT_DECLARE(void) apt_task_auto_ready_set(apt_task_t *task, apt_bool_t auto_ready); - -/** - * Explicitly indicate task is ready to process messages. - * @param task the task - */ -APT_DECLARE(apt_bool_t) apt_task_ready(apt_task_t *task); - -/** - * Get the running flag. - * @param task the task - */ -APT_DECLARE(apt_bool_t*) apt_task_running_flag_get(apt_task_t *task); - -/** - * Add start request. - * @param task the task - */ -APT_DECLARE(apt_bool_t) apt_task_start_request_add(apt_task_t *task); - -/** - * Remove start request. - * @param task the task - */ -APT_DECLARE(apt_bool_t) apt_task_start_request_remove(apt_task_t *task); - -/** - * Add termination request. - * @param task the task - */ -APT_DECLARE(apt_bool_t) apt_task_terminate_request_add(apt_task_t *task); - -/** - * Remove termination request. - * @param task the task - */ -APT_DECLARE(apt_bool_t) apt_task_terminate_request_remove(apt_task_t *task); - -/** - * Hold task execution. - * @param msec the time to hold - */ -APT_DECLARE(void) apt_task_delay(apr_size_t msec); - - -/** Table of task virtual methods */ -struct apt_task_vtable_t { - /** Virtual destroy method */ - apt_task_method_f destroy; - /** Virtual start method*/ - apt_task_method_f start; - /** Virtual terminate method */ - apt_task_method_f terminate; - /** Virtual run method*/ - apt_task_method_f run; - - /** Virtual signal_msg method */ - apt_bool_t (*signal_msg)(apt_task_t *task, apt_task_msg_t *msg); - /** Virtual process_msg method */ - apt_bool_t (*process_msg)(apt_task_t *task, apt_task_msg_t *msg); - - /** Virtual process_start method */ - apt_bool_t (*process_start)(apt_task_t *task); - /** Virtual process_terminate method */ - apt_bool_t (*process_terminate)(apt_task_t *task); - - /** Virtual pre-run event handler */ - apt_task_event_f on_pre_run; - /** Virtual post-run event handler */ - apt_task_event_f on_post_run; - /** Virtual start-complete event handler */ - apt_task_event_f on_start_complete; - /** Virtual terminate-complete event handler */ - apt_task_event_f on_terminate_complete; - /** Virtual take-offline-complete event handler */ - apt_task_event_f on_offline_complete; - /** Virtual bring-online-complete event handler */ - apt_task_event_f on_online_complete; -}; - -APT_END_EXTERN_C - -#endif /* APT_TASK_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_task_msg.h b/libs/unimrcp/libs/apr-toolkit/include/apt_task_msg.h deleted file mode 100644 index afb01d2cd6..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_task_msg.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_task_msg.h 2180 2014-09-13 21:17:24Z achaloyan@gmail.com $ - */ - -#ifndef APT_TASK_MSG_H -#define APT_TASK_MSG_H - -/** - * @file apt_task_msg.h - * @brief Task Message Base Definition - */ - -#include "apt.h" - -APT_BEGIN_EXTERN_C - -/** Enumeration of task message types */ -typedef enum { - TASK_MSG_CORE, /**< core task message type */ - TASK_MSG_USER /**< user defined task messages start from here */ -} apt_task_msg_type_e; - -/** Enumeration of core task messages */ -typedef enum { - CORE_TASK_MSG_NONE, /**< indefinite message */ - CORE_TASK_MSG_START_COMPLETE, /**< start-complete message */ - CORE_TASK_MSG_TERMINATE_REQUEST, /**< terminate-request message */ - CORE_TASK_MSG_TERMINATE_COMPLETE, /**< terminate-complete message */ - CORE_TASK_MSG_TAKEOFFLINE_REQUEST, /**< take-offline-request message */ - CORE_TASK_MSG_TAKEOFFLINE_COMPLETE, /**< take-offline-complete message */ - CORE_TASK_MSG_BRINGONLINE_REQUEST, /**< bring-online-request message */ - CORE_TASK_MSG_BRINGONLINE_COMPLETE, /**< bring-online-complete message */ -} apt_core_task_msg_type_e; - -/** Opaque task message declaration */ -typedef struct apt_task_msg_t apt_task_msg_t; -/** Opaque task message pool declaration */ -typedef struct apt_task_msg_pool_t apt_task_msg_pool_t; - -/** Task message is used for inter task communication */ -struct apt_task_msg_t { - /** Message pool the task message is allocated from */ - apt_task_msg_pool_t *msg_pool; - /** Task msg type */ - int type; - /** Task msg sub type */ - int sub_type; - /** Context specific data */ - char data[1]; -}; - - -/** Create pool of task messages with dynamic allocation of messages (no actual pool is created) */ -APT_DECLARE(apt_task_msg_pool_t*) apt_task_msg_pool_create_dynamic(apr_size_t msg_size, apr_pool_t *pool); - -/** Create pool of task messages with static allocation of messages */ -APT_DECLARE(apt_task_msg_pool_t*) apt_task_msg_pool_create_static(apr_size_t msg_size, apr_size_t msg_pool_size, apr_pool_t *pool); - -/** Destroy pool of task messages */ -APT_DECLARE(void) apt_task_msg_pool_destroy(apt_task_msg_pool_t *msg_pool); - - -/** Acquire task message from task message pool */ -APT_DECLARE(apt_task_msg_t*) apt_task_msg_acquire(apt_task_msg_pool_t *task_msg_pool); - -/** Realese task message */ -APT_DECLARE(void) apt_task_msg_release(apt_task_msg_t *task_msg); - - -APT_END_EXTERN_C - -#endif /* APT_TASK_MSG_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_test_suite.h b/libs/unimrcp/libs/apr-toolkit/include/apt_test_suite.h deleted file mode 100644 index 13e9003302..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_test_suite.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_test_suite.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef APT_TEST_SUITE_H -#define APT_TEST_SUITE_H - -/** - * @file apt_test_suite.h - * @brief Test Suite and Framework Definitions - */ - -#include "apt_string.h" - -APT_BEGIN_EXTERN_C - - -/** Opaque test suite declaration */ -typedef struct apt_test_suite_t apt_test_suite_t; - -/** Prototype of test function */ -typedef apt_bool_t (*apt_test_f)(apt_test_suite_t *suite, int argc, const char * const *argv); - -/** Test suite as a base for all kind of tests */ -struct apt_test_suite_t { - /** Memory pool to allocate memory from */ - apr_pool_t *pool; - /** Unique name of the test suite */ - apt_str_t name; - /** External object associated with the test suite */ - void *obj; - /** Test function to execute */ - apt_test_f tester; -}; - -/** - * Create test suite. - * @param pool the pool to allocate memory from - * @param name the unique name of the test suite - * @param obj the external object associated with the test suite - * @param tester the test function to execute - */ -APT_DECLARE(apt_test_suite_t*) apt_test_suite_create(apr_pool_t *pool, const char *name, - void *obj, apt_test_f tester); - - - - - -/** Opaque test framework declaration */ -typedef struct apt_test_framework_t apt_test_framework_t; - -/** - * Create test framework. - */ -APT_DECLARE(apt_test_framework_t*) apt_test_framework_create(void); - -/** - * Destroy test framework. - * @param framework the test framework to destroy - */ -APT_DECLARE(void) apt_test_framework_destroy(apt_test_framework_t *framework); - -/** - * Add test suite to framework. - * @param framework the test framework to add test suite to - * @param suite the test suite to add - */ -APT_DECLARE(apt_bool_t) apt_test_framework_suite_add(apt_test_framework_t *framework, apt_test_suite_t *suite); - -/** - * Run test suites. - * @param framework the test framework - * @param argc the number of arguments - * @param argv the array of arguments - */ -APT_DECLARE(apt_bool_t) apt_test_framework_run(apt_test_framework_t *framework, int argc, const char * const *argv); - -/** - * Retrieve the memory pool. - * @param framework the test framework to retrieve memory pool from - */ -APT_DECLARE(apr_pool_t*) apt_test_framework_pool_get(const apt_test_framework_t *framework); - -APT_END_EXTERN_C - -#endif /* APT_TEST_SUITE_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_text_message.h b/libs/unimrcp/libs/apr-toolkit/include/apt_text_message.h deleted file mode 100644 index 48e2f7c4c0..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_text_message.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_text_message.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef APT_TEXT_MESSAGE_H -#define APT_TEXT_MESSAGE_H - -/** - * @file apt_text_message.h - * @brief Text Message Interface (RFC5322) - */ - -#include "apt_header_field.h" -#include "apt_text_stream.h" - -APT_BEGIN_EXTERN_C - -/** Status of text message processing (parsing/generation) */ -typedef enum { - APT_MESSAGE_STATUS_COMPLETE, - APT_MESSAGE_STATUS_INCOMPLETE, - APT_MESSAGE_STATUS_INVALID -} apt_message_status_e; - - -/** Opaque text message parser */ -typedef struct apt_message_parser_t apt_message_parser_t; -/** Vtable of text message parser */ -typedef struct apt_message_parser_vtable_t apt_message_parser_vtable_t; - -/** Opaque text message generator */ -typedef struct apt_message_generator_t apt_message_generator_t; -/** Vtable of text message generator */ -typedef struct apt_message_generator_vtable_t apt_message_generator_vtable_t; - -/** Temporary context associated with message and used for its parsing or generation */ -typedef struct apt_message_context_t apt_message_context_t; - -/** Create message parser */ -APT_DECLARE(apt_message_parser_t*) apt_message_parser_create(void *obj, const apt_message_parser_vtable_t *vtable, apr_pool_t *pool); - -/** Parse message by raising corresponding event handlers */ -APT_DECLARE(apt_message_status_e) apt_message_parser_run(apt_message_parser_t *parser, apt_text_stream_t *stream, void **message); - -/** Get external object associated with parser */ -APT_DECLARE(void*) apt_message_parser_object_get(apt_message_parser_t *parser); - -/** Set verbose mode for the parser */ -APT_DECLARE(void) apt_message_parser_verbose_set(apt_message_parser_t *parser, apt_bool_t verbose); - - -/** Create message generator */ -APT_DECLARE(apt_message_generator_t*) apt_message_generator_create(void *obj, const apt_message_generator_vtable_t *vtable, apr_pool_t *pool); - -/** Generate message */ -APT_DECLARE(apt_message_status_e) apt_message_generator_run(apt_message_generator_t *generator, void *message, apt_text_stream_t *stream); - -/** Get external object associated with generator */ -APT_DECLARE(void*) apt_message_generator_object_get(apt_message_generator_t *generator); - -/** Set verbose mode for the parser */ -APT_DECLARE(void) apt_message_generator_verbose_set(apt_message_generator_t *generator, apt_bool_t verbose); - - -/** Parse individual header field (name-value pair) */ -APT_DECLARE(apt_header_field_t*) apt_header_field_parse(apt_text_stream_t *stream, apr_pool_t *pool); - -/** Generate individual header field (name-value pair) */ -APT_DECLARE(apt_bool_t) apt_header_field_generate(const apt_header_field_t *header_field, apt_text_stream_t *stream); - -/** Parse header section */ -APT_DECLARE(apt_bool_t) apt_header_section_parse(apt_header_section_t *header, apt_text_stream_t *stream, apr_pool_t *pool); - -/** Generate header section */ -APT_DECLARE(apt_bool_t) apt_header_section_generate(const apt_header_section_t *header, apt_text_stream_t *stream); - - -/** Temporary context associated with message and used for its parsing or generation */ -struct apt_message_context_t { - /** Context or ptotocol specific message */ - void *message; - /** Header section of the message */ - apt_header_section_t *header; - /** Body or content of the message */ - apt_str_t *body; -}; - -/** Vtable of text message parser */ -struct apt_message_parser_vtable_t { - /** Start new message parsing by associating corresponding context and reading its start-line if applicable */ - apt_bool_t (*on_start)(apt_message_parser_t *parser, apt_message_context_t *context, apt_text_stream_t *stream, apr_pool_t *pool); - /** Header section handler is invoked when entire header section has been read and parsed into header fields */ - apt_bool_t (*on_header_complete)(apt_message_parser_t *parser, apt_message_context_t *context); - /** Body handler is invoked when entire body has been read */ - apt_bool_t (*on_body_complete)(apt_message_parser_t *parser, apt_message_context_t *context); -}; - -/** Vtable of text message generator */ -struct apt_message_generator_vtable_t { - /** Start message generation by associating corresponding context and generating message start-line if applicable */ - apt_bool_t (*on_start)(apt_message_generator_t *generator, apt_message_context_t *context, apt_text_stream_t *stream); - /** Header section handler is invoked to notify header section has been generated */ - apt_bool_t (*on_header_complete)(apt_message_generator_t *generator, apt_message_context_t *context, apt_text_stream_t *stream); - /** Body handler is invoked to notify body has been generated */ - apt_bool_t (*on_body_complete)(apt_message_generator_t *generator, apt_message_context_t *context, apt_text_stream_t *stream); -}; - - -APT_END_EXTERN_C - -#endif /* APT_TEXT_MESSAGE_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_text_stream.h b/libs/unimrcp/libs/apr-toolkit/include/apt_text_stream.h deleted file mode 100644 index 7510afd9bc..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_text_stream.h +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_text_stream.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef APT_TEXT_STREAM_H -#define APT_TEXT_STREAM_H - -/** - * @file apt_text_stream.h - * @brief Text Stream Parse/Generate Routine - */ - -#include "apt_string_table.h" -#include "apt_pair.h" - -APT_BEGIN_EXTERN_C - -/** Space */ -#define APT_TOKEN_SP 0x20 -/** Horizontal tab */ -#define APT_TOKEN_HTAB 0x09 -/** Carrige return */ -#define APT_TOKEN_CR 0x0D -/** Line feed */ -#define APT_TOKEN_LF 0x0A - -/** Text stream declaration */ -typedef struct apt_text_stream_t apt_text_stream_t; - -/** Text stream is used for message parsing and generation */ -struct apt_text_stream_t { - /** Text stream */ - apt_str_t text; - - /** Current position in the stream */ - char *pos; - /** End of stream pointer */ - const char *end; - /** Is end of stream reached */ - apt_bool_t is_eos; -}; - - -/** - * Read entire line of the text stream. - * @param stream the text stream to navigate on - * @param line the read line to return - * @return TRUE if the line is successfully read, otherwise FALSE - * @remark To be used to navigate through the lines of the text stream (message). - */ -APT_DECLARE(apt_bool_t) apt_text_line_read(apt_text_stream_t *stream, apt_str_t *line); - -/** - * Read header field (name-value pair) of the text stream by scanning entire line. - * @param stream the text stream to navigate - * @param pair the read pair to return - * @return TRUE if the header is successfully read, otherwise FALSE - * @remark To be used to navigate through the lines and read header fields - * (name:value pairs) of the text stream (message). - */ -APT_DECLARE(apt_bool_t) apt_text_header_read(apt_text_stream_t *stream, apt_pair_t *pair); - -/** - * Read the field terminated with specified separator. - * @param stream the text stream to navigate - * @param separator the field separator - * @param skip_spaces whether to skip spaces or not - * @param field the read field to return - * @return TRUE if the read field isn't empty, otherwise FALSE - * @remark To be used to navigate through the fields of the text stream (message). - */ -APT_DECLARE(apt_bool_t) apt_text_field_read(apt_text_stream_t *stream, char separator, apt_bool_t skip_spaces, apt_str_t *field); - -/** Generate name-value pair line */ -APT_DECLARE(apt_bool_t) apt_text_name_value_insert(apt_text_stream_t *stream, const apt_str_t *name, const apt_str_t *value); - -/** Generate only the name ("name:") of the header field */ -APT_DECLARE(apt_bool_t) apt_text_header_name_insert(apt_text_stream_t *stream, const apt_str_t *name); - -/** Parse array of name-value pairs */ -APT_DECLARE(apt_bool_t) apt_pair_array_parse(apt_pair_arr_t *arr, const apt_str_t *value, apr_pool_t *pool); -/** Generate array of name-value pairs */ -APT_DECLARE(apt_bool_t) apt_pair_array_generate(const apt_pair_arr_t *arr, apt_str_t *str, apr_pool_t *pool); - - -/** Parse boolean-value */ -APT_DECLARE(apt_bool_t) apt_boolean_value_parse(const apt_str_t *str, apt_bool_t *value); -/** Generate apr_size_t value from pool (buffer is allocated from pool) */ -APT_DECLARE(apt_bool_t) apt_boolean_value_generate(apt_bool_t value, apt_str_t *str, apr_pool_t *pool); - -/** Parse apr_size_t value */ -APT_DECLARE(apr_size_t) apt_size_value_parse(const apt_str_t *str); -/** Generate apr_size_t value from pool (buffer is allocated from pool) */ -APT_DECLARE(apt_bool_t) apt_size_value_generate(apr_size_t value, apt_str_t *str, apr_pool_t *pool); - -/** Insert apr_size_t value */ -APT_DECLARE(apt_bool_t) apt_text_size_value_insert(apt_text_stream_t *stream, apr_size_t value); - -/** Parse float value */ -APT_DECLARE(float) apt_float_value_parse(const apt_str_t *str); -/** Generate float value (buffer is allocated from pool) */ -APT_DECLARE(apt_bool_t) apt_float_value_generate(float value, apt_str_t *str, apr_pool_t *pool); - -/** Insert float value */ -APT_DECLARE(apt_bool_t) apt_text_float_value_insert(apt_text_stream_t *stream, float value); -/** Insert string value */ -APT_DECLARE(apt_bool_t) apt_text_string_insert(apt_text_stream_t *stream, const apt_str_t *str); - -/** Reset navigation related data of the text stream */ -static APR_INLINE void apt_text_stream_reset(apt_text_stream_t *stream) -{ - stream->pos = stream->text.buf; - stream->end = stream->text.buf + stream->text.length; - stream->is_eos = FALSE; -} - -/** Initialize text stream */ -static APR_INLINE void apt_text_stream_init(apt_text_stream_t *stream, char *buffer, apr_size_t size) -{ - stream->text.buf = buffer; - stream->text.length = size; - apt_text_stream_reset(stream); -} - -/** Insert end of the line symbol(s) */ -static APR_INLINE apt_bool_t apt_text_eol_insert(apt_text_stream_t *stream) -{ - if(stream->pos + 2 < stream->end) { - *stream->pos++ = APT_TOKEN_CR; - *stream->pos++ = APT_TOKEN_LF; - return TRUE; - } - return FALSE; -} - -/** Insert character */ -static APR_INLINE apt_bool_t apt_text_char_insert(apt_text_stream_t *stream, char ch) -{ - if(stream->pos + 1 < stream->end) { - *stream->pos++ = ch; - return TRUE; - } - return FALSE; -} - -/** Insert space */ -static APR_INLINE apt_bool_t apt_text_space_insert(apt_text_stream_t *stream) -{ - return apt_text_char_insert(stream,APT_TOKEN_SP); -} - -/** Insert space */ -static APR_INLINE apt_bool_t apt_text_htab_insert(apt_text_stream_t *stream) -{ - return apt_text_char_insert(stream,APT_TOKEN_HTAB); -} - -/** Check whether specified character is a white space (WSP = SP / HTAB) */ -static APR_INLINE apt_bool_t apt_text_is_wsp(char ch) -{ - return (ch == APT_TOKEN_SP || ch == APT_TOKEN_HTAB) ? TRUE : FALSE; -} - -/** Skip sequence of spaces */ -static APR_INLINE void apt_text_spaces_skip(apt_text_stream_t *stream) -{ - while(stream->pos < stream->end && *stream->pos == APT_TOKEN_SP) - stream->pos++; -} - -/** Skip sequence of white spaces (WSP = SP / HTAB) */ -static APR_INLINE void apt_text_white_spaces_skip(apt_text_stream_t *stream) -{ - while(stream->pos < stream->end && apt_text_is_wsp(*stream->pos) == TRUE) - stream->pos++; -} - -/** Skip specified character */ -static APR_INLINE void apt_text_char_skip(apt_text_stream_t *stream, char ch) -{ - if(stream->pos < stream->end && *stream->pos == ch) stream->pos++; -} - -/** Skip sequence of specified characters */ -static APR_INLINE void apt_text_chars_skip(apt_text_stream_t *stream, char ch) -{ - while(stream->pos < stream->end && *stream->pos == ch) stream->pos++; -} - -/** Skip to specified character */ -static APR_INLINE void apt_text_skip_to_char(apt_text_stream_t *stream, char ch) -{ - while(stream->pos < stream->end && *stream->pos != ch) stream->pos++; -} - -/** Check whether end of stream is reached */ -static APR_INLINE apt_bool_t apt_text_is_eos(const apt_text_stream_t *stream) -{ - return (stream->pos >= stream->end || stream->is_eos == TRUE) ? TRUE : FALSE; -} - -/** Scroll text stream */ -APT_DECLARE(apt_bool_t) apt_text_stream_scroll(apt_text_stream_t *stream); - -/** Parse id at resource string */ -APT_DECLARE(apt_bool_t) apt_id_resource_parse(const apt_str_t *str, char separator, apt_str_t *id, apt_str_t *resource, apr_pool_t *pool); -/** Generate id at resource string */ -APT_DECLARE(apt_bool_t) apt_id_resource_generate(const apt_str_t *id, const apt_str_t *resource, char separator, apt_str_t *str, apr_pool_t *pool); - -/** Generate value plus the length (number of digits) of the value itself */ -APT_DECLARE(apt_bool_t) apt_var_length_value_generate(apr_size_t *value, apr_size_t max_count, apt_str_t *str); - -/** Generate completion-cause */ -APT_DECLARE(apt_bool_t) apt_completion_cause_generate(const apt_str_table_item_t table[], apr_size_t size, apr_size_t cause, apt_str_t *str, apr_pool_t *pool); - -/** - * Generate unique identifier (hex string) - * @param id the id to generate - * @param length the length of hex string to generate - * @param pool the pool to allocate memory from - */ -APT_DECLARE(apt_bool_t) apt_unique_id_generate(apt_str_t *id, apr_size_t length, apr_pool_t *pool); - - -APT_END_EXTERN_C - -#endif /* APT_TEXT_STREAM_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_timer_queue.h b/libs/unimrcp/libs/apr-toolkit/include/apt_timer_queue.h deleted file mode 100644 index ed04dd6514..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_timer_queue.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_timer_queue.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef APT_TIMER_QUEUE_H -#define APT_TIMER_QUEUE_H - -/** - * @file apt_timer_queue.h - * @brief Timer Queue - */ - -#include "apt.h" - -APT_BEGIN_EXTERN_C - -/** Opaque timer declaration */ -typedef struct apt_timer_t apt_timer_t; -/** Opaque timer queue declaration */ -typedef struct apt_timer_queue_t apt_timer_queue_t; - -/** Prototype of timer callback */ -typedef void (*apt_timer_proc_f)(apt_timer_t *timer, void *obj); - - -/** Create timer queue */ -APT_DECLARE(apt_timer_queue_t*) apt_timer_queue_create(apr_pool_t *pool); - -/** Destroy timer queue */ -APT_DECLARE(void) apt_timer_queue_destroy(apt_timer_queue_t *timer_queue); - -/** Advance scheduled timers */ -APT_DECLARE(void) apt_timer_queue_advance(apt_timer_queue_t *timer_queue, apr_uint32_t elapsed_time); - -/** Is timer queue empty */ -APT_DECLARE(apt_bool_t) apt_timer_queue_is_empty(const apt_timer_queue_t *timer_queue); - -/** Get current timeout */ -APT_DECLARE(apt_bool_t) apt_timer_queue_timeout_get(const apt_timer_queue_t *timer_queue, apr_uint32_t *timeout); - - -/** Create timer */ -APT_DECLARE(apt_timer_t*) apt_timer_create(apt_timer_queue_t *timer_queue, apt_timer_proc_f proc, void *obj, apr_pool_t *pool); - -/** Set one-shot timer */ -APT_DECLARE(apt_bool_t) apt_timer_set(apt_timer_t *timer, apr_uint32_t timeout); - -/** Kill timer */ -APT_DECLARE(apt_bool_t) apt_timer_kill(apt_timer_t *timer); - - -APT_END_EXTERN_C - -#endif /* APT_TIMER_QUEUE_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_consumer_task.c b/libs/unimrcp/libs/apr-toolkit/src/apt_consumer_task.c deleted file mode 100644 index 67a9ea70dd..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_consumer_task.c +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_consumer_task.c 2224 2014-11-12 00:41:45Z achaloyan@gmail.com $ - */ - -#include -#include -#include "apt_consumer_task.h" -#include "apt_log.h" - -struct apt_consumer_task_t { - void *obj; - apt_task_t *base; - apr_queue_t *msg_queue; -#if APR_HAS_QUEUE_TIMEOUT - apt_timer_queue_t *timer_queue; -#endif -}; - -static apt_bool_t apt_consumer_task_msg_signal(apt_task_t *task, apt_task_msg_t *msg); -static apt_bool_t apt_consumer_task_run(apt_task_t *task); - -APT_DECLARE(apt_consumer_task_t*) apt_consumer_task_create( - void *obj, - apt_task_msg_pool_t *msg_pool, - apr_pool_t *pool) -{ - apt_task_vtable_t *vtable; - apt_consumer_task_t *consumer_task = apr_palloc(pool,sizeof(apt_consumer_task_t)); - consumer_task->obj = obj; - consumer_task->msg_queue = NULL; - if(apr_queue_create(&consumer_task->msg_queue,1024,pool) != APR_SUCCESS) { - return NULL; - } - - consumer_task->base = apt_task_create(consumer_task,msg_pool,pool); - if(!consumer_task->base) { - return NULL; - } - - vtable = apt_task_vtable_get(consumer_task->base); - if(vtable) { - vtable->run = apt_consumer_task_run; - vtable->signal_msg = apt_consumer_task_msg_signal; - } - -#if APR_HAS_QUEUE_TIMEOUT - consumer_task->timer_queue = apt_timer_queue_create(pool); -#endif - - return consumer_task; -} - -APT_DECLARE(apt_task_t*) apt_consumer_task_base_get(const apt_consumer_task_t *task) -{ - return task->base; -} - -APT_DECLARE(apt_task_vtable_t*) apt_consumer_task_vtable_get(const apt_consumer_task_t *task) -{ - return apt_task_vtable_get(task->base); -} - -APT_DECLARE(void*) apt_consumer_task_object_get(const apt_consumer_task_t *task) -{ - return task->obj; -} - -APT_DECLARE(apt_timer_t*) apt_consumer_task_timer_create( - apt_consumer_task_t *task, - apt_timer_proc_f proc, - void *obj, - apr_pool_t *pool) -{ -#if APR_HAS_QUEUE_TIMEOUT - return apt_timer_create(task->timer_queue,proc,obj,pool); -#else - return NULL; -#endif -} - -static apt_bool_t apt_consumer_task_msg_signal(apt_task_t *task, apt_task_msg_t *msg) -{ - apt_consumer_task_t *consumer_task = apt_task_object_get(task); - return (apr_queue_push(consumer_task->msg_queue,msg) == APR_SUCCESS) ? TRUE : FALSE; -} - -static apt_bool_t apt_consumer_task_run(apt_task_t *task) -{ - apr_status_t rv; - void *msg; - apt_bool_t *running; - apt_consumer_task_t *consumer_task; -#if APR_HAS_QUEUE_TIMEOUT - apr_interval_time_t timeout; - apr_uint32_t queue_timeout; - apr_time_t time_now, time_last = 0; -#endif - const char *task_name; - - consumer_task = apt_task_object_get(task); - if(!consumer_task) { - return FALSE; - } - task_name = apt_task_name_get(consumer_task->base), - - running = apt_task_running_flag_get(task); - if(!running) { - return FALSE; - } - - while(*running) { -#if APR_HAS_QUEUE_TIMEOUT - if(apt_timer_queue_timeout_get(consumer_task->timer_queue,&queue_timeout) == TRUE) { - timeout = (apr_interval_time_t)queue_timeout * 1000; - time_last = apr_time_now(); - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Wait for Messages [%s] timeout [%u]", - task_name, queue_timeout); - rv = apr_queue_timedpop(consumer_task->msg_queue,timeout,&msg); - } - else - { - timeout = -1; - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Wait for Messages [%s]",task_name); - rv = apr_queue_pop(consumer_task->msg_queue,&msg); - } -#else - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Wait for Messages [%s]",task_name); - rv = apr_queue_pop(consumer_task->msg_queue,&msg); -#endif - if(rv == APR_SUCCESS) { - if(msg) { - apt_task_msg_t *task_msg = msg; - apt_task_msg_process(consumer_task->base,task_msg); - } - } - else if(rv != APR_TIMEUP) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Pop Message [%s] status: %d",task_name,rv); - } - -#if APR_HAS_QUEUE_TIMEOUT - if(timeout != -1) { - time_now = apr_time_now(); - if(time_now > time_last) { - apt_timer_queue_advance(consumer_task->timer_queue,(apr_uint32_t)((time_now - time_last)/1000)); - } - } -#endif - } - return TRUE; -} diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_cyclic_queue.c b/libs/unimrcp/libs/apr-toolkit/src/apt_cyclic_queue.c deleted file mode 100644 index 896a9f66fb..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_cyclic_queue.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_cyclic_queue.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include "apt_cyclic_queue.h" - -struct apt_cyclic_queue_t { - void **data; - apr_size_t max_size; - apr_size_t actual_size; - apr_size_t head; - apr_size_t tail; -}; - -static apt_bool_t apt_cyclic_queue_resize(apt_cyclic_queue_t *queue); - - -APT_DECLARE(apt_cyclic_queue_t*) apt_cyclic_queue_create(apr_size_t size) -{ - apt_cyclic_queue_t *queue = malloc(sizeof(apt_cyclic_queue_t)); - queue->max_size = size; - queue->actual_size = 0; - queue->data = malloc(sizeof(void*) * queue->max_size); - queue->head = queue->tail = 0; - return queue; -} - -APT_DECLARE(void) apt_cyclic_queue_destroy(apt_cyclic_queue_t *queue) -{ - if(queue->data) { - free(queue->data); - queue->data = NULL; - } - free(queue); -} - -APT_DECLARE(apt_bool_t) apt_cyclic_queue_push(apt_cyclic_queue_t *queue, void *obj) -{ - if(queue->actual_size >= queue->max_size) { - if(apt_cyclic_queue_resize(queue) != TRUE) { - return FALSE; - } - } - - queue->data[queue->head] = obj; - queue->head = (queue->head + 1) % queue->max_size; - queue->actual_size++; - return TRUE; -} - -APT_DECLARE(void*) apt_cyclic_queue_pop(apt_cyclic_queue_t *queue) -{ - void *obj = NULL; - if(queue->actual_size) { - obj = queue->data[queue->tail]; - queue->tail = (queue->tail + 1) % queue->max_size; - queue->actual_size--; - } - return obj; -} - -APT_DECLARE(void) apt_cyclic_queue_clear(apt_cyclic_queue_t *queue) -{ - queue->actual_size = 0; - queue->head = queue->tail = 0; -} - -APT_DECLARE(apt_bool_t) apt_cyclic_queue_is_empty(const apt_cyclic_queue_t *queue) -{ - return queue->actual_size ? TRUE : FALSE; -} - -static apt_bool_t apt_cyclic_queue_resize(apt_cyclic_queue_t *queue) -{ - apr_size_t new_size = queue->max_size + queue->max_size/2; - void **new_data = malloc(sizeof(void*) * new_size); - apr_size_t offset; - - offset = queue->max_size - queue->head; - memcpy(new_data, queue->data + queue->head, sizeof(void*) * offset); - if(queue->head) { - memcpy(new_data + offset, queue->data, sizeof(void*) * queue->head); - } - - queue->tail = 0; - queue->head = queue->max_size; - queue->max_size = new_size; - free(queue->data); - queue->data = new_data; - return TRUE; -} diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_dir_layout.c b/libs/unimrcp/libs/apr-toolkit/src/apt_dir_layout.c deleted file mode 100644 index 4fe3f4a120..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_dir_layout.c +++ /dev/null @@ -1,317 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_dir_layout.c 2204 2014-10-31 01:01:42Z achaloyan@gmail.com $ - */ - -#include -#include -#include "apt_dir_layout.h" - -/** Directories layout */ -struct apt_dir_layout_t { - /** Array of the directory paths the layout is composed of */ - const char **paths; - /** Number of directories in the layout */ - apr_size_t count; -}; - -/** Default labels matching the entries in configuration */ -static const char *default_labels[APT_LAYOUT_DIR_COUNT] = { - "confdir", /* APT_LAYOUT_CONF_DIR */ - "plugindir", /* APT_LAYOUT_PLUGIN_DIR */ - "logdir", /* APT_LAYOUT_LOG_DIR */ - "datadir", /* APT_LAYOUT_DATA_DIR */ - "vardir", /* APT_LAYOUT_VAR_DIR */ -}; - -static const char* apt_default_root_dir_path_get(apr_pool_t *pool) -{ - char *root_dir_path; - char *cur_dir_path; - /* Get the current directory */ - if(apr_filepath_get(&cur_dir_path,APR_FILEPATH_NATIVE,pool) != APR_SUCCESS) - return NULL; - - /* Root directory is supposed to be one level up by default */ - if(apr_filepath_merge(&root_dir_path,cur_dir_path,"../",APR_FILEPATH_NATIVE,pool) != APR_SUCCESS) - return FALSE; - - return root_dir_path; -} - -static apt_bool_t apt_dir_layout_path_set_internal(apt_dir_layout_t *dir_layout, apr_size_t dir_entry_id, const char *path) -{ - if(dir_entry_id >= dir_layout->count) - return FALSE; - - dir_layout->paths[dir_entry_id] = path; - return TRUE; -} - -APT_DECLARE(apt_dir_layout_t*) apt_dir_layout_create(apr_pool_t *pool) -{ - return apt_dir_layout_create_ext(APT_LAYOUT_DIR_COUNT,pool); -} - -APT_DECLARE(apt_dir_layout_t*) apt_dir_layout_create_ext(apr_size_t count, apr_pool_t *pool) -{ - apt_dir_layout_t *dir_layout = (apt_dir_layout_t*) apr_palloc(pool,sizeof(apt_dir_layout_t)); - dir_layout->count = count; - dir_layout->paths = apr_pcalloc(pool,count*sizeof(char*)); - return dir_layout; -} - -APT_DECLARE(apt_dir_layout_t*) apt_default_dir_layout_create(const char *root_dir_path, apr_pool_t *pool) -{ - apt_dir_layout_t *dir_layout = apt_dir_layout_create_ext(APT_LAYOUT_DIR_COUNT,pool); - - if(!root_dir_path) { - /* If root dir path is not specified, get the default one */ - root_dir_path = apt_default_root_dir_path_get(pool); - } - - if(root_dir_path) { - char *path; - - apr_filepath_merge(&path,root_dir_path,"conf",APR_FILEPATH_NATIVE,pool); - apt_dir_layout_path_set_internal(dir_layout,APT_LAYOUT_CONF_DIR,path); - - apr_filepath_merge(&path,root_dir_path,"plugin",APR_FILEPATH_NATIVE,pool); - apt_dir_layout_path_set_internal(dir_layout,APT_LAYOUT_PLUGIN_DIR,path); - - apr_filepath_merge(&path,root_dir_path,"log",APR_FILEPATH_NATIVE,pool); - apt_dir_layout_path_set_internal(dir_layout,APT_LAYOUT_LOG_DIR,path); - - apr_filepath_merge(&path,root_dir_path,"data",APR_FILEPATH_NATIVE,pool); - apt_dir_layout_path_set_internal(dir_layout,APT_LAYOUT_DATA_DIR,path); - - apr_filepath_merge(&path,root_dir_path,"var",APR_FILEPATH_NATIVE,pool); - apt_dir_layout_path_set_internal(dir_layout,APT_LAYOUT_VAR_DIR,path); - } - return dir_layout; -} - -APT_DECLARE(apt_dir_layout_t*) apt_custom_dir_layout_create( - const char *conf_dir_path, - const char *plugin_dir_path, - const char *log_dir_path, - const char *data_dir_path, - const char *var_dir_path, - apr_pool_t *pool) -{ - apt_dir_layout_t *dir_layout = apt_dir_layout_create_ext(APT_LAYOUT_DIR_COUNT,pool); - - apt_dir_layout_path_set(dir_layout,APT_LAYOUT_CONF_DIR,conf_dir_path,pool); - apt_dir_layout_path_set(dir_layout,APT_LAYOUT_PLUGIN_DIR,plugin_dir_path,pool); - apt_dir_layout_path_set(dir_layout,APT_LAYOUT_LOG_DIR,log_dir_path,pool); - apt_dir_layout_path_set(dir_layout,APT_LAYOUT_DATA_DIR,data_dir_path,pool); - apt_dir_layout_path_set(dir_layout,APT_LAYOUT_VAR_DIR,log_dir_path,pool); - - return dir_layout; -} - -static apt_bool_t apt_dir_entry_id_by_label(const char **labels, apr_size_t count, const char *name, apr_size_t *id) -{ - apr_size_t i; - for(i=0; ifirst_cdata.first || !elem->first_cdata.first->text) { - return NULL; - } - - path = apr_pstrdup(pool,elem->first_cdata.first->text); - apr_collapse_spaces(path,path); - - /* Check if path is absolute or relative */ - status = apt_dir_is_path_absolute(path,pool); - if(status == APR_SUCCESS) { - /* Absolute path specified */ - return path; - } - else if (status == APR_ERELATIVE) { - /* Relative path specified -> merge it with the root path */ - if(apr_filepath_merge(&full_path,root_dir_path,path,APR_FILEPATH_NATIVE,pool) == APR_SUCCESS) { - return full_path; - } - } - - /* WARNING: invalid path specified */ - return NULL; -} - -APT_DECLARE(apt_bool_t) apt_dir_layout_load(apt_dir_layout_t *dir_layout, const char *config_file, apr_pool_t *pool) -{ - return apt_dir_layout_load_ext(dir_layout,config_file,default_labels,APT_LAYOUT_DIR_COUNT,pool); -} - -APT_DECLARE(apt_bool_t) apt_dir_layout_load_ext(apt_dir_layout_t *dir_layout, const char *config_file, const char **labels, apr_size_t count, apr_pool_t *pool) -{ - apr_xml_doc *doc; - const apr_xml_elem *elem; - const apr_xml_elem *root; - const apr_xml_attr *xml_attr; - char *path; - const char *root_dir_path = NULL; - apr_size_t id; - - if(!dir_layout || !config_file || !labels || !count) { - return FALSE; - } - - /* Parse XML document */ - doc = apt_dir_layout_doc_parse(config_file,pool); - if(!doc) { - return FALSE; - } - - root = doc->root; - - /* Match document name */ - if(!root || strcasecmp(root->name,"dirlayout") != 0) { - /* Unknown document */ - return FALSE; - } - - /* Find rootdir attribute */ - for(xml_attr = root->attr; xml_attr; xml_attr = xml_attr->next) { - if(strcasecmp(xml_attr->name, "rootdir") == 0) { - root_dir_path = xml_attr->value; - break; - } - } - - if(root_dir_path) { - /* If root dir path is specified, check if it is absolute or relative */ - apr_status_t status = apt_dir_is_path_absolute(root_dir_path,pool); - if(status == APR_ERELATIVE) { - /* Relative path specified -> make it absolute */ - char *full_path; - char *cur_dir_path; - /* Get the current directory */ - if(apr_filepath_get(&cur_dir_path,APR_FILEPATH_NATIVE,pool) != APR_SUCCESS) - return FALSE; - - /* Merge it with path specified */ - if(apr_filepath_merge(&full_path,cur_dir_path,root_dir_path,APR_FILEPATH_NATIVE,pool) != APR_SUCCESS) - return FALSE; - root_dir_path = full_path; - } - } - else { - /* If root dir path is not specified, get the default one */ - root_dir_path = apt_default_root_dir_path_get(pool); - } - - /* Navigate through document */ - for(elem = root->first_child; elem; elem = elem->next) { - if(apt_dir_entry_id_by_label(labels,dir_layout->count,elem->name,&id) == TRUE) { - path = apt_dir_layout_subdir_parse(root_dir_path,elem,pool); - if(path) { - apt_dir_layout_path_set_internal(dir_layout,id,path); - } - } - else { - /* Unknown element */ - } - } - return TRUE; -} - -APT_DECLARE(apt_bool_t) apt_dir_layout_path_set(apt_dir_layout_t *dir_layout, apr_size_t dir_entry_id, const char *path, apr_pool_t *pool) -{ - if(!dir_layout || dir_entry_id >= dir_layout->count || !path) - return FALSE; - - dir_layout->paths[dir_entry_id] = apr_pstrdup(pool,path); - return TRUE; -} - -APT_DECLARE(const char*) apt_dir_layout_path_get(const apt_dir_layout_t *dir_layout, apr_size_t dir_entry_id) -{ - if(!dir_layout || dir_entry_id >= dir_layout->count) - return NULL; - - return dir_layout->paths[dir_entry_id]; -} - -APT_DECLARE(char*) apt_dir_layout_path_compose(const apt_dir_layout_t *dir_layout, apr_size_t dir_entry_id, const char *file_name, apr_pool_t *pool) -{ - char *file_path; - if(!dir_layout || dir_entry_id >= dir_layout->count) - return NULL; - - if(apr_filepath_merge(&file_path,dir_layout->paths[dir_entry_id],file_name,APR_FILEPATH_NATIVE,pool) == APR_SUCCESS) { - return file_path; - } - return NULL; -} - -APT_DECLARE(char*) apt_confdir_filepath_get(const apt_dir_layout_t *dir_layout, const char *file_name, apr_pool_t *pool) -{ - return apt_dir_layout_path_compose(dir_layout,APT_LAYOUT_CONF_DIR,file_name,pool); -} - -APT_DECLARE(char*) apt_datadir_filepath_get(const apt_dir_layout_t *dir_layout, const char *file_name, apr_pool_t *pool) -{ - return apt_dir_layout_path_compose(dir_layout,APT_LAYOUT_DATA_DIR,file_name,pool); -} - -APT_DECLARE(char*) apt_vardir_filepath_get(const apt_dir_layout_t *dir_layout, const char *file_name, apr_pool_t *pool) -{ - return apt_dir_layout_path_compose(dir_layout,APT_LAYOUT_VAR_DIR,file_name,pool); -} diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_header_field.c b/libs/unimrcp/libs/apr-toolkit/src/apt_header_field.c deleted file mode 100644 index a00fcb5ec5..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_header_field.c +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_header_field.c 2223 2014-11-12 00:37:40Z achaloyan@gmail.com $ - */ - -#include "apt_header_field.h" -#include "apt_text_stream.h" - -#define UNKNOWN_HEADER_FIELD_ID (apr_size_t)-1 - -/** Allocate an empty header field */ -APT_DECLARE(apt_header_field_t*) apt_header_field_alloc(apr_pool_t *pool) -{ - apt_header_field_t *header_field = apr_palloc(pool,sizeof(apt_header_field_t)); - apt_string_reset(&header_field->name); - apt_string_reset(&header_field->value); - header_field->id = UNKNOWN_HEADER_FIELD_ID; - APR_RING_ELEM_INIT(header_field,link); - return header_field; -} - -/** Create a header field using given name and value APT strings */ -APT_DECLARE(apt_header_field_t*) apt_header_field_create(const apt_str_t *name, const apt_str_t *value, apr_pool_t *pool) -{ - apt_header_field_t *header_field; - if(!name || !value) { - return NULL; - } - header_field = apr_palloc(pool,sizeof(apt_header_field_t)); - apt_string_copy(&header_field->name,name,pool); - apt_string_copy(&header_field->value,value,pool); - header_field->id = UNKNOWN_HEADER_FIELD_ID; - APR_RING_ELEM_INIT(header_field,link); - return header_field; -} - -/** Create a header field using given name and value C strings */ -APT_DECLARE(apt_header_field_t*) apt_header_field_create_c(const char *name, const char *value, apr_pool_t *pool) -{ - apt_header_field_t *header_field; - if(!name || !value) { - return NULL; - } - header_field = apr_palloc(pool,sizeof(apt_header_field_t)); - apt_string_assign(&header_field->name,name,pool); - apt_string_assign(&header_field->value,value,pool); - header_field->id = UNKNOWN_HEADER_FIELD_ID; - APR_RING_ELEM_INIT(header_field,link); - return header_field; -} - -/* Create a header field from entire text line consisting of a name and value pair */ -APT_DECLARE(apt_header_field_t*) apt_header_field_create_from_line(const apt_str_t *line, char separator, apr_pool_t *pool) -{ - apt_str_t item; - apt_text_stream_t stream; - apt_header_field_t *header_field; - if(!line) { - return NULL; - } - - header_field = apr_palloc(pool,sizeof(apt_header_field_t)); - stream.text = *line; - apt_text_stream_reset(&stream); - - /* read name */ - if(apt_text_field_read(&stream,separator,TRUE,&item) == FALSE) { - return NULL; - } - apt_string_copy(&header_field->name,&item,pool); - - /* read value */ - if(apt_text_field_read(&stream,0,TRUE,&item) == TRUE) { - apt_string_copy(&header_field->value,&item,pool); - } - else { - apt_string_reset(&header_field->value); - } - - header_field->id = UNKNOWN_HEADER_FIELD_ID; - APR_RING_ELEM_INIT(header_field,link); - return header_field; -} - -/** Copy specified header field */ -APT_DECLARE(apt_header_field_t*) apt_header_field_copy(const apt_header_field_t *src_header_field, apr_pool_t *pool) -{ - apt_header_field_t *header_field = apr_palloc(pool,sizeof(apt_header_field_t)); - apt_string_copy(&header_field->name,&src_header_field->name,pool); - apt_string_copy(&header_field->value,&src_header_field->value,pool); - header_field->id = src_header_field->id; - APR_RING_ELEM_INIT(header_field,link); - return header_field; -} - -/** Initialize header section (collection of header fields) */ -APT_DECLARE(void) apt_header_section_init(apt_header_section_t *header) -{ - APR_RING_INIT(&header->ring, apt_header_field_t, link); - header->arr = NULL; - header->arr_size = 0; -} - -/** Allocate header section to set/get header fields by numeric identifiers */ -APT_DECLARE(apt_bool_t) apt_header_section_array_alloc(apt_header_section_t *header, apr_size_t max_field_count, apr_pool_t *pool) -{ - if(!max_field_count) { - return FALSE; - } - - header->arr = (apt_header_field_t**)apr_pcalloc(pool,sizeof(apt_header_field_t*) * max_field_count); - header->arr_size = max_field_count; - return TRUE; -} - -/** Add (append) header field to header section */ -APT_DECLARE(apt_bool_t) apt_header_section_field_add(apt_header_section_t *header, apt_header_field_t *header_field) -{ - if(header_field->id < header->arr_size) { - if(header->arr[header_field->id]) { - return FALSE; - } - header->arr[header_field->id] = header_field; - } - APR_RING_INSERT_TAIL(&header->ring,header_field,apt_header_field_t,link); - return TRUE; -} - -/** Insert header field to header section based on numreic identifier if specified */ -APT_DECLARE(apt_bool_t) apt_header_section_field_insert(apt_header_section_t *header, apt_header_field_t *header_field) -{ - apt_header_field_t *it; - if(header_field->id < header->arr_size) { - if(header->arr[header_field->id]) { - return FALSE; - } - header->arr[header_field->id] = header_field; - - for(it = APR_RING_FIRST(&header->ring); - it != APR_RING_SENTINEL(&header->ring, apt_header_field_t, link); - it = APR_RING_NEXT(it, link)) { - if(header_field->id < it->id) { - APR_RING_INSERT_BEFORE(it,header_field,link); - return TRUE; - } - } - } - - APR_RING_INSERT_TAIL(&header->ring,header_field,apt_header_field_t,link); - return TRUE; -} - -/** Set header field in the array of header fields using associated numeric identifier */ -APT_DECLARE(apt_bool_t) apt_header_section_field_set(apt_header_section_t *header, apt_header_field_t *header_field) -{ - if(header_field->id >= header->arr_size) { - return FALSE; - } - if(header->arr[header_field->id]) { - return FALSE; - } - header->arr[header_field->id] = header_field; - return TRUE; -} - -/** Remove header field from header section */ -APT_DECLARE(apt_bool_t) apt_header_section_field_remove(apt_header_section_t *header, apt_header_field_t *header_field) -{ - if(header_field->id < header->arr_size) { - header->arr[header_field->id] = NULL; - } - APR_RING_REMOVE(header_field,link); - return TRUE; -} diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_log.c b/libs/unimrcp/libs/apr-toolkit/src/apt_log.c deleted file mode 100644 index 844946cf46..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_log.c +++ /dev/null @@ -1,627 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_log.c 2198 2014-10-16 01:41:19Z achaloyan@gmail.com $ - */ - -#include -#include -#include -#include -#include "apt_log.h" - -#define MAX_LOG_ENTRY_SIZE 4096 -#define MAX_PRIORITY_NAME_LENGTH 9 - -static const char priority_snames[APT_PRIO_COUNT][MAX_PRIORITY_NAME_LENGTH+1] = -{ - "[EMERG] ", - "[ALERT] ", - "[CRITIC] ", - "[ERROR] ", - "[WARN] ", - "[NOTICE] ", - "[INFO] ", - "[DEBUG] " -}; - -typedef struct apt_log_file_data_t apt_log_file_data_t; - -struct apt_log_file_data_t { - const char *log_dir_path; - const char *log_file_name; - FILE *file; - apr_size_t cur_size; - apr_size_t max_size; - apr_size_t cur_file_index; - apr_size_t max_file_count; - apt_bool_t append; - apr_thread_mutex_t *mutex; - apr_pool_t *pool; -}; - -struct apt_logger_t { - apt_log_output_e mode; - apt_log_priority_e priority; - int header; - apt_log_ext_handler_f ext_handler; - apt_log_file_data_t *file_data; - apt_log_masking_e masking; -}; - -static apt_logger_t *apt_logger = NULL; - -static apt_bool_t apt_do_log(const char *file, int line, apt_log_priority_e priority, const char *format, va_list arg_ptr); - -static const char* apt_log_file_path_make(apt_log_file_data_t *file_data); -static apt_bool_t apt_log_file_dump(apt_log_file_data_t *file_data, const char *log_entry, apr_size_t size); -static apr_xml_doc* apt_log_doc_parse(const char *file_path, apr_pool_t *pool); -static apr_size_t apt_log_file_get_size(apt_log_file_data_t *file_data); -static apr_byte_t apt_log_file_exist(apt_log_file_data_t *file_data); - -static apt_logger_t* apt_log_instance_alloc(apr_pool_t *pool) -{ - apt_logger_t *logger = apr_palloc(pool,sizeof(apt_logger_t)); - logger->mode = APT_LOG_OUTPUT_CONSOLE; - logger->priority = APT_PRIO_INFO; - logger->header = APT_LOG_HEADER_DEFAULT; - logger->ext_handler = NULL; - logger->file_data = NULL; - logger->masking = APT_LOG_MASKING_NONE; - return logger; -} - -APT_DECLARE(apt_bool_t) apt_log_instance_create(apt_log_output_e mode, apt_log_priority_e priority, apr_pool_t *pool) -{ - if(apt_logger) { - return FALSE; - } - apt_logger = apt_log_instance_alloc(pool); - apt_logger->mode = mode; - apt_logger->priority = priority; - return TRUE; -} - -APT_DECLARE(apt_bool_t) apt_log_instance_load(const char *config_file, apr_pool_t *pool) -{ - apr_xml_doc *doc; - const apr_xml_elem *elem; - const apr_xml_elem *root; - char *text; - - if(apt_logger) { - return FALSE; - } - apt_logger = apt_log_instance_alloc(pool); - - /* Parse XML document */ - doc = apt_log_doc_parse(config_file,pool); - if(!doc) { - return FALSE; - } - - root = doc->root; - - /* Match document name */ - if(!root || strcasecmp(root->name,"aptlogger") != 0) { - /* Unknown document */ - return FALSE; - } - - /* Navigate through document */ - for(elem = root->first_child; elem; elem = elem->next) { - if(!elem->first_cdata.first || !elem->first_cdata.first->text) - continue; - - text = apr_pstrdup(pool,elem->first_cdata.first->text); - apr_collapse_spaces(text,text); - - if(strcasecmp(elem->name,"priority") == 0) { - apt_logger->priority = apt_log_priority_translate(text); - } - else if(strcasecmp(elem->name,"output") == 0) { - apt_logger->mode = apt_log_output_mode_translate(text); - } - else if(strcasecmp(elem->name,"headers") == 0) { - apt_logger->header = apt_log_header_translate(text); - } - else if(strcasecmp(elem->name,"masking") == 0) { - apt_logger->masking = apt_log_masking_translate(text); - } - else { - /* Unknown element */ - } - } - return TRUE; -} - -APT_DECLARE(apt_bool_t) apt_log_instance_destroy() -{ - if(!apt_logger) { - return FALSE; - } - - if(apt_logger->file_data) { - apt_log_file_close(); - } - apt_logger = NULL; - return TRUE; -} - -APT_DECLARE(apt_logger_t*) apt_log_instance_get() -{ - return apt_logger; -} - -APT_DECLARE(apt_bool_t) apt_log_instance_set(apt_logger_t *logger) -{ - if(apt_logger){ - return FALSE; - } - apt_logger = logger; - return TRUE; -} - -APT_DECLARE(apt_bool_t) apt_log_file_open( - const char *dir_path, - const char *file_name, - apr_size_t max_file_size, - apr_size_t max_file_count, - apt_bool_t append, - apr_pool_t *pool) -{ - const char *log_file_path; - apt_log_file_data_t *file_data; - if(!apt_logger || !dir_path || !file_name) { - return FALSE; - } - - if(apt_logger->file_data) { - return FALSE; - } - - file_data = apr_palloc(pool,sizeof(apt_log_file_data_t)); - file_data->log_dir_path = apr_pstrdup(pool,dir_path); - file_data->log_file_name = apr_pstrdup(pool,file_name); - file_data->cur_file_index = 0; - file_data->cur_size = 0; - file_data->max_file_count = max_file_count; - file_data->max_size = max_file_size; - file_data->append = append; - file_data->mutex = NULL; - file_data->pool = pool; - - if(!file_data->max_size) { - file_data->max_size = MAX_LOG_FILE_SIZE; - } - if(!file_data->max_file_count) { - file_data->max_file_count = MAX_LOG_FILE_COUNT; - } - - if(file_data->append == TRUE) { - /* iteratively find the last created file */ - while(file_data->cur_file_indexmax_file_count) - { - if(apt_log_file_exist(file_data) == 0) - { - if(file_data->cur_file_index > 0) - file_data->cur_file_index--; - file_data->cur_size = apt_log_file_get_size(file_data); - break; - } - file_data->cur_file_index++; - } - - /* if all the files have been created start rewriting from beginning */ - if(file_data->cur_file_index>=file_data->max_file_count) - { - file_data->cur_file_index=0; - file_data->cur_size=0; - log_file_path = apt_log_file_path_make(file_data); - file_data->file = fopen(log_file_path,"wb"); /* truncate the first file to zero length */ - fclose(file_data->file); - } - } - - /* create mutex */ - if(apr_thread_mutex_create(&file_data->mutex,APR_THREAD_MUTEX_DEFAULT,pool) != APR_SUCCESS) { - return FALSE; - } - /* open log file */ - log_file_path = apt_log_file_path_make(file_data); - file_data->file = fopen(log_file_path,file_data->append == TRUE ? "ab" : "wb"); - if(!file_data->file) { - apr_thread_mutex_destroy(file_data->mutex); - return FALSE; - } - - apt_logger->file_data = file_data; - return TRUE; -} - -APT_DECLARE(apt_bool_t) apt_log_file_close() -{ - apt_log_file_data_t *file_data; - if(!apt_logger || !apt_logger->file_data) { - return FALSE; - } - file_data = apt_logger->file_data; - if(file_data->file) { - /* close log file */ - fclose(file_data->file); - file_data->file = NULL; - /* destroy mutex */ - apr_thread_mutex_destroy(file_data->mutex); - file_data->mutex = NULL; - } - apt_logger->file_data = NULL; - return TRUE; -} - -APT_DECLARE(apt_bool_t) apt_log_output_mode_set(apt_log_output_e mode) -{ - if(!apt_logger) { - return FALSE; - } - apt_logger->mode = mode; - return TRUE; -} - -APT_DECLARE(apt_bool_t) apt_log_output_mode_check(apt_log_output_e mode) -{ - if(!apt_logger) { - return FALSE; - } - return (apt_logger->mode & mode) ? TRUE : FALSE; -} - -APT_DECLARE(int) apt_log_output_mode_translate(char *str) -{ - int mode = APT_LOG_OUTPUT_NONE; - char *name; - char *last; - name = apr_strtok(str, ",", &last); - while(name) { - if(strcasecmp(name, "CONSOLE") == 0) - mode |= APT_LOG_OUTPUT_CONSOLE; - else if(strcasecmp(name, "FILE") == 0) - mode |= APT_LOG_OUTPUT_FILE; - - name = apr_strtok(NULL, ",", &last); - } - return mode; -} - -APT_DECLARE(apt_bool_t) apt_log_priority_set(apt_log_priority_e priority) -{ - if(!apt_logger || priority >= APT_PRIO_COUNT) { - return FALSE; - } - apt_logger->priority = priority; - return TRUE; -} - -APT_DECLARE(apt_log_priority_e) apt_log_priority_translate(const char *str) -{ - if(strcasecmp(str, "EMERGENCY") == 0) - return APT_PRIO_EMERGENCY; - else if(strcasecmp(str, "ALERT") == 0) - return APT_PRIO_ALERT; - else if(strcasecmp(str, "CRITICAL") == 0) - return APT_PRIO_CRITICAL; - else if(strcasecmp(str, "ERROR") == 0) - return APT_PRIO_ERROR; - else if(strcasecmp(str, "WARNING") == 0) - return APT_PRIO_WARNING; - else if(strcasecmp(str, "NOTICE") == 0) - return APT_PRIO_NOTICE; - else if(strcasecmp(str, "INFO") == 0) - return APT_PRIO_INFO; - else if(strcasecmp(str, "DEBUG") == 0) - return APT_PRIO_DEBUG; - - return APT_PRIO_DEBUG; -} - -APT_DECLARE(apt_bool_t) apt_log_header_set(int header) -{ - if(!apt_logger) { - return FALSE; - } - apt_logger->header = header; - return TRUE; -} - -APT_DECLARE(int) apt_log_header_translate(char *str) -{ - int header = APT_LOG_OUTPUT_NONE; - char *name; - char *last; - name = apr_strtok(str, ",", &last); - while(name) { - if(strcasecmp(name, "DATE") == 0) - header |= APT_LOG_HEADER_DATE; - else if(strcasecmp(name, "TIME") == 0) - header |= APT_LOG_HEADER_TIME; - else if(strcasecmp(name, "PRIORITY") == 0) - header |= APT_LOG_HEADER_PRIORITY; - else if(strcasecmp(name, "MARK") == 0) - header |= APT_LOG_HEADER_MARK; - else if(strcasecmp(name, "THREAD") == 0) - header |= APT_LOG_HEADER_THREAD; - - name = apr_strtok(NULL, ",", &last); - } - return header; -} - -APT_DECLARE(apt_bool_t) apt_log_masking_set(apt_log_masking_e masking) -{ - if(!apt_logger) { - return FALSE; - } - apt_logger->masking = masking; - return TRUE; -} - -APT_DECLARE(apt_log_masking_e) apt_log_masking_get(void) -{ - if(!apt_logger) { - return APT_LOG_MASKING_NONE; - } - return apt_logger->masking; -} - -APT_DECLARE(apt_log_masking_e) apt_log_masking_translate(const char *str) -{ - if(strcasecmp(str, "COMPLETE") == 0) - return APT_LOG_MASKING_COMPLETE; - else if(strcasecmp(str, "ENCRYPTED") == 0) - return APT_LOG_MASKING_ENCRYPTED; - return APT_LOG_MASKING_NONE; -} - -#define APT_MASKED_CONTENT "*** masked ***" - -APT_DECLARE(const char*) apt_log_data_mask(const char *data_in, apr_size_t *length, apr_pool_t *pool) -{ - if(!apt_logger) { - return NULL; - } - if(apt_logger->masking == APT_LOG_MASKING_COMPLETE) { - *length = sizeof(APT_MASKED_CONTENT) - 1; - return APT_MASKED_CONTENT; - } - return data_in; -} - -APT_DECLARE(apt_bool_t) apt_log_ext_handler_set(apt_log_ext_handler_f handler) -{ - if(!apt_logger) { - return FALSE; - } - apt_logger->ext_handler = handler; - return TRUE; -} - -APT_DECLARE(apt_bool_t) apt_log(const char *file, int line, apt_log_priority_e priority, const char *format, ...) -{ - apt_bool_t status = TRUE; - if(!apt_logger) { - return FALSE; - } - if(priority <= apt_logger->priority) { - va_list arg_ptr; - va_start(arg_ptr, format); - if(apt_logger->ext_handler) { - status = apt_logger->ext_handler(file,line,NULL,priority,format,arg_ptr); - } - else { - status = apt_do_log(file,line,priority,format,arg_ptr); - } - va_end(arg_ptr); - } - return status; -} - -APT_DECLARE(apt_bool_t) apt_obj_log(const char *file, int line, apt_log_priority_e priority, void *obj, const char *format, ...) -{ - apt_bool_t status = TRUE; - if(!apt_logger) { - return FALSE; - } - if(priority <= apt_logger->priority) { - va_list arg_ptr; - va_start(arg_ptr, format); - if(apt_logger->ext_handler) { - status = apt_logger->ext_handler(file,line,obj,priority,format,arg_ptr); - } - else { - status = apt_do_log(file,line,priority,format,arg_ptr); - } - va_end(arg_ptr); - } - return status; -} - -APT_DECLARE(apt_bool_t) apt_va_log(const char *file, int line, apt_log_priority_e priority, const char *format, va_list arg_ptr) -{ - apt_bool_t status = TRUE; - if(!apt_logger) { - return FALSE; - } - if(priority <= apt_logger->priority) { - if(apt_logger->ext_handler) { - status = apt_logger->ext_handler(file,line,NULL,priority,format,arg_ptr); - } - else { - status = apt_do_log(file,line,priority,format,arg_ptr); - } - } - return status; -} - -static APR_INLINE unsigned long apt_thread_id_get(void) -{ -#ifdef WIN32 - return (unsigned long) GetCurrentThreadId(); -#else - return (unsigned long) apr_os_thread_current(); -#endif -} - -static apt_bool_t apt_do_log(const char *file, int line, apt_log_priority_e priority, const char *format, va_list arg_ptr) -{ - char log_entry[MAX_LOG_ENTRY_SIZE]; - apr_size_t max_size = MAX_LOG_ENTRY_SIZE - 2; - apr_size_t offset = 0; - apr_time_exp_t result; - apr_time_t now = apr_time_now(); - apr_time_exp_lt(&result,now); - - if(apt_logger->header & APT_LOG_HEADER_DATE) { - offset += apr_snprintf(log_entry+offset,max_size-offset,"%4d-%02d-%02d ", - result.tm_year+1900, - result.tm_mon+1, - result.tm_mday); - } - if(apt_logger->header & APT_LOG_HEADER_TIME) { - offset += apr_snprintf(log_entry+offset,max_size-offset,"%02d:%02d:%02d:%06d ", - result.tm_hour, - result.tm_min, - result.tm_sec, - result.tm_usec); - } - if(apt_logger->header & APT_LOG_HEADER_MARK) { - offset += apr_snprintf(log_entry+offset,max_size-offset,"%s:%03d ",file,line); - } - if(apt_logger->header & APT_LOG_HEADER_THREAD) { - offset += apr_snprintf(log_entry+offset,max_size-offset,"%05lu ",apt_thread_id_get()); - } - if(apt_logger->header & APT_LOG_HEADER_PRIORITY) { - memcpy(log_entry+offset,priority_snames[priority],MAX_PRIORITY_NAME_LENGTH); - offset += MAX_PRIORITY_NAME_LENGTH; - } - - offset += apr_vsnprintf(log_entry+offset,max_size-offset,format,arg_ptr); - log_entry[offset++] = '\n'; - log_entry[offset] = '\0'; - if((apt_logger->mode & APT_LOG_OUTPUT_CONSOLE) == APT_LOG_OUTPUT_CONSOLE) { - fwrite(log_entry,offset,1,stdout); - } - - if((apt_logger->mode & APT_LOG_OUTPUT_FILE) == APT_LOG_OUTPUT_FILE && apt_logger->file_data) { - apt_log_file_dump(apt_logger->file_data,log_entry,offset); - } - return TRUE; -} - -static const char* apt_log_file_path_make(apt_log_file_data_t *file_data) -{ - char *log_file_path = NULL; - const char *log_file_name = apr_psprintf(file_data->pool,"%s-%.2"APR_SIZE_T_FMT".log", - file_data->log_file_name, - file_data->cur_file_index); - apr_filepath_merge(&log_file_path, - file_data->log_dir_path, - log_file_name, - APR_FILEPATH_NATIVE, - file_data->pool); - return log_file_path; -} - -static apr_size_t apt_log_file_get_size(apt_log_file_data_t *file_data) -{ - FILE* fp; - const char *log_file_path; - apr_size_t ret; - - log_file_path = apt_log_file_path_make(file_data); - fp = fopen(log_file_path,"rb"); - - if(!fp) return 0; - - fseek(fp,0,SEEK_END); - ret = ftell(fp); - - fclose(fp); - - return ret; -} - -static apr_byte_t apt_log_file_exist(apt_log_file_data_t *file_data) -{ - FILE* fp; - const char *log_file_path; - - log_file_path = apt_log_file_path_make(file_data); - fp = fopen(log_file_path,"rb"); - - if(!fp) return 0; - - fclose(fp); - - return 1; -} - -static apt_bool_t apt_log_file_dump(apt_log_file_data_t *file_data, const char *log_entry, apr_size_t size) -{ - apr_thread_mutex_lock(file_data->mutex); - - file_data->cur_size += size; - if(file_data->cur_size > file_data->max_size) { - const char *log_file_path; - /* close current log file */ - fclose(file_data->file); - /* roll over the next log file */ - file_data->cur_file_index++; - file_data->cur_file_index %= file_data->max_file_count; - /* open log file */ - log_file_path = apt_log_file_path_make(file_data); - file_data->file = fopen(log_file_path,"wb"); - if(!file_data->file) { - return FALSE; - } - - file_data->cur_size = size; - } - /* write to log file */ - fwrite(log_entry,1,size,file_data->file); - fflush(file_data->file); - - apr_thread_mutex_unlock(file_data->mutex); - return TRUE; -} - -static apr_xml_doc* apt_log_doc_parse(const char *file_path, apr_pool_t *pool) -{ - apr_xml_parser *parser = NULL; - apr_xml_doc *xml_doc = NULL; - apr_file_t *fd = NULL; - apr_status_t rv; - - rv = apr_file_open(&fd,file_path,APR_READ|APR_BINARY,0,pool); - if(rv != APR_SUCCESS) { - return NULL; - } - - rv = apr_xml_parse_file(pool,&parser,&xml_doc,fd,2000); - if(rv != APR_SUCCESS) { - xml_doc = NULL; - } - - apr_file_close(fd); - return xml_doc; -} diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_multipart_content.c b/libs/unimrcp/libs/apr-toolkit/src/apt_multipart_content.c deleted file mode 100644 index 46254723ab..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_multipart_content.c +++ /dev/null @@ -1,312 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_multipart_content.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include "apt_multipart_content.h" -#include "apt_text_stream.h" -#include "apt_text_message.h" - -#define CONTENT_LENGTH_HEADER "Content-Length" -#define CONTENT_TYPE_HEADER "Content-Type" -#define CONTENT_ID_HEADER "Content-Id" - -#define DEFAULT_BOUNDARY "break" -#define DEFAULT_HYPHENS "--" - -#define DEFAULT_MULTIPART_CONTENT_SIZE 4096 - -/** Multipart content */ -struct apt_multipart_content_t { - apr_pool_t *pool; - apt_text_stream_t stream; - - apt_str_t boundary; - apt_str_t hyphens; -}; - -/** Create an empty multipart content */ -APT_DECLARE(apt_multipart_content_t*) apt_multipart_content_create(apr_size_t max_content_size, const apt_str_t *boundary, apr_pool_t *pool) -{ - char *buffer; - apt_multipart_content_t *multipart_content = apr_palloc(pool,sizeof(apt_multipart_content_t)); - multipart_content->pool = pool; - - if(max_content_size == 0) { - max_content_size = DEFAULT_MULTIPART_CONTENT_SIZE; - } - - if(boundary) { - multipart_content->boundary = *boundary; - } - else { - multipart_content->boundary.buf = DEFAULT_BOUNDARY; - multipart_content->boundary.length = sizeof(DEFAULT_BOUNDARY)-1; - } - - multipart_content->hyphens.buf = DEFAULT_HYPHENS; - multipart_content->hyphens.length = sizeof(DEFAULT_HYPHENS)-1; - - buffer = apr_palloc(pool,max_content_size+1); - apt_text_stream_init(&multipart_content->stream,buffer,max_content_size); - return multipart_content; -} - -/** Initialize content part generation */ -static apt_bool_t apt_multipart_content_initialize(apt_multipart_content_t *multipart_content) -{ - /* insert preceding end-of-line */ - if(apt_text_eol_insert(&multipart_content->stream) == FALSE) { - return FALSE; - } - /* insert hyphens */ - if(apt_text_string_insert(&multipart_content->stream,&multipart_content->hyphens) == FALSE) { - return FALSE; - } - /* insert boundary */ - if(apt_text_string_insert(&multipart_content->stream,&multipart_content->boundary) == FALSE) { - return FALSE; - } - return apt_text_eol_insert(&multipart_content->stream); -} - -/** Add content part to multipart content */ -APT_DECLARE(apt_bool_t) apt_multipart_content_add(apt_multipart_content_t *multipart_content, const apt_content_part_t *content_part) -{ - if(!content_part) { - return FALSE; - } - - /* insert preceding eol, hyppens and boudnary */ - if(apt_multipart_content_initialize(multipart_content) == FALSE) { - return FALSE; - } - - /* insert header fields */ - if(apt_header_section_generate(&content_part->header,&multipart_content->stream) == FALSE) { - return FALSE; - } - - /* insert body */ - return apt_text_string_insert(&multipart_content->stream,&content_part->body); -} - -/** Add content part to multipart content by specified header fields and body */ -APT_DECLARE(apt_bool_t) apt_multipart_content_add2(apt_multipart_content_t *multipart_content, const apt_str_t *content_type, const apt_str_t *content_id, const apt_str_t *body) -{ - /* insert preceding eol, hyppens and boudnary */ - if(apt_multipart_content_initialize(multipart_content) == FALSE) { - return FALSE; - } - - /* insert content-type */ - if(content_type) { - apt_str_t name = {CONTENT_TYPE_HEADER,sizeof(CONTENT_TYPE_HEADER)-1}; - if(apt_text_name_value_insert(&multipart_content->stream,&name,content_type) == FALSE) { - return FALSE; - } - } - - /* insert content-id */ - if(content_id) { - apt_str_t name = {CONTENT_ID_HEADER,sizeof(CONTENT_ID_HEADER)-1}; - if(apt_text_name_value_insert(&multipart_content->stream,&name,content_id) == FALSE) { - return FALSE; - } - } - - /* insert content-length */ - if(body) { - apt_str_t name = {CONTENT_LENGTH_HEADER,sizeof(CONTENT_LENGTH_HEADER)-1}; - if(apt_text_header_name_insert(&multipart_content->stream,&name) == FALSE) { - return FALSE; - } - if(apt_text_size_value_insert(&multipart_content->stream,body->length) == FALSE) { - return FALSE; - } - if(apt_text_eol_insert(&multipart_content->stream) == FALSE) { - return FALSE; - } - } - - /* insert empty line */ - if(apt_text_eol_insert(&multipart_content->stream) == FALSE) { - return FALSE; - } - - /* insert body */ - if(body) { - if(apt_text_string_insert(&multipart_content->stream,body) == FALSE) { - return FALSE; - } - } - return TRUE; -} - -/** Finalize multipart content generation */ -APT_DECLARE(apt_str_t*) apt_multipart_content_finalize(apt_multipart_content_t *multipart_content) -{ - apt_text_stream_t *stream = &multipart_content->stream; - /* insert preceding end-of-line */ - if(apt_text_eol_insert(&multipart_content->stream) == FALSE) { - return NULL; - } - /* insert hyphens */ - if(apt_text_string_insert(&multipart_content->stream,&multipart_content->hyphens) == FALSE) { - return NULL; - } - /* insert boundary */ - if(apt_text_string_insert(&multipart_content->stream,&multipart_content->boundary) == FALSE) { - return NULL; - } - /* insert final hyphens */ - if(apt_text_string_insert(&multipart_content->stream,&multipart_content->hyphens) == FALSE) { - return NULL; - } - if(apt_text_eol_insert(&multipart_content->stream) == FALSE) { - return NULL; - } - - stream->text.length = stream->pos - stream->text.buf; - stream->text.buf[stream->text.length] = '\0'; - return &stream->text; -} - - -/** Assign body to multipart content to get (parse) each content part from */ -APT_DECLARE(apt_multipart_content_t*) apt_multipart_content_assign(const apt_str_t *body, const apt_str_t *boundary, apr_pool_t *pool) -{ - apt_multipart_content_t *multipart_content = apr_palloc(pool,sizeof(apt_multipart_content_t)); - multipart_content->pool = pool; - - if(!body) { - return FALSE; - } - - if(boundary) { - multipart_content->boundary = *boundary; - } - else { - apt_string_reset(&multipart_content->boundary); - } - - apt_string_reset(&multipart_content->hyphens); - apt_text_stream_init(&multipart_content->stream,body->buf,body->length); - return multipart_content; -} - -static APR_INLINE void apt_content_part_reset(apt_content_part_t *content_part) -{ - apt_header_section_init(&content_part->header); - apt_string_reset(&content_part->body); - content_part->type = NULL; - content_part->id = NULL; - content_part->length = NULL; -} - -/** Get the next content part */ -APT_DECLARE(apt_bool_t) apt_multipart_content_get(apt_multipart_content_t *multipart_content, apt_content_part_t *content_part, apt_bool_t *is_final) -{ - apt_str_t boundary; - apt_header_field_t *header_field; - apt_text_stream_t *stream = &multipart_content->stream; - - if(!content_part || !is_final) { - return FALSE; - } - *is_final = FALSE; - apt_content_part_reset(content_part); - - /* skip preamble */ - apt_text_skip_to_char(stream,'-'); - if(apt_text_is_eos(stream) == TRUE) { - return FALSE; - } - - /* skip initial hyphens */ - apt_text_chars_skip(stream,'-'); - if(apt_text_is_eos(stream) == TRUE) { - return FALSE; - } - - /* read line and the boundary */ - if(apt_text_line_read(stream,&boundary) == FALSE) { - return FALSE; - } - - /* remove optional trailing spaces */ - while(boundary.length && boundary.buf[boundary.length-1] == APT_TOKEN_SP) boundary.length--; - - /* check whether this is the final boundary */ - if(boundary.length >= 2) { - if(boundary.buf[boundary.length-1] == '-' && boundary.buf[boundary.length-2] == '-') { - /* final boundary */ - boundary.length -= 2; - *is_final = TRUE; - } - } - - /* compare boundaries */ - if(apt_string_is_empty(&multipart_content->boundary) == TRUE) { - /* no boundary was specified from user space, - learn boundary from the content */ - multipart_content->boundary = boundary; - } - else { - if(apt_string_compare(&multipart_content->boundary,&boundary) == FALSE) { - /* invalid boundary */ - return FALSE; - } - } - - if(*is_final == TRUE) { - /* final boundary => return TRUE, content remains empty */ - return TRUE; - } - - /* read header fields */ - if(apt_header_section_parse(&content_part->header,stream,multipart_content->pool) == FALSE) { - return FALSE; - } - - for(header_field = APR_RING_FIRST(&content_part->header.ring); - header_field != APR_RING_SENTINEL(&content_part->header.ring, apt_header_field_t, link); - header_field = APR_RING_NEXT(header_field, link)) { - if(strncmp(header_field->name.buf,CONTENT_LENGTH_HEADER,header_field->name.length) == 0) { - content_part->length = &header_field->value; - } - else if(strncmp(header_field->name.buf,CONTENT_TYPE_HEADER,header_field->name.length) == 0) { - content_part->type = &header_field->value; - } - else if(strncmp(header_field->name.buf,CONTENT_ID_HEADER,header_field->name.length) == 0) { - content_part->id = &header_field->value; - } - } - - if(content_part->length && apt_string_is_empty(content_part->length) == FALSE) { - apr_size_t length = atoi(content_part->length->buf); - if(length + stream->pos > stream->end) { - return FALSE; - } - - /* read content */ - apt_string_assign_n(&content_part->body,stream->pos,length,multipart_content->pool); - stream->pos += length; - } - - return TRUE; -} diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_net.c b/libs/unimrcp/libs/apr-toolkit/src/apt_net.c deleted file mode 100644 index 398c71a99c..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_net.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_net.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include "apt_net.h" -#include "apt_log.h" - -/** Get the IP address (in numeric address string format) by hostname */ -apt_bool_t apt_ip_get(char **addr, apr_pool_t *pool) -{ - apr_sockaddr_t *sockaddr = NULL; - char hostname[APRMAXHOSTLEN+1]; - if(apr_gethostname(hostname,sizeof(hostname),pool) != APR_SUCCESS) { - return FALSE; - } - if(apr_sockaddr_info_get(&sockaddr,hostname,APR_INET,0,0,pool) != APR_SUCCESS) { - return FALSE; - } - if(apr_sockaddr_ip_get(addr,sockaddr) != APR_SUCCESS) { - return FALSE; - } - return TRUE; -} - -#ifdef WIN32 -#include -#pragma comment(lib, "IPHLPAPI.lib") -#else -#include -#include -#endif - -/** Get the IP address (in numeric address string format) by network interface name */ -apt_bool_t apt_ip_get_by_iface(const char *iface_name, char **addr, apr_pool_t *pool) -{ - apt_bool_t status = FALSE; -#ifdef WIN32 - /* See the usage of GetAdaptersInfo(). - * http://msdn.microsoft.com/en-us/library/windows/desktop/aa366314%28v=vs.85%29.aspx - */ - IP_ADAPTER_INFO *pAdapterInfo; - PIP_ADAPTER_INFO pAdapter; - ULONG ulOutBufLen; - DWORD dwRetVal; - - pAdapterInfo = (IP_ADAPTER_INFO *) malloc(sizeof(IP_ADAPTER_INFO)); - ulOutBufLen = sizeof(IP_ADAPTER_INFO); - - /* Make an initial call to GetAdaptersInfo to get the size needed into the ulOutBufLen variable. */ - if(GetAdaptersInfo(pAdapterInfo, &ulOutBufLen) != ERROR_SUCCESS) { - free(pAdapterInfo); - pAdapterInfo = (IP_ADAPTER_INFO *) malloc(ulOutBufLen); - } - - /* Make a second call to GetAdaptersInfo, passing pAdapterInfo and ulOutBufLen as parameters. */ - if((dwRetVal = GetAdaptersInfo(pAdapterInfo, &ulOutBufLen)) != ERROR_SUCCESS) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get Adapters Info %d", dwRetVal); - return FALSE; - } - - /* Walk through linked list, maintaining head pointer. */ - pAdapter = pAdapterInfo; - while(pAdapter) { - /* Match human readable description with specified name. */ - if(strcasecmp(pAdapter->Description,iface_name) == 0) { - *addr = apr_pstrdup(pool,pAdapter->IpAddressList.IpAddress.String); - status = TRUE; - break; - } - - pAdapter = pAdapter->Next; - } - - if (pAdapterInfo) - free(pAdapterInfo); - -#else - - struct ifaddrs *ifaddr, *ifa; - int family, n; - char host[NI_MAXHOST]; - - if(getifaddrs(&ifaddr) == -1) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get Interfaces"); - return FALSE; - } - - /* Walk through linked list, maintaining head pointer. */ - for(ifa = ifaddr, n = 0; ifa != NULL; ifa = ifa->ifa_next, n++) { - if(ifa->ifa_addr == NULL) continue; - - family = ifa->ifa_addr->sa_family; - if(family == AF_INET || family == AF_INET6) { - if(strcasecmp(ifa->ifa_name,iface_name) == 0) { - if(getnameinfo(ifa->ifa_addr, - (family == AF_INET) ? sizeof(struct sockaddr_in) : - sizeof(struct sockaddr_in6), - host, NI_MAXHOST, - NULL, 0, NI_NUMERICHOST) == 0) { - *addr = apr_pstrdup(pool,host); - status = TRUE; - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get Name Info"); - } - break; - } - } - } - - freeifaddrs(ifaddr); -#endif - - if(status == TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Found Address %s by Interface [%s]", *addr, iface_name); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Such Interface Found [%s]", iface_name); - } - return status; -} - -/** Seconds from Jan 1 1900 to Jan 1 1970 */ -#define NTP_TIME_OFFSET 2208988800UL - -/** Get current NTP time */ -void apt_ntp_time_get(apr_uint32_t *sec, apr_uint32_t *frac) -{ - apr_uint32_t t; - apr_uint32_t usec; - - apr_time_t now = apr_time_now(); - *sec = (apr_uint32_t)apr_time_sec(now) + NTP_TIME_OFFSET; - - usec = (apr_uint32_t) apr_time_usec(now); - t = (usec * 1825) >> 5; - *frac = ((usec << 12) + (usec << 8) - t); -} diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_nlsml_doc.c b/libs/unimrcp/libs/apr-toolkit/src/apt_nlsml_doc.c deleted file mode 100644 index d6c866c0b6..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_nlsml_doc.c +++ /dev/null @@ -1,569 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_nlsml_doc.c 2177 2014-09-12 05:36:20Z achaloyan@gmail.com $ - */ - -#include -#ifdef WIN32 -#pragma warning(disable: 4127) -#endif -#include - -#include "apt_nlsml_doc.h" -#include "apt_log.h" - -/** NLSML result */ -struct nlsml_result_t -{ - /** List of interpretations */ - APR_RING_HEAD(apt_ir_head_t, nlsml_interpretation_t) interpretations; - /** List of enrollment results */ - APR_RING_HEAD(apt_er_head_t, nlsml_enrollment_result_t) enrollment_results; - /** List of verification results */ - APR_RING_HEAD(apt_vr_head_t, nlsml_verification_result_t) verification_results; - - /** Optional grammar attribute */ - const char *grammar; -}; - -/** NLSML instance */ -struct nlsml_instance_t -{ - /** Ring entry */ - APR_RING_ENTRY(nlsml_instance_t) link; - - /** Instance element */ - apr_xml_elem *elem; -}; - -/** NLSML input */ -struct nlsml_input_t -{ - /** Input element */ - apr_xml_elem *elem; - /** Input mode attribute [default: "speech"] */ - const char *mode; - /** Confidence attribute [default: 1.0] */ - float confidence; - /** Timestamp-start attribute */ - const char *timestamp_start; - /** Timestamp-end attribute */ - const char *timestamp_end; -}; - -/** NLSML interpretation */ -struct nlsml_interpretation_t -{ - /** Ring entry */ - APR_RING_ENTRY(nlsml_interpretation_t) link; - - /** List of instances */ - APR_RING_HEAD(apt_head_t, nlsml_instance_t) instances; - /** Input [0..1] */ - nlsml_input_t *input; - - /** Confidence attribute [default: 1.0] */ - float confidence; - /** Optional grammar attribute */ - const char *grammar; -}; - -struct nlsml_enrollment_result_t -{ - /** Ring entry */ - APR_RING_ENTRY(nlsml_enrollment_result_t) link; -}; - -struct nlsml_verification_result_t -{ - /** Ring entry */ - APR_RING_ENTRY(nlsml_verification_result_t) link; -}; - -/** Load NLSML document */ -static apr_xml_doc* nlsml_doc_load(const char *data, apr_size_t length, apr_pool_t *pool) -{ - apr_xml_parser *parser; - apr_xml_doc *doc = NULL; - const apr_xml_elem *root; - - if(!data || !length) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No NLSML data available"); - return NULL; - } - - /* create XML parser */ - parser = apr_xml_parser_create(pool); - if(apr_xml_parser_feed(parser,data,length) != APR_SUCCESS) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to feed NLSML input to the parser"); - return NULL; - } - - /* done with XML tree creation */ - if(apr_xml_parser_done(parser,&doc) != APR_SUCCESS) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to terminate NLSML parsing"); - return NULL; - } - - if(!doc || !doc->root) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No NLSML root element"); - return NULL; - } - root = doc->root; - - /* NLSML validity check: root element must be */ - if(strcmp(root->name,"result") != 0) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unexpected NLSML root element <%s>",root->name); - return NULL; - } - - return doc; -} - -/** Parse confidence value */ -static float nlsml_confidence_parse(const char *str) -{ - float confidence = (float) atof(str); - if(confidence > 1.0) - confidence /= 100; - - return confidence; -} - -/** Parse element */ -static nlsml_instance_t* nlsml_instance_parse(apr_xml_elem *elem, apr_pool_t *pool) -{ - /* Initialize instance */ - nlsml_instance_t *instance = apr_palloc(pool, sizeof(*instance)); - APR_RING_ELEM_INIT(instance,link); - instance->elem = elem; - - return instance; -} - -/** Parse element */ -static nlsml_input_t* nlsml_input_parse(apr_xml_elem *elem, apr_pool_t *pool) -{ - const apr_xml_attr *xml_attr; - /* Initialize input */ - nlsml_input_t *input = apr_palloc(pool, sizeof(*input)); - input->elem = elem; - input->mode = "speech"; - input->confidence = 1.0; - input->timestamp_start = NULL; - input->timestamp_end = NULL; - - /* Find input attributes */ - for(xml_attr = elem->attr; xml_attr; xml_attr = xml_attr->next) { - if(strcasecmp(xml_attr->name, "mode") == 0) { - input->mode = xml_attr->value; - } - else if(strcasecmp(xml_attr->name, "confidence") == 0) { - input->confidence = nlsml_confidence_parse(xml_attr->value); - } - else if(strcasecmp(xml_attr->name, "timestamp-start") == 0) { - input->timestamp_start = xml_attr->value; - } - else if(strcasecmp(xml_attr->name, "timestamp-end") == 0) { - input->timestamp_end = xml_attr->value; - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown attribute '%s' for <%s>", xml_attr->name, elem->name); - } - } - - return input; -} - -/** Parse element */ -static nlsml_interpretation_t* nlsml_interpretation_parse(apr_xml_elem *elem, apr_pool_t *pool) -{ - apr_xml_elem *child_elem; - const apr_xml_attr *xml_attr; - nlsml_instance_t *instance; - nlsml_input_t *input; - - /* Initialize interpretation */ - nlsml_interpretation_t *interpretation = apr_palloc(pool, sizeof(*interpretation)); - APR_RING_ELEM_INIT(interpretation,link); - interpretation->grammar = NULL; - interpretation->confidence = 1.0; - interpretation->input = NULL; - APR_RING_INIT(&interpretation->instances, nlsml_instance_t, link); - - /* Find optional grammar and confidence attributes */ - for(xml_attr = elem->attr; xml_attr; xml_attr = xml_attr->next) { - if(strcasecmp(xml_attr->name, "grammar") == 0) { - interpretation->grammar = xml_attr->value; - } - else if(strcasecmp(xml_attr->name, "confidence") == 0) { - interpretation->confidence = nlsml_confidence_parse(xml_attr->value); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown attribute '%s' for <%s>", xml_attr->name, elem->name); - } - } - - /* Find input and instance elements */ - for(child_elem = elem->first_child; child_elem; child_elem = child_elem->next) { - if(strcasecmp(child_elem->name, "input") == 0) { - input = nlsml_input_parse(child_elem, pool); - if(input) { - interpretation->input = input; - } - } - else if(strcasecmp(child_elem->name, "instance") == 0) { - instance = nlsml_instance_parse(child_elem, pool); - if(instance) { - APR_RING_INSERT_TAIL(&interpretation->instances, instance, nlsml_instance_t, link); - } - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown child element <%s> for <%s>", child_elem->name, elem->name); - } - } - - return interpretation; -} - -/** Parse element */ -static nlsml_enrollment_result_t* nlsml_enrollment_result_parse(const apr_xml_elem *elem, apr_pool_t *pool) -{ - /* To be done */ - return NULL; -} - -/** Parse element */ -static nlsml_verification_result_t* nlsml_verification_result_parse(const apr_xml_elem *elem, apr_pool_t *pool) -{ - /* To be done */ - return NULL; -} - -/** Parse NLSML result */ -APT_DECLARE(nlsml_result_t*) nlsml_result_parse(const char *data, apr_size_t length, apr_pool_t *pool) -{ - nlsml_result_t *result; - apr_xml_elem *root; - apr_xml_elem *child_elem; - const apr_xml_attr *xml_attr; - nlsml_interpretation_t *interpretation; - nlsml_enrollment_result_t *enrollment_result; - nlsml_verification_result_t *verification_result; - apr_xml_doc *doc; - /* Load XML document */ - doc = nlsml_doc_load(data, length, pool); - if(!doc) - return NULL; - - root = doc->root; - - /* Initialize result */ - result = apr_palloc(pool, sizeof(*result)); - APR_RING_INIT(&result->interpretations, nlsml_interpretation_t, link); - APR_RING_INIT(&result->enrollment_results, nlsml_enrollment_result_t, link); - APR_RING_INIT(&result->verification_results, nlsml_verification_result_t, link); - result->grammar = NULL; - - /* Find optional grammar attribute */ - for(xml_attr = root->attr; xml_attr; xml_attr = xml_attr->next) { - if(strcasecmp(xml_attr->name, "grammar") == 0) { - result->grammar = xml_attr->value; - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown attribute '%s' for <%s>", xml_attr->name, root->name); - } - } - - /* Find interpretation, enrollment-result, or verification-result elements */ - for(child_elem = root->first_child; child_elem; child_elem = child_elem->next) { - if(strcasecmp(child_elem->name, "interpretation") == 0) { - interpretation = nlsml_interpretation_parse(child_elem, pool); - if(interpretation) { - APR_RING_INSERT_TAIL(&result->interpretations, interpretation, nlsml_interpretation_t, link); - } - } - else if(strcasecmp(child_elem->name, "enrollment-result") == 0) { - enrollment_result = nlsml_enrollment_result_parse(child_elem, pool); - if(enrollment_result) { - APR_RING_INSERT_TAIL(&result->enrollment_results, enrollment_result, nlsml_enrollment_result_t, link); - } - } - else if(strcasecmp(child_elem->name, "verification-result") == 0) { - verification_result = nlsml_verification_result_parse(child_elem, pool); - if(verification_result) { - APR_RING_INSERT_TAIL(&result->verification_results, verification_result, nlsml_verification_result_t, link); - } - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown child element <%s> for <%s>", child_elem->name, root->name); - } - } - - if(APR_RING_EMPTY(&result->interpretations, nlsml_interpretation_t, link) && - APR_RING_EMPTY(&result->enrollment_results, nlsml_enrollment_result_t, link) && - APR_RING_EMPTY(&result->verification_results, nlsml_verification_result_t, link)) { - /* at least one of , , MUST be specified */ - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid NLSML document: at least one child element MUST be specified for <%s>", root->name); - } - - return result; -} - -/** Trace NLSML result (for debug purposes only) */ -APT_DECLARE(void) nlsml_result_trace(const nlsml_result_t *result, apr_pool_t *pool) -{ - int interpretation_count; - nlsml_interpretation_t *interpretation; - int instance_count; - nlsml_instance_t *instance; - nlsml_input_t *input; - const char *instance_data; - const char *input_data; - const char *timestamp_start; - const char *timestamp_end; - - if(result->grammar) - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Result.grammar: %s", result->grammar); - - interpretation_count = 0; - interpretation = nlsml_first_interpretation_get(result); - while(interpretation) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Interpretation[%d].confidence: %.2f", interpretation_count, nlsml_interpretation_confidence_get(interpretation)); - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Interpretation[%d].grammar: %s", interpretation_count, nlsml_interpretation_grammar_get(interpretation)); - - instance_count = 0; - instance = nlsml_interpretation_first_instance_get(interpretation); - while(instance) { - nlsml_instance_swi_suppress(instance); - instance_data = nlsml_instance_content_generate(instance,pool); - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Interpretation[%d].instance[%d]: %s", interpretation_count, instance_count, instance_data); - - instance_count++; - instance = nlsml_interpretation_next_instance_get(interpretation, instance); - } - - input = nlsml_interpretation_input_get(interpretation); - if(input) { - input_data = nlsml_input_content_generate(input,pool); - timestamp_start = nlsml_input_timestamp_start_get(input); - timestamp_end = nlsml_input_timestamp_end_get(input); - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Interpretation[%d].input: %s", interpretation_count, input_data); - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Interpretation[%d].input.mode: %s", interpretation_count, nlsml_input_mode_get(input)); - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Interpretation[%d].input.confidence: %.2f", interpretation_count, nlsml_input_confidence_get(input)); - if(timestamp_start) - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Interpretation[%d].input.timestamp-start: %s", interpretation_count, timestamp_start); - if(timestamp_end) - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Interpretation[%d].input.timestamp-end: %s", interpretation_count, timestamp_end); - } - - interpretation_count++; - interpretation = nlsml_next_interpretation_get(result, interpretation); - } -} - -/** Get first interpretation */ -APT_DECLARE(nlsml_interpretation_t*) nlsml_first_interpretation_get(const nlsml_result_t *result) -{ - nlsml_interpretation_t *first_interpretation = APR_RING_FIRST(&result->interpretations); - if(first_interpretation == APR_RING_SENTINEL(&result->interpretations, nlsml_interpretation_t, link)) - return NULL; - return first_interpretation; -} - -/** Get next interpretation */ -APT_DECLARE(nlsml_interpretation_t*) nlsml_next_interpretation_get(const nlsml_result_t *result, const nlsml_interpretation_t *interpretation) -{ - nlsml_interpretation_t *next_interpretation = APR_RING_NEXT(interpretation, link); - if(next_interpretation == APR_RING_SENTINEL(&result->interpretations, nlsml_interpretation_t, link)) - return NULL; - return next_interpretation; -} - -/** Get first enrollment result */ -APT_DECLARE(nlsml_enrollment_result_t*) nlsml_first_enrollment_result_get(const nlsml_result_t *result) -{ - nlsml_enrollment_result_t *first_enrollment_result = APR_RING_FIRST(&result->enrollment_results); - if(first_enrollment_result == APR_RING_SENTINEL(&result->enrollment_results, nlsml_enrollment_result_t, link)) - return NULL; - return first_enrollment_result; -} - -/** Get next enrollment result */ -APT_DECLARE(nlsml_enrollment_result_t*) nlsml_next_enrollment_result_get(const nlsml_result_t *result, const nlsml_enrollment_result_t *enrollment_result) -{ - nlsml_enrollment_result_t *next_enrollment_result = APR_RING_NEXT(enrollment_result, link); - if(next_enrollment_result == APR_RING_SENTINEL(&result->enrollment_results, nlsml_enrollment_result_t, link)) - return NULL; - return next_enrollment_result; -} - -/** Get first verification result */ -APT_DECLARE(nlsml_verification_result_t*) nlsml_first_verification_result_get(const nlsml_result_t *result) -{ - nlsml_verification_result_t *first_verification_result = APR_RING_FIRST(&result->verification_results); - if(first_verification_result == APR_RING_SENTINEL(&result->verification_results, nlsml_verification_result_t, link)) - return NULL; - return first_verification_result; -} - -/** Get next verification result */ -APT_DECLARE(nlsml_verification_result_t*) nlsml_next_verification_result_get(const nlsml_result_t *result, const nlsml_verification_result_t *verification_result) -{ - nlsml_verification_result_t *next_verification_result = APR_RING_NEXT(verification_result, link); - if(next_verification_result == APR_RING_SENTINEL(&result->verification_results, nlsml_verification_result_t, link)) - return NULL; - return next_verification_result; -} - -/** Get grammar attribute of NLSML result */ -APT_DECLARE(const char*) nlsml_result_grammar_get(const nlsml_result_t *result) -{ - return result->grammar; -} - -/** Get first instance */ -APT_DECLARE(nlsml_instance_t*) nlsml_interpretation_first_instance_get(const nlsml_interpretation_t *interpretation) -{ - nlsml_instance_t *first_instance = APR_RING_FIRST(&interpretation->instances); - if(first_instance == APR_RING_SENTINEL(&interpretation->instances, nlsml_instance_t, link)) - return NULL; - return first_instance; -} - -/** Get next instance */ -APT_DECLARE(nlsml_instance_t*) nlsml_interpretation_next_instance_get(const nlsml_interpretation_t *interpretation, const nlsml_instance_t *instance) -{ - nlsml_instance_t *next_instance = APR_RING_NEXT(instance, link); - if(next_instance == APR_RING_SENTINEL(&interpretation->instances, nlsml_instance_t, link)) - return NULL; - return next_instance; -} - -/** Get input */ -APT_DECLARE(nlsml_input_t*) nlsml_interpretation_input_get(const nlsml_interpretation_t *interpretation) -{ - return interpretation->input; -} - -/** Get interpretation confidence */ -APT_DECLARE(float) nlsml_interpretation_confidence_get(const nlsml_interpretation_t *interpretation) -{ - return interpretation->confidence; -} - -/** Get interpretation grammar */ -APT_DECLARE(const char*) nlsml_interpretation_grammar_get(const nlsml_interpretation_t *interpretation) -{ - return interpretation->grammar; -} - -/** Get instance element */ -APT_DECLARE(const apr_xml_elem*) nlsml_instance_elem_get(const nlsml_instance_t *instance) -{ - return instance->elem; -} - -/** Suppress SWI elements (normalize instance) */ -APT_DECLARE(apt_bool_t) nlsml_instance_swi_suppress(nlsml_instance_t *instance) -{ - apr_xml_elem *child_elem; - apr_xml_elem *prev_elem = NULL; - apr_xml_elem *swi_literal = NULL; - apt_bool_t remove; - if(!instance->elem) - return FALSE; - - for(child_elem = instance->elem->first_child; child_elem; child_elem = child_elem->next) { - remove = FALSE; - if(strcasecmp(child_elem->name,"SWI_literal") == 0) { - swi_literal = child_elem; - remove = TRUE; - } - else if(strcasecmp(child_elem->name,"SWI_meaning") == 0) { - remove = TRUE; - } - - if(remove == TRUE) { - if(child_elem == instance->elem->first_child) { - instance->elem->first_child = child_elem->next; - } - else if(prev_elem) { - prev_elem->next = child_elem->next; - } - } - - prev_elem = child_elem; - } - - if(APR_XML_ELEM_IS_EMPTY(instance->elem) && swi_literal) { - instance->elem->first_cdata = swi_literal->first_cdata; - } - - return TRUE; -} - -/** Generate a plain text content of the instance element */ -APT_DECLARE(const char*) nlsml_instance_content_generate(const nlsml_instance_t *instance, apr_pool_t *pool) -{ - const char *buf = NULL; - if(instance->elem) { - apr_size_t size; - apr_xml_to_text(pool, instance->elem, APR_XML_X2T_INNER, NULL, NULL, &buf, &size); - } - return buf; -} - -/** Get input element */ -APT_DECLARE(const apr_xml_elem*) nlsml_input_elem_get(const nlsml_input_t *input) -{ - return input->elem; -} - -/** Generate a plain text content of the input element */ -APT_DECLARE(const char*) nlsml_input_content_generate(const nlsml_input_t *input, apr_pool_t *pool) -{ - const char *buf = NULL; - if(input->elem) { - apr_size_t size; - apr_xml_to_text(pool, input->elem, APR_XML_X2T_INNER, NULL, NULL, &buf, &size); - } - return buf; -} - -/** Get input mode */ -APT_DECLARE(const char*) nlsml_input_mode_get(const nlsml_input_t *input) -{ - return input->mode; -} - -/** Get input confidence */ -APT_DECLARE(float) nlsml_input_confidence_get(const nlsml_input_t *input) -{ - return input->confidence; -} - -/** Get start of input timestamp */ -APT_DECLARE(const char*) nlsml_input_timestamp_start_get(const nlsml_input_t *input) -{ - return input->timestamp_start; -} - -/** Get end of input timestamp */ -APT_DECLARE(const char*) nlsml_input_timestamp_end_get(const nlsml_input_t *input) -{ - return input->timestamp_end; -} diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_obj_list.c b/libs/unimrcp/libs/apr-toolkit/src/apt_obj_list.c deleted file mode 100644 index 83f64b0c71..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_obj_list.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_obj_list.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifdef WIN32 -#pragma warning(disable: 4127) -#endif -#include -#include "apt_obj_list.h" - -struct apt_list_elem_t { - APR_RING_ENTRY(apt_list_elem_t) link; - void *obj; -}; - -struct apt_obj_list_t { - APR_RING_HEAD(apt_list_head_t, apt_list_elem_t) head; - apr_pool_t *pool; -}; - - - -APT_DECLARE(apt_obj_list_t*) apt_list_create(apr_pool_t *pool) -{ - apt_obj_list_t *list = apr_palloc(pool, sizeof(apt_obj_list_t)); - list->pool = pool; - APR_RING_INIT(&list->head, apt_list_elem_t, link); - return list; -} - -APT_DECLARE(void) apt_list_destroy(apt_obj_list_t *list) -{ - /* nothing to do, the list is allocated from the pool */ -} - -APT_DECLARE(apt_list_elem_t*) apt_list_push_back(apt_obj_list_t *list, void *obj, apr_pool_t *pool) -{ - apt_list_elem_t *elem = apr_palloc(pool,sizeof(apt_list_elem_t)); - elem->obj = obj; - - APR_RING_INSERT_TAIL(&list->head,elem,apt_list_elem_t,link); - return elem; -} - -APT_DECLARE(void*) apt_list_pop_front(apt_obj_list_t *list) -{ - apt_list_elem_t *elem; - if(APR_RING_EMPTY(&list->head,apt_list_elem_t,link)) { - return NULL; - } - elem = APR_RING_FIRST(&list->head); - APR_RING_REMOVE(elem,link); - return elem->obj; -} - -APT_DECLARE(void*) apt_list_head(const apt_obj_list_t *list) -{ - apt_list_elem_t *elem; - if(APR_RING_EMPTY(&list->head,apt_list_elem_t,link)) { - return NULL; - } - elem = APR_RING_FIRST(&list->head); - return elem->obj; -} - -APT_DECLARE(void*) apt_obj_list_tail(const apt_obj_list_t *list) -{ - apt_list_elem_t *elem; - if(APR_RING_EMPTY(&list->head,apt_list_elem_t,link)) { - return NULL; - } - elem = APR_RING_LAST(&list->head); - return elem->obj; -} - -APT_DECLARE(apt_list_elem_t*) apt_list_first_elem_get(const apt_obj_list_t *list) -{ - if(APR_RING_EMPTY(&list->head,apt_list_elem_t,link)) { - return NULL; - } - return APR_RING_FIRST(&list->head); -} - -APT_DECLARE(apt_list_elem_t*) apt_list_last_elem_get(const apt_obj_list_t *list) -{ - if(APR_RING_EMPTY(&list->head,apt_list_elem_t,link)) { - return NULL; - } - return APR_RING_LAST(&list->head); -} - -APT_DECLARE(apt_list_elem_t*) apt_list_next_elem_get(const apt_obj_list_t *list, apt_list_elem_t *elem) -{ - apt_list_elem_t *next_elem = APR_RING_NEXT(elem,link); - if(next_elem == APR_RING_SENTINEL(&list->head,apt_list_elem_t,link)) { - next_elem = NULL; - } - return next_elem; -} - -APT_DECLARE(apt_list_elem_t*) apt_list_prev_elem_get(const apt_obj_list_t *list, apt_list_elem_t *elem) -{ - apt_list_elem_t *prev_elem = APR_RING_PREV(elem,link); - if(prev_elem == APR_RING_SENTINEL(&list->head,apt_list_elem_t,link)) { - prev_elem = NULL; - } - return prev_elem; -} - -APT_DECLARE(apt_list_elem_t*) apt_list_elem_insert(apt_obj_list_t *list, apt_list_elem_t *elem, void *obj, apr_pool_t *pool) -{ - apt_list_elem_t *new_elem = apr_palloc(pool,sizeof(apt_list_elem_t)); - new_elem->obj = obj; - APR_RING_INSERT_BEFORE(elem,new_elem,link); - return new_elem; -} - -APT_DECLARE(apt_list_elem_t*) apt_list_elem_remove(apt_obj_list_t *list, apt_list_elem_t *elem) -{ - apt_list_elem_t *next_elem = APR_RING_NEXT(elem,link); - APR_RING_REMOVE(elem,link); - if(next_elem == APR_RING_SENTINEL(&list->head,apt_list_elem_t,link)) { - next_elem = NULL; - } - return next_elem; -} - -APT_DECLARE(apt_bool_t) apt_list_is_empty(const apt_obj_list_t *list) -{ - if(APR_RING_EMPTY(&list->head,apt_list_elem_t,link)) { - return TRUE; - } - return FALSE; -} - -APT_DECLARE(void*) apt_list_elem_object_get(const apt_list_elem_t *elem) -{ - return elem->obj; -} diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_pair.c b/libs/unimrcp/libs/apr-toolkit/src/apt_pair.c deleted file mode 100644 index d14ef5be98..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_pair.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_pair.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "apt_pair.h" - -/** Create array of name-value pairs */ -APT_DECLARE(apt_pair_arr_t*) apt_pair_array_create(apr_size_t initial_size, apr_pool_t *pool) -{ - return apr_array_make(pool,(int)initial_size,sizeof(apt_pair_t)); -} - -/** Copy array of name-value pairs */ -APT_DECLARE(apt_pair_arr_t*) apt_pair_array_copy(const apt_pair_arr_t *src_arr, apr_pool_t *pool) -{ - int i; - const apt_pair_t *src_pair; - apt_pair_t *pair; - apt_pair_arr_t *arr; - if(!src_arr) { - return NULL; - } - arr = apr_array_copy(pool,src_arr); - for(i=0; inelts; i++) { - pair = &APR_ARRAY_IDX(arr,i,apt_pair_t); - src_pair = &APR_ARRAY_IDX(src_arr,i,const apt_pair_t); - apt_pair_copy(pair,src_pair,pool); - } - return arr; -} - - -/** Append name-value pair */ -APT_DECLARE(apt_bool_t) apt_pair_array_append(apt_pair_arr_t *arr, const apt_str_t *name, const apt_str_t *value, apr_pool_t *pool) -{ - apt_pair_t *pair = apr_array_push(arr); - apt_pair_init(pair); - if(name) { - apt_string_copy(&pair->name,name,pool); - } - if(value) { - apt_string_copy(&pair->value,value,pool); - } - return TRUE; -} - -/** Find name-value pair by name */ -APT_DECLARE(const apt_pair_t*) apt_pair_array_find(const apt_pair_arr_t *arr, const apt_str_t *name) -{ - int i; - apt_pair_t *pair; - for(i=0; inelts; i++) { - pair = &APR_ARRAY_IDX(arr,i,apt_pair_t); - if(apt_string_compare(&pair->name,name) == TRUE) { - return pair; - } - } - return NULL; -} - -/** Get size of pair array */ -APT_DECLARE(int) apt_pair_array_size_get(const apt_pair_arr_t *arr) -{ - return arr->nelts; -} - -/** Get name-value pair by id */ -APT_DECLARE(const apt_pair_t*) apt_pair_array_get(const apt_pair_arr_t *arr, int id) -{ - if(id < arr->nelts) { - return &APR_ARRAY_IDX(arr,id,apt_pair_t); - } - return NULL; -} diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_poller_task.c b/libs/unimrcp/libs/apr-toolkit/src/apt_poller_task.c deleted file mode 100644 index 3a20231d20..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_poller_task.c +++ /dev/null @@ -1,296 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_poller_task.c 2224 2014-11-12 00:41:45Z achaloyan@gmail.com $ - */ - -#include "apt_poller_task.h" -#include "apt_task.h" -#include "apt_pool.h" -#include "apt_cyclic_queue.h" -#include "apt_log.h" - - -/** Poller task */ -struct apt_poller_task_t { - apr_pool_t *pool; - apt_task_t *base; - - void *obj; - apt_poll_signal_f signal_handler; - - apr_thread_mutex_t *guard; - apt_cyclic_queue_t *msg_queue; - apt_pollset_t *pollset; - apt_timer_queue_t *timer_queue; - - apr_pollfd_t *desc_arr; - apr_int32_t desc_count; - apr_int32_t desc_index; - -}; - -static apt_bool_t apt_poller_task_msg_signal(apt_task_t *task, apt_task_msg_t *msg); -static apt_bool_t apt_poller_task_run(apt_task_t *task); -static apt_bool_t apt_poller_task_on_destroy(apt_task_t *task); - - -/** Create poller task */ -APT_DECLARE(apt_poller_task_t*) apt_poller_task_create( - apr_size_t max_pollset_size, - apt_poll_signal_f signal_handler, - void *obj, - apt_task_msg_pool_t *msg_pool, - apr_pool_t *pool) -{ - apt_task_vtable_t *vtable; - apt_poller_task_t *task; - - if(!signal_handler) { - return NULL; - } - - task = apr_palloc(pool,sizeof(apt_poller_task_t)); - task->pool = pool; - task->obj = obj; - task->pollset = NULL; - task->signal_handler = signal_handler; - - task->pollset = apt_pollset_create((apr_uint32_t)max_pollset_size,pool); - if(!task->pollset) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Pollset"); - return NULL; - } - - task->base = apt_task_create(task,msg_pool,pool); - if(!task->base) { - apt_pollset_destroy(task->pollset); - return NULL; - } - - vtable = apt_task_vtable_get(task->base); - if(vtable) { - vtable->run = apt_poller_task_run; - vtable->destroy = apt_poller_task_on_destroy; - vtable->signal_msg = apt_poller_task_msg_signal; - } - apt_task_auto_ready_set(task->base,FALSE); - - task->msg_queue = apt_cyclic_queue_create(CYCLIC_QUEUE_DEFAULT_SIZE); - apr_thread_mutex_create(&task->guard,APR_THREAD_MUTEX_UNNESTED,pool); - - task->timer_queue = apt_timer_queue_create(pool); - task->desc_arr = NULL; - task->desc_count = 0; - task->desc_index = 0; - return task; -} - -/** Destroy poller task */ -APT_DECLARE(apt_bool_t) apt_poller_task_destroy(apt_poller_task_t *task) -{ - return apt_task_destroy(task->base); -} - -/** Cleanup poller task */ -APT_DECLARE(void) apt_poller_task_cleanup(apt_poller_task_t *task) -{ - if(task->pollset) { - apt_pollset_destroy(task->pollset); - task->pollset = NULL; - } - if(task->guard) { - apr_thread_mutex_destroy(task->guard); - task->guard = NULL; - } - if(task->msg_queue) { - apt_cyclic_queue_destroy(task->msg_queue); - task->msg_queue = NULL; - } -} - -/** Virtual destroy handler */ -static apt_bool_t apt_poller_task_on_destroy(apt_task_t *base) -{ - apt_poller_task_t *task = apt_task_object_get(base); - apt_poller_task_cleanup(task); - return TRUE; -} - - -/** Start poller task */ -APT_DECLARE(apt_bool_t) apt_poller_task_start(apt_poller_task_t *task) -{ - return apt_task_start(task->base); -} - -/** Terminate poller task */ -APT_DECLARE(apt_bool_t) apt_poller_task_terminate(apt_poller_task_t *task) -{ - return apt_task_terminate(task->base,TRUE); -} - -/** Get task */ -APT_DECLARE(apt_task_t*) apt_poller_task_base_get(const apt_poller_task_t *task) -{ - return task->base; -} - -/** Get task vtable */ -APT_DECLARE(apt_task_vtable_t*) apt_poller_task_vtable_get(const apt_poller_task_t *task) -{ - return apt_task_vtable_get(task->base); -} - -/** Get external object */ -APT_DECLARE(void*) apt_poller_task_object_get(const apt_poller_task_t *task) -{ - return task->obj; -} - -/** Add descriptor to pollset */ -APT_DECLARE(apt_bool_t) apt_poller_task_descriptor_add(const apt_poller_task_t *task, const apr_pollfd_t *descriptor) -{ - if(task->pollset) { - return apt_pollset_add(task->pollset,descriptor); - } - return FALSE; -} - -/** Remove descriptor from pollset */ -APT_DECLARE(apt_bool_t) apt_poller_task_descriptor_remove(const apt_poller_task_t *task, const apr_pollfd_t *descriptor) -{ - if(task->pollset) { - apr_int32_t i = task->desc_index + 1; - for(; i < task->desc_count; i++) { - apr_pollfd_t *cur_descriptor = &task->desc_arr[i]; - if(cur_descriptor->client_data == descriptor->client_data) { - cur_descriptor->client_data = NULL; - } - } - return apt_pollset_remove(task->pollset,descriptor); - } - return FALSE; -} - -/** Create timer */ -APT_DECLARE(apt_timer_t*) apt_poller_task_timer_create( - apt_poller_task_t *task, - apt_timer_proc_f proc, - void *obj, - apr_pool_t *pool) -{ - return apt_timer_create(task->timer_queue,proc,obj,pool); -} - -static apt_bool_t apt_poller_task_wakeup_process(apt_poller_task_t *task) -{ - apt_bool_t running = TRUE; - apt_task_msg_t *msg; - - do { - apr_thread_mutex_lock(task->guard); - msg = apt_cyclic_queue_pop(task->msg_queue); - apr_thread_mutex_unlock(task->guard); - if(msg) { - apt_task_msg_process(task->base,msg); - } - else { - running = FALSE; - } - } - while(running == TRUE); - return TRUE; -} - -static apt_bool_t apt_poller_task_run(apt_task_t *base) -{ - apt_poller_task_t *task = apt_task_object_get(base); - apt_bool_t *running; - apr_status_t status; - apr_interval_time_t timeout; - apr_uint32_t queue_timeout; - apr_time_t time_now, time_last = 0; - const char *task_name; - - if(!task) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Start Poller Task"); - return FALSE; - } - task_name = apt_task_name_get(task->base); - - running = apt_task_running_flag_get(task->base); - if(!running) { - return FALSE; - } - - /* explicitly indicate task is ready to process messages */ - apt_task_ready(task->base); - - while(*running) { - if(apt_timer_queue_timeout_get(task->timer_queue,&queue_timeout) == TRUE) { - timeout = (apr_interval_time_t)queue_timeout * 1000; - time_last = apr_time_now(); - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Wait for Messages [%s] timeout [%u]", - task_name, queue_timeout); - } - else { - timeout = -1; - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Wait for Messages [%s]",task_name); - } - status = apt_pollset_poll(task->pollset, timeout, &task->desc_count, (const apr_pollfd_t **) &task->desc_arr); - if(status != APR_SUCCESS && status != APR_TIMEUP) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Poll [%s] status: %d",task_name,status); - continue; - } - for(task->desc_index = 0; task->desc_index < task->desc_count; task->desc_index++) { - const apr_pollfd_t *descriptor = &task->desc_arr[task->desc_index]; - if(apt_pollset_is_wakeup(task->pollset,descriptor)) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Process Poller Wakeup [%s]",task_name); - apt_poller_task_wakeup_process(task); - if(*running == FALSE) { - break; - } - continue; - } - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Process Signalled Descriptor [%s]",task_name); - task->signal_handler(task->obj,descriptor); - } - - if(timeout != -1) { - time_now = apr_time_now(); - if(time_now > time_last) { - apt_timer_queue_advance(task->timer_queue,(apr_uint32_t)((time_now - time_last)/1000)); - } - } - } - - return TRUE; -} - -static apt_bool_t apt_poller_task_msg_signal(apt_task_t *base, apt_task_msg_t *msg) -{ - apt_bool_t status; - apt_poller_task_t *task = apt_task_object_get(base); - apr_thread_mutex_lock(task->guard); - status = apt_cyclic_queue_push(task->msg_queue,msg); - apr_thread_mutex_unlock(task->guard); - if(apt_pollset_wakeup(task->pollset) != TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Signal Control Message"); - status = FALSE; - } - return status; -} diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_pollset.c b/libs/unimrcp/libs/apr-toolkit/src/apt_pollset.c deleted file mode 100644 index b7d8358d36..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_pollset.c +++ /dev/null @@ -1,325 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_pollset.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include "apt_pollset.h" -#include "apt_log.h" - -struct apt_pollset_t { - /** APR pollset */ - apr_pollset_t *base; -#ifdef WIN32 - /** Socket descriptors used for wakeup */ - apr_socket_t *wakeup_pipe[2]; -#else - /** Pipe descriptors used for wakeup */ - apr_file_t *wakeup_pipe[2]; -#endif - /** Builtin wakeup poll descriptor */ - apr_pollfd_t wakeup_pfd; - - /** Pool to allocate memory from */ - apr_pool_t *pool; -}; - -static apt_bool_t apt_wakeup_pipe_create(apt_pollset_t *pollset); -static apt_bool_t apt_wakeup_pipe_destroy(apt_pollset_t *pollset); - -/** Create interruptable pollset on top of APR pollset */ -APT_DECLARE(apt_pollset_t*) apt_pollset_create(apr_uint32_t size, apr_pool_t *pool) -{ - apt_pollset_t *pollset = apr_palloc(pool,sizeof(apt_pollset_t)); - pollset->pool = pool; - memset(&pollset->wakeup_pfd,0,sizeof(pollset->wakeup_pfd)); - - /* create pollset with max number of descriptors size+1, - where +1 is builtin wakeup descriptor */ - if(apr_pollset_create(&pollset->base,size+1,pool,0) != APR_SUCCESS) { - return NULL; - } - - /* create wakeup pipe */ - if(apt_wakeup_pipe_create(pollset) != TRUE) { - apr_pollset_destroy(pollset->base); - return NULL; - } - - /* add wakeup pipe to pollset */ - if(apr_pollset_add(pollset->base,&pollset->wakeup_pfd) != APR_SUCCESS) { - apt_wakeup_pipe_destroy(pollset); - apr_pollset_destroy(pollset->base); - return NULL; - } - return pollset; -} - -/** Destroy pollset */ -APT_DECLARE(apt_bool_t) apt_pollset_destroy(apt_pollset_t *pollset) -{ - /* remove wakeup pipe from pollset */ - apr_pollset_remove(pollset->base,&pollset->wakeup_pfd); - /* destroy wakeup pipe */ - apt_wakeup_pipe_destroy(pollset); - /* destroy pollset */ - apr_pollset_destroy(pollset->base); - return TRUE; -} - -/** Add pollset descriptor to a pollset */ -APT_DECLARE(apt_bool_t) apt_pollset_add(apt_pollset_t *pollset, const apr_pollfd_t *descriptor) -{ - return (apr_pollset_add(pollset->base,descriptor) == APR_SUCCESS) ? TRUE : FALSE; -} - -/** Remove pollset descriptor from a pollset */ -APT_DECLARE(apt_bool_t) apt_pollset_remove(apt_pollset_t *pollset, const apr_pollfd_t *descriptor) -{ - return (apr_pollset_remove(pollset->base,descriptor) == APR_SUCCESS) ? TRUE : FALSE; -} - -/** Block for activity on the descriptor(s) in a pollset */ -APT_DECLARE(apr_status_t) apt_pollset_poll( - apt_pollset_t *pollset, - apr_interval_time_t timeout, - apr_int32_t *num, - const apr_pollfd_t **descriptors) -{ - return apr_pollset_poll(pollset->base,timeout,num,descriptors); -} - -/** Interrupt the blocked poll call */ -APT_DECLARE(apt_bool_t) apt_pollset_wakeup(apt_pollset_t *pollset) -{ - apt_bool_t status = TRUE; -#ifdef WIN32 - char tmp = 0; - apr_size_t len = sizeof(tmp); - if(apr_socket_send(pollset->wakeup_pipe[1],&tmp,&len) != APR_SUCCESS) { - status = FALSE; - } -#else - if(apr_file_putc(1, pollset->wakeup_pipe[1]) != APR_SUCCESS) { - status = FALSE; - } -#endif - return status; -} - -/** Match against builtin wake up descriptor in a pollset */ -APT_DECLARE(apt_bool_t) apt_pollset_is_wakeup(apt_pollset_t *pollset, const apr_pollfd_t *descriptor) -{ - apt_bool_t status = FALSE; -#ifdef WIN32 - if(descriptor->desc.s == pollset->wakeup_pipe[0]) { - char rb[512]; - apr_size_t nr = sizeof(rb); - - /* simply read out from the input side of the pipe all the data. */ - while(apr_socket_recv(pollset->wakeup_pipe[0], rb, &nr) == APR_SUCCESS) { - if(nr != sizeof(rb)) { - break; - } - } - status = TRUE; - } -#else - if(descriptor->desc.f == pollset->wakeup_pipe[0]) { - char rb[512]; - apr_size_t nr = sizeof(rb); - - /* simply read out from the input side of the pipe all the data. */ - while(apr_file_read(pollset->wakeup_pipe[0], rb, &nr) == APR_SUCCESS) { - if(nr != sizeof(rb)) { - break; - } - } - status = TRUE; - } -#endif - return status; -} - -#ifdef WIN32 -static apr_status_t socket_pipe_create(apr_socket_t **rd, apr_socket_t **wr, apr_pool_t *pool) -{ - static int id = 0; - - apr_socket_t *ls = NULL; - apr_sockaddr_t *pa = NULL; - apr_sockaddr_t *ca = NULL; - apr_size_t nrd; - int uid[2]; - int iid[2]; - - /* Create the unique socket identifier - * so that we know the connection originated - * from us. - */ - uid[0] = getpid(); - uid[1] = id++; - if(apr_socket_create(&ls, AF_INET, SOCK_STREAM, APR_PROTO_TCP, pool) != APR_SUCCESS) { - return apr_get_netos_error(); - } - apr_socket_opt_set(ls, APR_SO_REUSEADDR, 1); - - if(apr_sockaddr_info_get(&pa,"127.0.0.1",APR_INET,0,0,pool) != APR_SUCCESS) { - apr_socket_close(ls); - return apr_get_netos_error(); - } - - if(apr_socket_bind(ls, pa) != APR_SUCCESS) { - apr_socket_close(ls); - return apr_get_netos_error(); - } - - if(apr_socket_addr_get(&ca,APR_LOCAL,ls) != APR_SUCCESS) { - apr_socket_close(ls); - return apr_get_netos_error(); - } - - if(apr_socket_listen(ls,1) != APR_SUCCESS) { - apr_socket_close(ls); - return apr_get_netos_error(); - } - - if(apr_socket_create(wr, AF_INET, SOCK_STREAM, APR_PROTO_TCP, pool) != APR_SUCCESS) { - apr_socket_close(ls); - return apr_get_netos_error(); - } - apr_socket_opt_set(*wr, APR_SO_REUSEADDR, 1); - - if(apr_socket_connect(*wr, ca) != APR_SUCCESS) { - apr_socket_close(ls); - apr_socket_close(*wr); - return apr_get_netos_error(); - } - nrd = sizeof(uid); - if(apr_socket_send(*wr, (char *)uid, &nrd) != APR_SUCCESS) { - apr_socket_close(ls); - apr_socket_close(*wr); - return apr_get_netos_error(); - } - - apr_socket_opt_set(ls, APR_SO_NONBLOCK, 0); - /* Listening socket is blocking by now. The accept should - * return immediatelly because we connected already. - */ - if(apr_socket_accept(rd, ls, pool) != APR_SUCCESS) { - apr_socket_close(ls); - apr_socket_close(*wr); - return apr_get_netos_error(); - } - - /* Put read side of the pipe to the blocking mode */ - apr_socket_opt_set(*rd, APR_SO_NONBLOCK, 0); - - for (;;) { - /* Verify the connection by reading the sent identification */ - nrd = sizeof(iid); - if(apr_socket_recv(*rd, (char *)iid, &nrd) != APR_SUCCESS) { - apr_socket_close(ls); - apr_socket_close(*wr); - apr_socket_close(*rd); - return apr_get_netos_error(); - } - if(nrd == sizeof(iid)) { - if(memcmp(uid, iid, sizeof(uid)) == 0) { - /* Wow, we recived what we sent */ - break; - } - } - } - - /* We don't need the listening socket any more */ - apr_socket_close(ls); - return APR_SUCCESS; -} - -/** Create a dummy wakeup pipe for interrupting the poller */ -static apt_bool_t apt_wakeup_pipe_create(apt_pollset_t *pollset) -{ - apr_socket_t *rd = NULL; - apr_socket_t *wr = NULL; - apr_status_t rv; - rv = socket_pipe_create(&rd,&wr,pollset->pool); - if(rv != APR_SUCCESS) { - char err_str[256]; - apr_strerror(rv,err_str,sizeof(err_str)); - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Wakeup Pipe: %s",err_str); - return FALSE; - } - pollset->wakeup_pfd.reqevents = APR_POLLIN; - pollset->wakeup_pfd.desc_type = APR_POLL_SOCKET; - pollset->wakeup_pfd.desc.s = rd; - - pollset->wakeup_pipe[0] = rd; - pollset->wakeup_pipe[1] = wr; - return TRUE; -} - -/** Destroy wakeup pipe */ -static apt_bool_t apt_wakeup_pipe_destroy(apt_pollset_t *pollset) -{ - /* Close both sides of the wakeup pipe */ - if(pollset->wakeup_pipe[0]) { - apr_socket_close(pollset->wakeup_pipe[0]); - pollset->wakeup_pipe[0] = NULL; - } - if(pollset->wakeup_pipe[1]) { - apr_socket_close(pollset->wakeup_pipe[1]); - pollset->wakeup_pipe[1] = NULL; - } - return TRUE; -} - -#else - -/** Create a dummy wakeup pipe for interrupting the poller */ -static apt_bool_t apt_wakeup_pipe_create(apt_pollset_t *pollset) -{ - apr_file_t *file_in = NULL; - apr_file_t *file_out = NULL; - - if(apr_file_pipe_create(&file_in,&file_out,pollset->pool) != APR_SUCCESS) { - return FALSE; - } - pollset->wakeup_pfd.reqevents = APR_POLLIN; - pollset->wakeup_pfd.desc_type = APR_POLL_FILE; - pollset->wakeup_pfd.desc.f = file_in; - - pollset->wakeup_pipe[0] = file_in; - pollset->wakeup_pipe[1] = file_out; - return TRUE; -} - -/** Destroy wakeup pipe */ -static apt_bool_t apt_wakeup_pipe_destroy(apt_pollset_t *pollset) -{ - /* Close both sides of the wakeup pipe */ - if(pollset->wakeup_pipe[0]) { - apr_file_close(pollset->wakeup_pipe[0]); - pollset->wakeup_pipe[0] = NULL; - } - if(pollset->wakeup_pipe[1]) { - apr_file_close(pollset->wakeup_pipe[1]); - pollset->wakeup_pipe[1] = NULL; - } - return TRUE; -} - -#endif diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_pool.c b/libs/unimrcp/libs/apr-toolkit/src/apt_pool.c deleted file mode 100644 index 48ce662903..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_pool.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_pool.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "apt_pool.h" -#include "apt_log.h" - -#define OWN_ALLOCATOR_PER_POOL - -static int apt_abort_fn(int retcode) -{ - apt_log(APT_LOG_MARK,APT_PRIO_CRITICAL,"APR Abort Called [%d]", retcode); - return 0; -} - -APT_DECLARE(apr_pool_t*) apt_pool_create() -{ - apr_pool_t *pool = NULL; - -#ifdef OWN_ALLOCATOR_PER_POOL - apr_allocator_t *allocator = NULL; - apr_thread_mutex_t *mutex = NULL; - - if(apr_allocator_create(&allocator) == APR_SUCCESS) { - if(apr_pool_create_ex(&pool,NULL,apt_abort_fn,allocator) == APR_SUCCESS) { - apr_allocator_owner_set(allocator,pool); - apr_thread_mutex_create(&mutex,APR_THREAD_MUTEX_NESTED,pool); - apr_allocator_mutex_set(allocator,mutex); - apr_pool_mutex_set(pool,mutex); - } - } -#else - apr_pool_create(&pool,NULL); -#endif - return pool; -} - -APT_DECLARE(apr_pool_t*) apt_subpool_create(apr_pool_t *parent) -{ - apr_pool_t *pool = NULL; - apr_pool_create(&pool,parent); - return pool; -} diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_string_table.c b/libs/unimrcp/libs/apr-toolkit/src/apt_string_table.c deleted file mode 100644 index 5928e38c13..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_string_table.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_string_table.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include "apt_string_table.h" - -/* Get the string by a given id. */ -APT_DECLARE(const apt_str_t*) apt_string_table_str_get(const apt_str_table_item_t table[], apr_size_t size, apr_size_t id) -{ - if(id < size) { - return &table[id].value; - } - return NULL; -} - -/* Find the id associated with a given string from the table */ -APT_DECLARE(apr_size_t) apt_string_table_id_find(const apt_str_table_item_t table[], apr_size_t size, const apt_str_t *value) -{ - /* Key character is stored within each apt_string_table_item. - At first, key characters must be matched in a loop crossing the items. - Then whole strings should be compared only for the matched item. - Key characters should be automatically generated once for a given string table. */ - - apr_size_t i; - const apt_str_table_item_t *item; - for(i=0; ivalue.length != value->length) { - /* lengths of th strings differ, just contninue */ - continue; - } - /* check whether key is available */ - if(item->key < value->length) { - /* check whether values are matched by key (using no case compare) */ - if(value->length == item->value.length && - tolower(item->value.buf[item->key]) == tolower(value->buf[item->key])) { - /* whole strings must be compared to ensure, should be done only once for each lookup */ - if(apt_string_compare(&item->value,value) == TRUE) { - return i; - } - } - } - else { - /* no key available, just compare whole strings */ - if(apt_string_compare(&item->value,value) == TRUE) { - return i; - } - } - } - - /* no match found, return invalid id */ - return size; -} diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_task.c b/libs/unimrcp/libs/apr-toolkit/src/apt_task.c deleted file mode 100644 index 83e04c963c..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_task.c +++ /dev/null @@ -1,623 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_task.c 2219 2014-11-11 02:35:14Z achaloyan@gmail.com $ - */ - -#ifdef WIN32 -#pragma warning(disable: 4127) -#endif -#include -#include -#include -#include -#include "apt_task.h" -#include "apt_log.h" - -/** Internal states of the task */ -typedef enum { - TASK_STATE_IDLE, /**< no task activity */ - TASK_STATE_START_REQUESTED, /**< start of the task has been requested, but it's not running yet */ - TASK_STATE_RUNNING, /**< task is running */ - TASK_STATE_TERMINATE_REQUESTED /**< termination of the task has been requested, but it's still running */ -} apt_task_state_e; - -struct apt_task_t { - APR_RING_ENTRY(apt_task_t) link; /* entry to parent task ring */ - APR_RING_HEAD(apt_task_head_t, apt_task_t) head; /* head of child tasks ring */ - - const char *name; /* name of the task */ - void *obj; /* external object associated with the task */ - apr_pool_t *pool; /* memory pool to allocate task data from */ - apt_task_msg_pool_t *msg_pool; /* message pool to allocate task messages from */ - apr_thread_mutex_t *data_guard; /* mutex to protect task data */ - apr_thread_t *thread_handle; /* thread handle */ - apt_task_state_e state; /* current task state */ - apt_task_vtable_t vtable; /* table of virtual methods */ - apt_task_t *parent_task; /* parent (master) task */ - apr_size_t pending_start; /* number of pending start requests */ - apr_size_t pending_term; /* number of pending terminate requests */ - apr_size_t pending_off; /* number of pending taking-offline requests */ - apr_size_t pending_on; /* number of pending bringing-online requests */ - apt_bool_t running; /* task is running (TRUE if even terminate has already been requested) */ - apt_bool_t auto_ready; /* if TRUE, task is implicitly ready to process messages */ -}; - -static void* APR_THREAD_FUNC apt_task_run(apr_thread_t *thread_handle, void *data); -static APR_INLINE void apt_task_vtable_reset(apt_task_vtable_t *vtable); - -static apt_bool_t apt_task_core_msg_signal(apt_task_t *task, apt_task_msg_pool_t *msg_pool, apt_core_task_msg_type_e type); - -static apt_bool_t apt_task_terminate_request(apt_task_t *task); - -static apt_bool_t apt_task_start_process_internal(apt_task_t *task); -static apt_bool_t apt_task_terminate_process_internal(apt_task_t *task); -static apt_bool_t apt_task_offline_request_process(apt_task_t *task); -static apt_bool_t apt_task_online_request_process(apt_task_t *task); - -static apt_bool_t apt_task_offline_request_complete(apt_task_t *task); -static apt_bool_t apt_task_online_request_complete(apt_task_t *task); - -static void apt_task_start_complete_raise(apt_task_t *task); -static void apt_task_terminate_complete_raise(apt_task_t *task); -static void apt_task_offline_complete_raise(apt_task_t *task); -static void apt_task_online_complete_raise(apt_task_t *task); - - -APT_DECLARE(apt_task_t*) apt_task_create( - void *obj, - apt_task_msg_pool_t *msg_pool, - apr_pool_t *pool) -{ - apt_task_t *task = apr_palloc(pool,sizeof(apt_task_t)); - task->obj = obj; - task->pool = pool; - task->msg_pool = msg_pool; - - if(!task->msg_pool) { - task->msg_pool = apt_task_msg_pool_create_dynamic(0,pool); - } - - task->state = TASK_STATE_IDLE; - task->thread_handle = NULL; - if(apr_thread_mutex_create(&task->data_guard, APR_THREAD_MUTEX_DEFAULT, task->pool) != APR_SUCCESS) { - return NULL; - } - - /* reset vtable */ - apt_task_vtable_reset(&task->vtable); - task->vtable.terminate = apt_task_terminate_request; - task->vtable.process_start = apt_task_start_process_internal; - task->vtable.process_terminate = apt_task_terminate_process_internal; - - APR_RING_ELEM_INIT(task, link); - APR_RING_INIT(&task->head, apt_task_t, link); - - task->parent_task = NULL; - task->pending_start = 0; - task->pending_term = 0; - task->pending_off = 0; - task->pending_on = 0; - task->auto_ready = TRUE; - task->name = "Task"; - return task; -} - -APT_DECLARE(apt_bool_t) apt_task_destroy(apt_task_t *task) -{ - apt_task_t *child_task; - APR_RING_FOREACH(child_task, &task->head, apt_task_t, link) { - apt_task_destroy(child_task); - } - - if(task->state != TASK_STATE_IDLE) { - apt_task_wait_till_complete(task); - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Destroy Task [%s]",task->name); - if(task->vtable.destroy) { - task->vtable.destroy(task); - } - - apr_thread_mutex_destroy(task->data_guard); - return TRUE; -} - -APT_DECLARE(apt_bool_t) apt_task_add(apt_task_t *task, apt_task_t *child_task) -{ - if(!child_task) - return FALSE; - - child_task->parent_task = task; - APR_RING_INSERT_TAIL(&task->head,child_task,apt_task_t,link); - return TRUE; -} - -APT_DECLARE(apt_bool_t) apt_task_start(apt_task_t *task) -{ - apt_bool_t status = TRUE; - apr_thread_mutex_lock(task->data_guard); - if(task->state == TASK_STATE_IDLE) { - apr_status_t rv; - task->state = TASK_STATE_START_REQUESTED; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Start Task [%s]",task->name); - if(task->vtable.start) { - /* invoke virtual start method */ - task->vtable.start(task); - } - else { - /* start new thread by default */ - rv = apr_thread_create(&task->thread_handle,NULL,apt_task_run,task,task->pool); - if(rv != APR_SUCCESS) { - task->state = TASK_STATE_IDLE; - status = FALSE; - } - } - } - else { - status = FALSE; - } - apr_thread_mutex_unlock(task->data_guard); - return status; -} - -APT_DECLARE(apt_bool_t) apt_task_offline(apt_task_t *task) -{ - return apt_task_core_msg_signal(task,task->msg_pool,CORE_TASK_MSG_TAKEOFFLINE_REQUEST); -} - -APT_DECLARE(apt_bool_t) apt_task_online(apt_task_t *task) -{ - return apt_task_core_msg_signal(task,task->msg_pool,CORE_TASK_MSG_BRINGONLINE_REQUEST); -} - -APT_DECLARE(apt_bool_t) apt_task_terminate(apt_task_t *task, apt_bool_t wait_till_complete) -{ - apt_bool_t status = FALSE; - apr_thread_mutex_lock(task->data_guard); - if(task->state == TASK_STATE_START_REQUESTED || task->state == TASK_STATE_RUNNING) { - task->state = TASK_STATE_TERMINATE_REQUESTED; - } - apr_thread_mutex_unlock(task->data_guard); - - if(task->state == TASK_STATE_TERMINATE_REQUESTED) { - /* invoke virtual terminate method */ - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Terminate Task [%s]",task->name); - if(task->vtable.terminate) { - status = task->vtable.terminate(task); - } - - if(wait_till_complete == TRUE && status == TRUE) { - apt_task_wait_till_complete(task); - } - } - - return status; -} - -APT_DECLARE(apt_bool_t) apt_task_wait_till_complete(apt_task_t *task) -{ - if(task->thread_handle) { - apr_status_t s; - apr_thread_join(&s,task->thread_handle); - task->thread_handle = NULL; - } - return TRUE; -} - -APT_DECLARE(void) apt_task_delay(apr_size_t msec) -{ - apr_sleep(1000*msec); -} - -APT_DECLARE(apt_task_t*) apt_task_parent_get(const apt_task_t *task) -{ - return task->parent_task; -} - -APT_DECLARE(apr_pool_t*) apt_task_pool_get(const apt_task_t *task) -{ - return task->pool; -} - -APT_DECLARE(void*) apt_task_object_get(const apt_task_t *task) -{ - return task->obj; -} - -APT_DECLARE(apt_task_vtable_t*) apt_task_vtable_get(apt_task_t *task) -{ - return &task->vtable; -} - -APT_DECLARE(void) apt_task_name_set(apt_task_t *task, const char *name) -{ - task->name = name; -} - -APT_DECLARE(const char*) apt_task_name_get(const apt_task_t *task) -{ - return task->name; -} - -APT_DECLARE(apt_task_msg_t*) apt_task_msg_get(apt_task_t *task) -{ - if(task->msg_pool) { - return apt_task_msg_acquire(task->msg_pool); - } - return NULL; -} - -APT_DECLARE(apt_bool_t) apt_task_msg_signal(apt_task_t *task, apt_task_msg_t *msg) -{ - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Signal Message to [%s] ["APT_PTR_FMT";%d;%d]", - task->name, msg, msg->type, msg->sub_type); - if(task->vtable.signal_msg) { - if(task->vtable.signal_msg(task,msg) == TRUE) { - return TRUE; - } - } - - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Signal Task Message [%s] [0x%x;%d;%d]", - task->name, msg, msg->type, msg->sub_type); - apt_task_msg_release(msg); - return FALSE; -} - -APT_DECLARE(apt_bool_t) apt_task_msg_parent_signal(apt_task_t *task, apt_task_msg_t *msg) -{ - apt_task_t *parent_task = task->parent_task; - if(parent_task) { - return apt_task_msg_signal(parent_task,msg); - } - - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Null Parent Task [%s]",task->name); - apt_task_msg_release(msg); - return FALSE; -} - -static apt_bool_t apt_task_core_msg_signal(apt_task_t *task, apt_task_msg_pool_t *msg_pool, apt_core_task_msg_type_e type) -{ - if(task && msg_pool) { - apt_task_msg_t *msg = apt_task_msg_acquire(msg_pool); - /* signal core task message */ - msg->type = TASK_MSG_CORE; - msg->sub_type = type; - return apt_task_msg_signal(task,msg); - } - return FALSE; -} - -static apt_bool_t apt_core_task_msg_process(apt_task_t *task, apt_task_msg_t *msg) -{ - switch(msg->sub_type) { - case CORE_TASK_MSG_START_COMPLETE: - apt_task_start_request_remove(task); - break; - case CORE_TASK_MSG_TERMINATE_REQUEST: - if(task->vtable.process_terminate) { - task->vtable.process_terminate(task); - } - break; - case CORE_TASK_MSG_TERMINATE_COMPLETE: - apt_task_terminate_request_remove(task); - break; - case CORE_TASK_MSG_TAKEOFFLINE_REQUEST: - apt_task_offline_request_process(task); - break; - case CORE_TASK_MSG_TAKEOFFLINE_COMPLETE: - apt_task_offline_request_complete(task); - break; - case CORE_TASK_MSG_BRINGONLINE_REQUEST: - apt_task_online_request_process(task); - break; - case CORE_TASK_MSG_BRINGONLINE_COMPLETE: - apt_task_online_request_complete(task); - break; - default: break; - } - return TRUE; -} - -APT_DECLARE(apt_bool_t) apt_task_msg_process(apt_task_t *task, apt_task_msg_t *msg) -{ - apt_bool_t status = FALSE; - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Process Message [%s] ["APT_PTR_FMT";%d;%d]", - task->name, msg, msg->type, msg->sub_type); - if(msg->type == TASK_MSG_CORE) { - status = apt_core_task_msg_process(task,msg); - } - else { - if(task->vtable.process_msg) { - status = task->vtable.process_msg(task,msg); - } - } - - apt_task_msg_release(msg); - return status; -} - -static apt_bool_t apt_task_terminate_request(apt_task_t *task) -{ - return apt_task_core_msg_signal(task,task->msg_pool,CORE_TASK_MSG_TERMINATE_REQUEST); -} - -APT_DECLARE(apt_bool_t) apt_task_start_request_process(apt_task_t *task) -{ - return apt_task_start_process_internal(task); -} - -static apt_bool_t apt_task_start_process_internal(apt_task_t *task) -{ - apt_task_t *child_task; - APR_RING_FOREACH(child_task, &task->head, apt_task_t, link) { - if(apt_task_start(child_task) == TRUE) { - task->pending_start++; - } - } - - if(!task->pending_start) { - /* no child task to start, just raise start-complete event */ - apt_task_start_complete_raise(task); - } - return TRUE; -} - -APT_DECLARE(apt_bool_t) apt_task_terminate_request_process(apt_task_t *task) -{ - return apt_task_terminate_process_internal(task); -} - -static apt_bool_t apt_task_terminate_process_internal(apt_task_t *task) -{ - apt_task_t *child_task; - APR_RING_FOREACH(child_task, &task->head, apt_task_t, link) { -#ifdef ENABLE_SIMULT_TASK_TERMINATION - if(child_task->thread_handle) { - apr_thread_detach(child_task->thread_handle); - child_task->thread_handle = NULL; - } - if(apt_task_terminate(child_task,FALSE) == TRUE) { - task->pending_term++; - } -#else - apt_task_terminate(child_task,TRUE); -#endif - } - - if(!task->pending_term) { - /* no child task to terminate, just raise terminate-complete event */ - apt_task_terminate_complete_raise(task); - task->running = FALSE; - } - return TRUE; -} - -static apt_bool_t apt_task_offline_request_process(apt_task_t *task) -{ - apt_task_t *child_task; - APR_RING_FOREACH(child_task, &task->head, apt_task_t, link) { - if(apt_task_offline(child_task) == TRUE) { - task->pending_off++; - } - } - - if(!task->pending_off) { - /* no child task, just raise offline-complete event */ - apt_task_offline_complete_raise(task); - } - return TRUE; -} - -static apt_bool_t apt_task_online_request_process(apt_task_t *task) -{ - apt_task_t *child_task; - APR_RING_FOREACH(child_task, &task->head, apt_task_t, link) { - if(apt_task_online(child_task) == TRUE) { - task->pending_on++; - } - } - - if(!task->pending_on) { - /* no child task, just raise online-complete event */ - apt_task_online_complete_raise(task); - } - return TRUE; -} - -APT_DECLARE(void) apt_task_auto_ready_set(apt_task_t *task, apt_bool_t auto_ready) -{ - task->auto_ready = auto_ready; -} - -APT_DECLARE(apt_bool_t) apt_task_ready(apt_task_t *task) -{ - if(task->auto_ready == TRUE) { - return FALSE; - } - - /* start child tasks (if any) */ - if(task->vtable.process_start) { - task->vtable.process_start(task); - } - return TRUE; -} - -APT_DECLARE(apt_bool_t*) apt_task_running_flag_get(apt_task_t *task) -{ - return &task->running; -} - -APT_DECLARE(apt_bool_t) apt_task_start_request_add(apt_task_t *task) -{ - task->pending_start++; - return TRUE; -} - -APT_DECLARE(apt_bool_t) apt_task_start_request_remove(apt_task_t *task) -{ - if(!task->pending_start) { - /* error case, no pending start */ - return FALSE; - } - task->pending_start--; - if(!task->pending_start) { - apt_task_start_complete_raise(task); - } - return TRUE; -} - -APT_DECLARE(apt_bool_t) apt_task_terminate_request_add(apt_task_t *task) -{ - task->pending_term++; - return TRUE; -} - -APT_DECLARE(apt_bool_t) apt_task_terminate_request_remove(apt_task_t *task) -{ - if(!task->pending_term) { - /* error case, no pending terminate */ - return FALSE; - } - task->pending_term--; - if(!task->pending_term) { - apt_task_terminate_complete_raise(task); - task->running = FALSE; - } - return TRUE; -} - -static apt_bool_t apt_task_offline_request_complete(apt_task_t *task) -{ - if(!task->pending_off) { - /* error case, no pending request */ - return FALSE; - } - task->pending_off--; - if(!task->pending_off) { - apt_task_offline_complete_raise(task); - } - return TRUE; -} - -static apt_bool_t apt_task_online_request_complete(apt_task_t *task) -{ - if(!task->pending_on) { - /* error case, no pending request */ - return FALSE; - } - task->pending_on--; - if(!task->pending_on) { - apt_task_online_complete_raise(task); - } - return TRUE; -} - -static void apt_task_start_complete_raise(apt_task_t *task) -{ - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Task Started [%s]",task->name); - if(task->vtable.on_start_complete) { - task->vtable.on_start_complete(task); - } - apt_task_core_msg_signal(task->parent_task,task->msg_pool,CORE_TASK_MSG_START_COMPLETE); -} - -static void apt_task_terminate_complete_raise(apt_task_t *task) -{ - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Task Terminated [%s]",task->name); - if(task->vtable.on_terminate_complete) { - task->vtable.on_terminate_complete(task); - } -#ifdef ENABLE_SIMULT_TASK_TERMINATION - apt_task_core_msg_signal(task->parent_task,task->msg_pool,CORE_TASK_MSG_TERMINATE_COMPLETE); -#endif -} - -static void apt_task_offline_complete_raise(apt_task_t *task) -{ - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Task Taken Offline [%s]",task->name); - if(task->vtable.on_offline_complete) { - task->vtable.on_offline_complete(task); - } - apt_task_core_msg_signal(task->parent_task,task->msg_pool,CORE_TASK_MSG_TAKEOFFLINE_COMPLETE); -} - -static void apt_task_online_complete_raise(apt_task_t *task) -{ - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Task Brought Online [%s]",task->name); - if(task->vtable.on_online_complete) { - task->vtable.on_online_complete(task); - } - apt_task_core_msg_signal(task->parent_task,task->msg_pool,CORE_TASK_MSG_BRINGONLINE_COMPLETE); -} - -static void* APR_THREAD_FUNC apt_task_run(apr_thread_t *thread_handle, void *data) -{ - apt_task_t *task = data; - -#if APR_HAS_SETTHREADNAME - apr_thread_name_set(task->name); -#endif - /* raise pre-run event */ - if(task->vtable.on_pre_run) { - task->vtable.on_pre_run(task); - } - apr_thread_mutex_lock(task->data_guard); - task->state = TASK_STATE_RUNNING; - task->running = TRUE; - apr_thread_mutex_unlock(task->data_guard); - - if(task->auto_ready == TRUE) { - /* start child tasks (if any) */ - if(task->vtable.process_start) { - task->vtable.process_start(task); - } - } - - /* run task */ - if(task->vtable.run) { - task->vtable.run(task); - } - - apr_thread_mutex_lock(task->data_guard); - task->state = TASK_STATE_IDLE; - task->running = FALSE; - apr_thread_mutex_unlock(task->data_guard); - /* raise post-run event */ - if(task->vtable.on_post_run) { - task->vtable.on_post_run(task); - } - - apr_thread_exit(thread_handle,APR_SUCCESS); - return NULL; -} - -static APR_INLINE void apt_task_vtable_reset(apt_task_vtable_t *vtable) -{ - vtable->destroy = NULL; - vtable->start = NULL; - vtable->terminate = NULL; - vtable->run = NULL; - vtable->signal_msg = NULL; - vtable->process_msg = NULL; - vtable->process_start = NULL; - vtable->process_terminate = NULL; - vtable->on_pre_run = NULL; - vtable->on_post_run = NULL; - vtable->on_start_complete = NULL; - vtable->on_terminate_complete = NULL; - vtable->on_offline_complete = NULL; - vtable->on_online_complete = NULL; -} diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_task_msg.c b/libs/unimrcp/libs/apr-toolkit/src/apt_task_msg.c deleted file mode 100644 index d593e26eb0..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_task_msg.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_task_msg.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include "apt_task_msg.h" - -/** Abstract pool of task messages to allocate task messages from */ -struct apt_task_msg_pool_t { - void (*destroy)(apt_task_msg_pool_t *pool); - - apt_task_msg_t* (*acquire_msg)(apt_task_msg_pool_t *pool); - void (*release_msg)(apt_task_msg_t *task_msg); - - void *obj; - apr_pool_t *pool; -}; - - -/** Dynamic allocation of messages (no actual pool exist)*/ -typedef struct apt_msg_pool_dynamic_t apt_msg_pool_dynamic_t; - -struct apt_msg_pool_dynamic_t { - apr_size_t size; -}; - -static apt_task_msg_t* dynamic_pool_acquire_msg(apt_task_msg_pool_t *task_msg_pool) -{ - apt_msg_pool_dynamic_t *dynamic_pool = task_msg_pool->obj; - apt_task_msg_t *task_msg = malloc(dynamic_pool->size); - task_msg->msg_pool = task_msg_pool; - task_msg->type = TASK_MSG_USER; - task_msg->sub_type = 0; - return task_msg; -} - -static void dynamic_pool_release_msg(apt_task_msg_t *task_msg) -{ - if(task_msg) { - free(task_msg); - } -} - -static void dynamic_pool_destroy(apt_task_msg_pool_t *task_msg_pool) -{ - /* nothing to do */ -} - -APT_DECLARE(apt_task_msg_pool_t*) apt_task_msg_pool_create_dynamic(apr_size_t msg_size, apr_pool_t *pool) -{ - apt_task_msg_pool_t *task_msg_pool = apr_palloc(pool,sizeof(apt_task_msg_pool_t)); - apt_msg_pool_dynamic_t *dynamic_pool = apr_palloc(pool,sizeof(apt_msg_pool_dynamic_t)); - dynamic_pool->size = msg_size + sizeof(apt_task_msg_t) - 1; - - task_msg_pool->pool = pool; - task_msg_pool->obj = dynamic_pool; - task_msg_pool->acquire_msg = dynamic_pool_acquire_msg; - task_msg_pool->release_msg = dynamic_pool_release_msg; - task_msg_pool->destroy = dynamic_pool_destroy; - return task_msg_pool; -} - - -/** Static allocation of messages from message pool (not implemented yet) */ -APT_DECLARE(apt_task_msg_pool_t*) apt_task_msg_pool_create_static(apr_size_t msg_size, apr_size_t pool_size, apr_pool_t *pool) -{ - return NULL; -} - - - -APT_DECLARE(void) apt_task_msg_pool_destroy(apt_task_msg_pool_t *msg_pool) -{ - if(msg_pool->destroy) { - msg_pool->destroy(msg_pool); - } -} - -APT_DECLARE(apt_task_msg_t*) apt_task_msg_acquire(apt_task_msg_pool_t *task_msg_pool) -{ - if(!task_msg_pool->acquire_msg) - return NULL; - return task_msg_pool->acquire_msg(task_msg_pool); -} - -APT_DECLARE(void) apt_task_msg_release(apt_task_msg_t *task_msg) -{ - apt_task_msg_pool_t *task_msg_pool = task_msg->msg_pool; - if(task_msg_pool->release_msg) - task_msg_pool->release_msg(task_msg); -} diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_test_suite.c b/libs/unimrcp/libs/apr-toolkit/src/apt_test_suite.c deleted file mode 100644 index 4704235079..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_test_suite.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_test_suite.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "apt_pool.h" -#include "apt_obj_list.h" -#include "apt_test_suite.h" -#include "apt_log.h" - -struct apt_test_framework_t{ - apr_pool_t *pool; - apt_obj_list_t *suites; -}; - -APT_DECLARE(apt_test_suite_t*) apt_test_suite_create(apr_pool_t *pool, const char *name, - void *obj, apt_test_f tester) -{ - apt_test_suite_t *suite = apr_palloc(pool,sizeof(apt_test_suite_t)); - suite->pool = pool; - apt_string_assign(&suite->name,name,pool); - suite->obj = obj; - suite->tester = tester; - return suite; -} - -APT_DECLARE(apt_test_framework_t*) apt_test_framework_create() -{ - apt_test_framework_t *framework; - apr_pool_t* pool = apt_pool_create(); - framework = apr_palloc(pool,sizeof(apt_test_framework_t)); - framework->pool = pool; - framework->suites = apt_list_create(pool); - - apt_log_instance_create(APT_LOG_OUTPUT_CONSOLE,APT_PRIO_INFO,pool); - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create Test Framework"); - return framework; -} - -APT_DECLARE(void) apt_test_framework_destroy(apt_test_framework_t *framework) -{ - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy Test Framework"); - apt_log_instance_destroy(); - apr_pool_destroy(framework->pool); -} - -APT_DECLARE(apt_bool_t) apt_test_framework_suite_add(apt_test_framework_t *framework, apt_test_suite_t *suite) -{ - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Add Test Suite [%s]",suite->name.buf); - return (apt_list_push_back(framework->suites,suite,suite->pool) ? TRUE : FALSE); -} - -APT_DECLARE(apr_pool_t*) apt_test_framework_pool_get(const apt_test_framework_t *framework) -{ - return framework->pool; -} - -static apt_bool_t apt_test_framework_suite_run(apt_test_framework_t *framework, apt_test_suite_t *suite, - int argc, const char * const *argv) -{ - apt_bool_t status = FALSE; - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"----- Run Test Suite [%s] -----",suite->name.buf); - if(suite->tester) { - status = suite->tester(suite,argc,argv); - } - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"---- Status [%s] ----\n",(status == TRUE) ? "OK" : "Failure"); - return status; -} - -APT_DECLARE(apt_bool_t) apt_test_framework_run(apt_test_framework_t *framework, int argc, const char * const *argv) -{ - apt_test_suite_t *suite = NULL; - apt_list_elem_t *elem = apt_list_first_elem_get(framework->suites); - if(argc == 1) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Run All Test Suites"); - /* walk through the list of test suites and run all of them */ - while(elem) { - suite = apt_list_elem_object_get(elem); - if(suite) { - /* run test suite with the default arguments */ - apt_test_framework_suite_run(framework,suite,0,NULL); - } - elem = apt_list_next_elem_get(framework->suites,elem); - } - } - else { - /* walk through the list of test suites find appropriate one and run it */ - apt_bool_t found = FALSE; - apt_str_t name; - apt_string_set(&name,argv[1]); - while(elem) { - suite = apt_list_elem_object_get(elem); - if(suite && apt_string_compare(&suite->name,&name) == TRUE) { - found = TRUE; - break; - } - elem = apt_list_next_elem_get(framework->suites,elem); - } - if(found == TRUE) { - /* run test suite with remaining arguments */ - apt_test_framework_suite_run(framework,suite,argc-2,&argv[2]); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Such Test Suite [%s] to Run", argv[1]); - } - } - return TRUE; -} diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_text_message.c b/libs/unimrcp/libs/apr-toolkit/src/apt_text_message.c deleted file mode 100644 index 4a9db353df..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_text_message.c +++ /dev/null @@ -1,451 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_text_message.c 2218 2014-11-11 02:28:58Z achaloyan@gmail.com $ - */ - -#include "apt_text_message.h" -#include "apt_log.h" - -/** Stage of text message processing (parsing/generation) */ -typedef enum { - APT_MESSAGE_STAGE_START_LINE, - APT_MESSAGE_STAGE_HEADER, - APT_MESSAGE_STAGE_BODY -} apt_message_stage_e; - - -/** Text message parser */ -struct apt_message_parser_t { - const apt_message_parser_vtable_t *vtable; - void *obj; - apr_pool_t *pool; - apt_message_context_t context; - apr_size_t content_length; - apt_message_stage_e stage; - apt_bool_t skip_lf; - apt_bool_t verbose; -}; - -/** Text message generator */ -struct apt_message_generator_t { - const apt_message_generator_vtable_t *vtable; - void *obj; - apr_pool_t *pool; - apt_message_context_t context; - apr_size_t content_length; - apt_message_stage_e stage; - apt_bool_t verbose; -}; - -/** Parse individual header field (name-value pair) */ -APT_DECLARE(apt_header_field_t*) apt_header_field_parse(apt_text_stream_t *stream, apr_pool_t *pool) -{ - apr_size_t folding_length = 0; - apr_array_header_t *folded_lines = NULL; - apt_header_field_t *header_field; - apt_str_t temp_line; - apt_str_t *line; - apt_pair_t pair; - /* read name-value pair */ - if(apt_text_header_read(stream,&pair) == FALSE) { - return NULL; - } - - /* check folding lines (value spanning multiple lines) */ - while(stream->pos < stream->end) { - if(apt_text_is_wsp(*stream->pos) == FALSE) { - break; - } - - stream->pos++; - - /* skip further white spaces (if any) */ - apt_text_white_spaces_skip(stream); - - if(!folded_lines) { - folded_lines = apr_array_make(pool,1,sizeof(apt_str_t)); - } - if(apt_text_line_read(stream,&temp_line) == TRUE) { - line = apr_array_push(folded_lines); - *line = temp_line; - folding_length += line->length; - } - }; - - header_field = apt_header_field_alloc(pool); - /* copy parsed name of the header field */ - header_field->name.length = pair.name.length; - header_field->name.buf = apr_palloc(pool, pair.name.length + 1); - if(pair.name.length) { - memcpy(header_field->name.buf, pair.name.buf, pair.name.length); - } - header_field->name.buf[header_field->name.length] = '\0'; - - /* copy parsed value of the header field */ - header_field->value.length = pair.value.length + folding_length; - header_field->value.buf = apr_palloc(pool, header_field->value.length + 1); - if(pair.value.length) { - memcpy(header_field->value.buf, pair.value.buf, pair.value.length); - } - - if(folding_length) { - int i; - char *pos = header_field->value.buf + pair.value.length; - /* copy parsed folding lines */ - for(i=0; inelts; i++) { - line = &APR_ARRAY_IDX(folded_lines,i,apt_str_t); - - memcpy(pos,line->buf,line->length); - pos += line->length; - } - } - header_field->value.buf[header_field->value.length] = '\0'; - - return header_field; -} - -/** Generate individual header field (name-value pair) */ -APT_DECLARE(apt_bool_t) apt_header_field_generate(const apt_header_field_t *header_field, apt_text_stream_t *stream) -{ - return apt_text_name_value_insert(stream,&header_field->name,&header_field->value); -} - -/** Parse header section */ -APT_DECLARE(apt_bool_t) apt_header_section_parse(apt_header_section_t *header, apt_text_stream_t *stream, apr_pool_t *pool) -{ - apt_header_field_t *header_field; - apt_bool_t result = FALSE; - - do { - header_field = apt_header_field_parse(stream,pool); - if(header_field) { - if(apt_string_is_empty(&header_field->name) == FALSE) { - /* normal header */ - apt_header_section_field_add(header,header_field); - } - else { - /* empty header => exit */ - result = TRUE; - break; - } - } - else { - /* malformed header => skip to the next one */ - } - } - while(apt_text_is_eos(stream) == FALSE); - - return result; -} - -/** Generate header section */ -APT_DECLARE(apt_bool_t) apt_header_section_generate(const apt_header_section_t *header, apt_text_stream_t *stream) -{ - apt_header_field_t *header_field; - for(header_field = APR_RING_FIRST(&header->ring); - header_field != APR_RING_SENTINEL(&header->ring, apt_header_field_t, link); - header_field = APR_RING_NEXT(header_field, link)) { - apt_header_field_generate(header_field,stream); - } - - return apt_text_eol_insert(stream); -} - -static apt_bool_t apt_message_body_read(apt_message_parser_t *parser, apt_text_stream_t *stream) -{ - apt_bool_t status = TRUE; - apt_str_t *body = parser->context.body; - if(body->buf) { - /* stream length available to read */ - apr_size_t stream_length = stream->text.length - (stream->pos - stream->text.buf); - /* required/remaining length to read */ - apr_size_t required_length = parser->content_length - body->length; - if(required_length > stream_length) { - required_length = stream_length; - /* incomplete */ - status = FALSE; - } - memcpy(body->buf + body->length, stream->pos, required_length); - body->length += required_length; - stream->pos += required_length; - if(parser->verbose == TRUE) { - apr_size_t length = required_length; - const char *masked_data = apt_log_data_mask(stream->pos,&length,parser->pool); - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Parsed Message Body [%"APR_SIZE_T_FMT" bytes]\n%.*s", - required_length, length, masked_data); - } - } - - return status; -} - -static apt_bool_t apt_message_body_write(apt_message_generator_t *generator, apt_text_stream_t *stream) -{ - apt_bool_t status = TRUE; - apt_str_t *body = generator->context.body; - if(body && body->length < generator->content_length) { - /* stream length available to write */ - apr_size_t stream_length = stream->text.length - (stream->pos - stream->text.buf); - /* required/remaining length to write */ - apr_size_t required_length = generator->content_length - body->length; - if(required_length > stream_length) { - required_length = stream_length; - /* incomplete */ - status = FALSE; - } - - memcpy(stream->pos, body->buf + body->length, required_length); - - if(generator->verbose == TRUE) { - apr_size_t length = required_length; - const char *masked_data = apt_log_data_mask(stream->pos,&length,generator->pool); - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Generated Message Body [%"APR_SIZE_T_FMT" bytes]\n%.*s", - required_length, length, masked_data); - } - - body->length += required_length; - stream->pos += required_length; - } - - return status; -} - - -/** Create message parser */ -APT_DECLARE(apt_message_parser_t*) apt_message_parser_create(void *obj, const apt_message_parser_vtable_t *vtable, apr_pool_t *pool) -{ - apt_message_parser_t *parser = apr_palloc(pool,sizeof(apt_message_parser_t)); - parser->obj = obj; - parser->vtable = vtable; - parser->pool = pool; - parser->context.message = NULL; - parser->context.body = NULL; - parser->context.header = NULL; - parser->content_length = 0; - parser->stage = APT_MESSAGE_STAGE_START_LINE; - parser->skip_lf = FALSE; - parser->verbose = FALSE; - return parser; -} - -static APR_INLINE void apt_crlf_segmentation_test(apt_message_parser_t *parser, apt_text_stream_t *stream) -{ - /* in the worst case message segmentation may occur between and */ - if(stream->pos == stream->end && *(stream->pos-1)== APT_TOKEN_CR) { - /* if this is the case be prepared to skip with the next attempt */ - parser->skip_lf = TRUE; - } -} - -/** Parse message by raising corresponding event handlers */ -APT_DECLARE(apt_message_status_e) apt_message_parser_run(apt_message_parser_t *parser, apt_text_stream_t *stream, void **message) -{ - const char *pos; - apt_message_status_e status = APT_MESSAGE_STATUS_INCOMPLETE; - if(parser->skip_lf == TRUE) { - /* skip occurred as a result of message segmentation between and */ - apt_text_char_skip(stream,APT_TOKEN_LF); - parser->skip_lf = FALSE; - } - if(message) { - *message = NULL; - } - - do { - pos = stream->pos; - if(parser->stage == APT_MESSAGE_STAGE_START_LINE) { - if(parser->vtable->on_start(parser,&parser->context,stream,parser->pool) == FALSE) { - if(apt_text_is_eos(stream) == FALSE) { - status = APT_MESSAGE_STATUS_INVALID; - } - break; - } - - apt_crlf_segmentation_test(parser,stream); - - parser->stage = APT_MESSAGE_STAGE_HEADER; - } - - if(parser->stage == APT_MESSAGE_STAGE_HEADER) { - /* read header section */ - apt_bool_t res = apt_header_section_parse(parser->context.header,stream,parser->pool); - if(parser->verbose == TRUE) { - apr_size_t length = stream->pos - pos; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Parsed Message Header [%"APR_SIZE_T_FMT" bytes]\n%.*s", - length, length, pos); - } - - apt_crlf_segmentation_test(parser,stream); - - if(res == FALSE) { - break; - } - - if(parser->vtable->on_header_complete) { - if(parser->vtable->on_header_complete(parser,&parser->context) == FALSE) { - status = APT_MESSAGE_STATUS_INVALID; - break; - } - } - - if(parser->context.body && parser->context.body->length) { - apt_str_t *body = parser->context.body; - parser->content_length = body->length; - body->buf = apr_palloc(parser->pool,parser->content_length+1); - body->buf[parser->content_length] = '\0'; - body->length = 0; - parser->stage = APT_MESSAGE_STAGE_BODY; - } - else { - status = APT_MESSAGE_STATUS_COMPLETE; - if(message) { - *message = parser->context.message; - } - parser->stage = APT_MESSAGE_STAGE_START_LINE; - break; - } - } - - if(parser->stage == APT_MESSAGE_STAGE_BODY) { - if(apt_message_body_read(parser,stream) == FALSE) { - break; - } - - if(parser->vtable->on_body_complete) { - parser->vtable->on_body_complete(parser,&parser->context); - } - status = APT_MESSAGE_STATUS_COMPLETE; - if(message) { - *message = parser->context.message; - } - parser->stage = APT_MESSAGE_STAGE_START_LINE; - break; - } - } - while(apt_text_is_eos(stream) == FALSE); - - return status; -} - -/** Get external object associated with parser */ -APT_DECLARE(void*) apt_message_parser_object_get(apt_message_parser_t *parser) -{ - return parser->obj; -} - -/** Set verbose mode for the parser */ -APT_DECLARE(void) apt_message_parser_verbose_set(apt_message_parser_t *parser, apt_bool_t verbose) -{ - parser->verbose = verbose; -} - - -/** Create message generator */ -APT_DECLARE(apt_message_generator_t*) apt_message_generator_create(void *obj, const apt_message_generator_vtable_t *vtable, apr_pool_t *pool) -{ - apt_message_generator_t *generator = apr_palloc(pool,sizeof(apt_message_generator_t)); - generator->obj = obj; - generator->vtable = vtable; - generator->pool = pool; - generator->context.message = NULL; - generator->context.header = NULL; - generator->context.body = NULL; - generator->content_length = 0; - generator->stage = APT_MESSAGE_STAGE_START_LINE; - generator->verbose = FALSE; - return generator; -} - -static apt_message_status_e apt_message_generator_break(apt_message_generator_t *generator, apt_text_stream_t *stream) -{ - /* failed to generate message */ - if(apt_text_is_eos(stream) == TRUE) { - /* end of stream reached */ - return APT_MESSAGE_STATUS_INCOMPLETE; - } - - /* error case */ - return APT_MESSAGE_STATUS_INVALID; -} - -/** Generate message */ -APT_DECLARE(apt_message_status_e) apt_message_generator_run(apt_message_generator_t *generator, void *message, apt_text_stream_t *stream) -{ - if(!message) { - return APT_MESSAGE_STATUS_INVALID; - } - - if(message != generator->context.message) { - generator->stage = APT_MESSAGE_STAGE_START_LINE; - generator->context.message = message; - generator->context.header = NULL; - generator->context.body = NULL; - } - - if(generator->stage == APT_MESSAGE_STAGE_START_LINE) { - /* generate start-line */ - if(generator->vtable->on_start(generator,&generator->context,stream) == FALSE) { - return apt_message_generator_break(generator,stream); - } - - if(!generator->context.header || !generator->context.body) { - return APT_MESSAGE_STATUS_INVALID; - } - - /* generate header */ - if(apt_header_section_generate(generator->context.header,stream) == FALSE) { - return apt_message_generator_break(generator,stream); - } - - if(generator->vtable->on_header_complete) { - generator->vtable->on_header_complete(generator,&generator->context,stream); - } - if(generator->verbose == TRUE) { - apr_size_t length = stream->pos - stream->text.buf; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Generated Message Header [%"APR_SIZE_T_FMT" bytes]\n%.*s", - length, length, stream->text.buf); - } - - generator->stage = APT_MESSAGE_STAGE_START_LINE; - generator->content_length = generator->context.body->length; - if(generator->content_length) { - generator->context.body->length = 0; - generator->stage = APT_MESSAGE_STAGE_BODY; - } - } - - if(generator->stage == APT_MESSAGE_STAGE_BODY) { - if(apt_message_body_write(generator,stream) == FALSE) { - return apt_message_generator_break(generator,stream); - } - - generator->stage = APT_MESSAGE_STAGE_START_LINE; - } - - return APT_MESSAGE_STATUS_COMPLETE; -} - -/** Get external object associated with generator */ -APT_DECLARE(void*) apt_message_generator_object_get(apt_message_generator_t *generator) -{ - return generator->obj; -} - -/** Set verbose mode for the parser */ -APT_DECLARE(void) apt_message_generator_verbose_set(apt_message_generator_t *generator, apt_bool_t verbose) -{ - generator->verbose = verbose; -} diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_text_stream.c b/libs/unimrcp/libs/apr-toolkit/src/apt_text_stream.c deleted file mode 100644 index 1df0509ef2..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_text_stream.c +++ /dev/null @@ -1,554 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_text_stream.c 2223 2014-11-12 00:37:40Z achaloyan@gmail.com $ - */ - -#include -#include -#include -#include "apt_text_stream.h" - -#define TOKEN_TRUE "true" -#define TOKEN_FALSE "false" -#define TOKEN_TRUE_LENGTH (sizeof(TOKEN_TRUE)-1) -#define TOKEN_FALSE_LENGTH (sizeof(TOKEN_FALSE)-1) - -#if _MSC_VER >= 1900 -#pragma warning(disable: 4477) -// 'sprintf' : format string '%d' requires an argument of type 'int', but variadic argument 1 has type 'apr_size_t' apt_text_stream.c 495 -// 'sprintf' : format string '%03d' requires an argument of type 'int', but variadic argument 1 has type 'apr_size_t' apt_text_stream.c 515 -#endif - - -/** Navigate through the lines of the text stream (message) */ -APT_DECLARE(apt_bool_t) apt_text_line_read(apt_text_stream_t *stream, apt_str_t *line) -{ - char *pos = stream->pos; - apt_bool_t status = FALSE; - line->length = 0; - line->buf = pos; - /* while not end of stream */ - while(pos < stream->end) { - if(*pos == APT_TOKEN_CR) { - /* end of line detected */ - line->length = pos - line->buf; - pos++; - if(pos < stream->end && *pos == APT_TOKEN_LF) { - pos++; - } - status = TRUE; - break; - } - else if(*pos == APT_TOKEN_LF) { - /* end of line detected */ - line->length = pos - line->buf; - pos++; - status = TRUE; - break; - } - pos++; - } - - if(status == TRUE) { - /* advance stream pos */ - stream->pos = pos; - } - else { - /* end of stream is reached, do not advance stream pos, but set is_eos flag */ - stream->is_eos = TRUE; - line->length = pos - line->buf; - } - return status; -} - -/** To be used to navigate through the header fields (name:value pairs) of the text stream (message) - Valid header fields are: - name:value - name: value - name: value - name: value - name: (only name, no value) - (empty header) - Malformed header fields are: - name:value (missing end of line ) - name (missing separator ':') -*/ -APT_DECLARE(apt_bool_t) apt_text_header_read(apt_text_stream_t *stream, apt_pair_t *pair) -{ - char *pos = stream->pos; - apt_bool_t status = FALSE; - apt_string_reset(&pair->name); - apt_string_reset(&pair->value); - /* while not end of stream */ - while(pos < stream->end) { - if(*pos == APT_TOKEN_CR) { - /* end of line detected */ - if(pair->value.buf) { - /* set length of the value */ - pair->value.length = pos - pair->value.buf; - } - pos++; - if(pos < stream->end && *pos == APT_TOKEN_LF) { - pos++; - } - status = TRUE; - break; - } - else if(*pos == APT_TOKEN_LF) { - /* end of line detected */ - if(pair->value.buf) { - /* set length of the value */ - pair->value.length = pos - pair->value.buf; - } - pos++; - status = TRUE; - break; - } - else if(!pair->name.length) { - /* skip preceding white spaces (SHOULD NOT be any WSP, though) and read name */ - if(!pair->name.buf && apt_text_is_wsp(*pos) == FALSE) { - pair->name.buf = pos; - } - if(*pos == ':') { - /* set length of the name */ - pair->name.length = pos - pair->name.buf; - } - } - else if(!pair->value.length) { - /* skip preceding white spaces and read value */ - if(!pair->value.buf && apt_text_is_wsp(*pos) == FALSE) { - pair->value.buf = pos; - } - } - pos++; - } - - if(status == TRUE) { - /* advance stream pos regardless it's a valid header or not */ - stream->pos = pos; - - /* if length == 0 && buf => header is malformed */ - if(!pair->name.length && pair->name.buf) { - status = FALSE; - } - } - else { - /* end of stream is reached, do not advance stream pos, but set is_eos flag */ - stream->is_eos = TRUE; - } - - return status; -} - - -/** Navigate through the fields of the line */ -APT_DECLARE(apt_bool_t) apt_text_field_read(apt_text_stream_t *stream, char separator, apt_bool_t skip_spaces, apt_str_t *field) -{ - char *pos = stream->pos; - if(skip_spaces == TRUE) { - while(pos < stream->end && *pos == APT_TOKEN_SP) pos++; - } - - field->buf = pos; - field->length = 0; - while(pos < stream->end && *pos != separator) pos++; - - field->length = pos - field->buf; - if(pos < stream->end) { - /* skip the separator */ - pos++; - } - - stream->pos = pos; - return field->length ? TRUE : FALSE; -} - -/** Scroll text stream */ -APT_DECLARE(apt_bool_t) apt_text_stream_scroll(apt_text_stream_t *stream) -{ - if(stream->pos == stream->end) { - stream->pos = stream->text.buf; - } - else { - apr_size_t remaining_length = stream->text.buf + stream->text.length - stream->pos; - if(!remaining_length || remaining_length == stream->text.length) { - stream->pos = stream->text.buf + remaining_length; - return FALSE; - } - memmove(stream->text.buf,stream->pos,remaining_length); - stream->pos = stream->text.buf + remaining_length; - stream->text.length = remaining_length; - } - *stream->pos = '\0'; - return TRUE; -} - -/** Parse id@resource string */ -APT_DECLARE(apt_bool_t) apt_id_resource_parse(const apt_str_t *str, char separator, apt_str_t *id, apt_str_t *resource, apr_pool_t *pool) -{ - apt_str_t field = *str; - const char *pos = strchr(str->buf,separator); - if(!pos) { - return FALSE; - } - - field.length = pos - field.buf; - if(field.length >= str->length) { - return FALSE; - } - apt_string_copy(id,&field,pool); - field.buf += field.length + 1; - field.length = str->length - (field.length + 1); - apt_string_copy(resource,&field,pool); - return TRUE; -} - -/** Generate id@resource string */ -APT_DECLARE(apt_bool_t) apt_id_resource_generate(const apt_str_t *id, const apt_str_t *resource, char separator, apt_str_t *str, apr_pool_t *pool) -{ - apr_size_t length = id->length+resource->length+1; - char *buf = apr_palloc(pool,length+1); - memcpy(buf,id->buf,id->length); - buf[id->length] = separator; - memcpy(buf+id->length+1,resource->buf,resource->length); - buf[length] = '\0'; - str->buf = buf; - str->length = length; - return TRUE; -} - -/** Generate name-value pair line */ -APT_DECLARE(apt_bool_t) apt_text_name_value_insert(apt_text_stream_t *stream, const apt_str_t *name, const apt_str_t *value) -{ - char *pos = stream->pos; - if(pos + name->length + value->length + 2 >= stream->end) { - return FALSE; - } - memcpy(pos,name->buf,name->length); - pos += name->length; - *pos++ = ':'; - *pos++ = APT_TOKEN_SP; - if(apt_string_is_empty(value) == FALSE) { - memcpy(pos,value->buf,value->length); - pos += value->length; - } - stream->pos = pos; - return apt_text_eol_insert(stream); -} - -/** Generate only the name ("name":) of the header field */ -APT_DECLARE(apt_bool_t) apt_text_header_name_insert(apt_text_stream_t *stream, const apt_str_t *name) -{ - char *pos = stream->pos; - if(pos + name->length + 2 >= stream->end) { - return FALSE; - } - memcpy(pos,name->buf,name->length); - pos += name->length; - *pos++ = ':'; - *pos++ = APT_TOKEN_SP; - stream->pos = pos; - return TRUE; -} - -/** Parse name=value pair */ -static apt_bool_t apt_pair_parse(apt_pair_t *pair, const apt_str_t *field, apr_pool_t *pool) -{ - apt_text_stream_t stream; - apt_str_t item; - stream.text = *field; - apt_text_stream_reset(&stream); - - /* read name */ - if(apt_text_field_read(&stream,'=',TRUE,&item) == FALSE) { - return FALSE; - } - apt_string_copy(&pair->name,&item,pool); - - /* read value */ - if(apt_text_field_read(&stream,';',TRUE,&item) == TRUE) { - apt_string_copy(&pair->value,&item,pool); - } - else { - apt_string_reset(&pair->value); - } - return TRUE; -} - -/** Parse array of name-value pairs */ -APT_DECLARE(apt_bool_t) apt_pair_array_parse(apt_pair_arr_t *arr, const apt_str_t *value, apr_pool_t *pool) -{ - apt_str_t field; - apt_pair_t *pair; - apt_text_stream_t stream; - if(!arr || !value) { - return FALSE; - } - - stream.text = *value; - apt_text_stream_reset(&stream); - /* read name-value pairs */ - while(apt_text_field_read(&stream,';',TRUE,&field) == TRUE) { - pair = apr_array_push(arr); - apt_pair_parse(pair,&field,pool); - } - return TRUE; -} - -/** Generate array of name-value pairs */ -APT_DECLARE(apt_bool_t) apt_pair_array_generate(const apt_pair_arr_t *arr, apt_str_t *str, apr_pool_t *pool) -{ - int i; - char *pos; - apt_pair_t *pair; - if(!arr || !str) { - return FALSE; - } - - /* Compute length of string being generated */ - str->length = 0; - for(i=0; inelts; i++) { - pair = (apt_pair_t*)arr->elts + i; - /* name */ - str->length += pair->name.length; - if(pair->value.length) { - /* =value */ - str->length += 1 + pair->value.length; - } - } - if(arr->nelts) { - /* ; */ - str->length += arr->nelts - 1; - } - - /* Allocate required string */ - str->buf = apr_palloc(pool, str->length + 1); - - /* Copy pairs into allocated string */ - pos = str->buf; - for(i=0; inelts; i++) { - pair = (apt_pair_t*)arr->elts + i; - if(i != 0) { - *pos++ = ';'; - } - if(pair->name.length) { - memcpy(pos,pair->name.buf,pair->name.length); - pos += pair->name.length; - if(pair->value.length) { - *pos++ = '='; - memcpy(pos,pair->value.buf,pair->value.length); - pos += pair->value.length; - } - } - } - *pos = '\0'; - return TRUE; -} - -/** Parse boolean-value */ -APT_DECLARE(apt_bool_t) apt_boolean_value_parse(const apt_str_t *str, apt_bool_t *value) -{ - if(!str->buf) { - return FALSE; - } - if(strncasecmp(str->buf,TOKEN_TRUE,TOKEN_TRUE_LENGTH) == 0) { - *value = TRUE; - return TRUE; - } - if(strncasecmp(str->buf,TOKEN_FALSE,TOKEN_FALSE_LENGTH) == 0) { - *value = FALSE; - return TRUE; - } - return FALSE; -} - -/** Generate apr_size_t value from pool (buffer is allocated from pool) */ -APT_DECLARE(apt_bool_t) apt_boolean_value_generate(apt_bool_t value, apt_str_t *str, apr_pool_t *pool) -{ - if(value == TRUE) { - str->length = TOKEN_TRUE_LENGTH; - str->buf = apr_palloc(pool,str->length); - memcpy(str->buf,TOKEN_TRUE,str->length); - } - else { - str->length = TOKEN_FALSE_LENGTH; - str->buf = apr_palloc(pool,str->length); - memcpy(str->buf,TOKEN_FALSE,str->length); - } - return TRUE; -} - - -/** Parse size_t value */ -APT_DECLARE(apr_size_t) apt_size_value_parse(const apt_str_t *str) -{ - return str->buf ? atol(str->buf) : 0; -} - -/** Generate apr_size_t value (buffer is allocated from pool) */ -APT_DECLARE(apt_bool_t) apt_size_value_generate(apr_size_t value, apt_str_t *str, apr_pool_t *pool) -{ - str->buf = apr_psprintf(pool, "%"APR_SIZE_T_FMT, value); - str->length = strlen(str->buf); - return TRUE; -} - -/** Insert apr_size_t value */ -APT_DECLARE(apt_bool_t) apt_text_size_value_insert(apt_text_stream_t *stream, apr_size_t value) -{ - int length = apr_snprintf(stream->pos, stream->end - stream->pos, "%"APR_SIZE_T_FMT, value); - if(length <= 0) { - return FALSE; - } - stream->pos += length; - return TRUE; -} - - -/** Parse float value */ -APT_DECLARE(float) apt_float_value_parse(const apt_str_t *str) -{ - return str->buf ? (float)atof(str->buf) : 0; -} - -/** Generate float value (buffer is allocated from pool) */ -APT_DECLARE(apt_bool_t) apt_float_value_generate(float value, apt_str_t *str, apr_pool_t *pool) -{ - char *end; - str->buf = apr_psprintf(pool,"%f",value); - str->length = strlen(str->buf); - - /* remove trailing 0s (if any) */ - end = str->buf + str->length - 1; - while(*end == 0x30 && end != str->buf && *(end - 1) != '.') end--; - - str->length = end - str->buf + 1; - return TRUE; -} - -/** Generate float value */ -APT_DECLARE(apt_bool_t) apt_text_float_value_insert(apt_text_stream_t *stream, float value) -{ - char *end; - int length = apr_snprintf(stream->pos, stream->end - stream->pos, "%f", value); - if(length <= 0) { - return FALSE; - } - - /* remove trailing 0s (if any) */ - end = stream->pos + length - 1; - while(*end == 0x30 && end != stream->pos && *(end - 1) != '.') end--; - - stream->pos = end + 1; - return TRUE; -} - -/** Insert string value */ -APT_DECLARE(apt_bool_t) apt_text_string_insert(apt_text_stream_t *stream, const apt_str_t *str) -{ - if(stream->pos + str->length >= stream->end) { - return FALSE; - } - if(str->length) { - memcpy(stream->pos,str->buf,str->length); - stream->pos += str->length; - } - return TRUE; -} - -/** Generate value plus the length (number of digits) of the value itself. */ -APT_DECLARE(apt_bool_t) apt_var_length_value_generate(apr_size_t *value, apr_size_t max_count, apt_str_t *str) -{ - /* (N >= (10^M-M)) ? N+M+1 : N+M */ - apr_size_t temp; - apr_size_t count; /* M */ - apr_size_t bounds; /* 10^M */ - int length; - - /* calculate count */ - temp = *value; - count = 0; - do{count++; temp /= 10;} while(temp); - - /* calculate bounds */ - temp = count; - bounds = 1; - do{bounds *= 10; temp--;} while(temp); - - if(*value >= bounds - count) { - count++; - } - - *value += count; - if(count > max_count) { - return FALSE; - } - - str->length = 0; - length = sprintf(str->buf, "%"APR_SIZE_T_FMT, *value); - if(length <= 0) { - return FALSE; - } - str->length = length; - return TRUE; -} - -/** Generate completion-cause */ -APT_DECLARE(apt_bool_t) apt_completion_cause_generate(const apt_str_table_item_t table[], apr_size_t size, apr_size_t cause, apt_str_t *str, apr_pool_t *pool) -{ - const apt_str_t *name = apt_string_table_str_get(table,size,cause); - if(!name) { - return FALSE; - } - - /* 3 digits + 1 space + name->length */ - str->length = 4 + name->length; - str->buf = apr_palloc(pool,str->length + 1); - - if(sprintf(str->buf,"%03"APR_SIZE_T_FMT" ",cause) != 4) { - return FALSE; - } - - memcpy(str->buf+4,name->buf,name->length); - str->buf[str->length] = '\0'; - return TRUE; -} - - -/** Generate unique identifier (hex string) */ -APT_DECLARE(apt_bool_t) apt_unique_id_generate(apt_str_t *id, apr_size_t length, apr_pool_t *pool) -{ - char *hex_str; - apr_size_t i; - apr_size_t count; - apr_uuid_t uuid; - apr_uuid_get(&uuid); - - hex_str = apr_palloc(pool,length+1); - - count = length / 2; - if(count > sizeof(uuid)) { - count = sizeof(uuid); - } - for(i=0; ibuf = hex_str; - id->length = length; - return TRUE; -} diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_timer_queue.c b/libs/unimrcp/libs/apr-toolkit/src/apt_timer_queue.c deleted file mode 100644 index 05638260b9..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_timer_queue.c +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_timer_queue.c 2174 2014-09-12 03:33:16Z achaloyan@gmail.com $ - */ - -#ifdef WIN32 -#pragma warning(disable: 4127) -#endif -#include -#include "apt_timer_queue.h" -#include "apt_log.h" - -/** Timer queue */ -struct apt_timer_queue_t { - /** Ring head */ - APR_RING_HEAD(apt_timer_head_t, apt_timer_t) head; - - /** Elapsed time */ - apr_uint32_t elapsed_time; -}; - -/** Timer */ -struct apt_timer_t { - /** Ring entry */ - APR_RING_ENTRY(apt_timer_t) link; - - /** Back pointer to queue */ - apt_timer_queue_t *queue; - /** Time next report is scheduled at */ - apr_uint32_t scheduled_time; - - /** Timer proc */ - apt_timer_proc_f proc; - /** Timer object */ - void *obj; -}; - -static apt_bool_t apt_timer_insert(apt_timer_queue_t *timer_queue, apt_timer_t *timer); -static apt_bool_t apt_timer_remove(apt_timer_queue_t *timer_queue, apt_timer_t *timer); -static void apt_timers_reschedule(apt_timer_queue_t *timer_queue); - -/** Create timer queue */ -APT_DECLARE(apt_timer_queue_t*) apt_timer_queue_create(apr_pool_t *pool) -{ - apt_timer_queue_t *timer_queue = apr_palloc(pool,sizeof(apt_timer_queue_t)); - APR_RING_INIT(&timer_queue->head, apt_timer_t, link); - timer_queue->elapsed_time = 0; - return timer_queue; -} - -/** Destroy timer queue */ -APT_DECLARE(void) apt_timer_queue_destroy(apt_timer_queue_t *timer_queue) -{ - /* nothing to destroy */ -} - -/** Advance scheduled timers */ -APT_DECLARE(void) apt_timer_queue_advance(apt_timer_queue_t *timer_queue, apr_uint32_t elapsed_time) -{ - apt_timer_t *timer; - - if(APR_RING_EMPTY(&timer_queue->head, apt_timer_t, link)) { - /* just return, nothing to do */ - return; - } - - /* increment elapsed time */ - timer_queue->elapsed_time += elapsed_time; - if(timer_queue->elapsed_time >= 0xFFFF) { -#ifdef APT_TIMER_DEBUG - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Reschedule Timers [%u]",timer_queue->elapsed_time); -#endif - apt_timers_reschedule(timer_queue); - } - - /* process timers */ - do { - /* get first node (timer) */ - timer = APR_RING_FIRST(&timer_queue->head); - - if(timer->scheduled_time > timer_queue->elapsed_time) { - /* scheduled time is not elapsed yet */ - break; - } - -#ifdef APT_TIMER_DEBUG - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Timer Elapsed 0x%x [%u]",timer,timer->scheduled_time); -#endif - /* remove the elapsed timer from the list */ - APR_RING_REMOVE(timer, link); - timer->scheduled_time = 0; - /* process the elapsed timer */ - timer->proc(timer,timer->obj); - } - while(!APR_RING_EMPTY(&timer_queue->head, apt_timer_t, link)); -} - -/** Is timer queue empty */ -APT_DECLARE(apt_bool_t) apt_timer_queue_is_empty(const apt_timer_queue_t *timer_queue) -{ - return APR_RING_EMPTY(&timer_queue->head, apt_timer_t, link) ? TRUE : FALSE; -} - -/** Get current timeout */ -APT_DECLARE(apt_bool_t) apt_timer_queue_timeout_get(const apt_timer_queue_t *timer_queue, apr_uint32_t *timeout) -{ - apt_timer_t *timer; - /* is queue empty */ - if(APR_RING_EMPTY(&timer_queue->head, apt_timer_t, link)) { - return FALSE; - } - - /* get first node (timer) */ - timer = APR_RING_FIRST(&timer_queue->head); - if(!timer) { - return FALSE; - } - - *timeout = timer->scheduled_time - timer_queue->elapsed_time; - return TRUE; -} - -/** Create timer */ -APT_DECLARE(apt_timer_t*) apt_timer_create(apt_timer_queue_t *timer_queue, apt_timer_proc_f proc, void *obj, apr_pool_t *pool) -{ - apt_timer_t *timer = apr_palloc(pool,sizeof(apt_timer_t)); - APR_RING_ELEM_INIT(timer,link); - timer->queue = timer_queue; - timer->scheduled_time = 0; - timer->proc = proc; - timer->obj = obj; - return timer; -} - -/** Set one-shot timer */ -APT_DECLARE(apt_bool_t) apt_timer_set(apt_timer_t *timer, apr_uint32_t timeout) - -{ - apt_timer_queue_t *queue = timer->queue; - - if(timeout <= 0 || !timer->proc) { - return FALSE; - } - - if(timer->scheduled_time) { - /* remove timer first */ - apt_timer_remove(queue,timer); - } - - /* calculate time to elapse */ - timer->scheduled_time = queue->elapsed_time + timeout; -#ifdef APT_TIMER_DEBUG - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Set Timer 0x%x [%u]",timer,timer->scheduled_time); -#endif - if(APR_RING_EMPTY(&queue->head, apt_timer_t, link)) { - APR_RING_INSERT_TAIL(&queue->head,timer,apt_timer_t,link); - return TRUE; - } - - /* insert new node (timer) to sorted by scheduled time list */ - return apt_timer_insert(queue,timer); -} - -/** Kill timer */ -APT_DECLARE(apt_bool_t) apt_timer_kill(apt_timer_t *timer) -{ - if(!timer->scheduled_time) { - return FALSE; - } - -#ifdef APT_TIMER_DEBUG - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Kill Timer 0x%x [%u]",timer,timer->scheduled_time); -#endif - return apt_timer_remove(timer->queue,timer); -} - -static apt_bool_t apt_timer_insert(apt_timer_queue_t *timer_queue, apt_timer_t *timer) -{ - apt_timer_t *it; - for(it = APR_RING_LAST(&timer_queue->head); - it != APR_RING_SENTINEL(&timer_queue->head, apt_timer_t, link); - it = APR_RING_PREV(it, link)) { - - if(it->scheduled_time <= timer->scheduled_time) { - APR_RING_INSERT_AFTER(it,timer,link); - return TRUE; - } - } - APR_RING_INSERT_HEAD(&timer_queue->head,timer,apt_timer_t,link); - return TRUE; -} - -static apt_bool_t apt_timer_remove(apt_timer_queue_t *timer_queue, apt_timer_t *timer) -{ - /* remove node (timer) from the list */ - APR_RING_REMOVE(timer,link); - timer->scheduled_time = 0; - - if(APR_RING_EMPTY(&timer_queue->head, apt_timer_t, link)) { - /* reset elapsed time if no timers set */ - timer_queue->elapsed_time = 0; - } - return TRUE; -} - -static void apt_timers_reschedule(apt_timer_queue_t *timer_queue) -{ - apt_timer_t *it; - for(it = APR_RING_LAST(&timer_queue->head); - it != APR_RING_SENTINEL(&timer_queue->head, apt_timer_t, link); - it = APR_RING_PREV(it, link)) { - - it->scheduled_time -= timer_queue->elapsed_time; - } - timer_queue->elapsed_time = 0; -} diff --git a/libs/unimrcp/libs/mpf/Makefile.am b/libs/unimrcp/libs/mpf/Makefile.am deleted file mode 100644 index f877596a41..0000000000 --- a/libs/unimrcp/libs/mpf/Makefile.am +++ /dev/null @@ -1,82 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -AM_CPPFLAGS = -I$(top_srcdir)/libs/mpf/codecs \ - -I$(top_srcdir)/libs/mpf/include \ - -I$(top_srcdir)/libs/apr-toolkit/include \ - $(UNIMRCP_APR_INCLUDES) - -noinst_LTLIBRARIES = libmpf.la - -include_HEADERS = codecs/g711/g711.h \ - include/mpf.h \ - include/mpf_activity_detector.h \ - include/mpf_audio_file_descriptor.h \ - include/mpf_audio_file_stream.h \ - include/mpf_bridge.h \ - include/mpf_buffer.h \ - include/mpf_codec.h \ - include/mpf_codec_descriptor.h \ - include/mpf_codec_manager.h \ - include/mpf_context.h \ - include/mpf_dtmf_detector.h \ - include/mpf_dtmf_generator.h \ - include/mpf_engine.h \ - include/mpf_engine_factory.h \ - include/mpf_frame.h \ - include/mpf_frame_buffer.h \ - include/mpf_message.h \ - include/mpf_mixer.h \ - include/mpf_multiplier.h \ - include/mpf_named_event.h \ - include/mpf_object.h \ - include/mpf_stream.h \ - include/mpf_stream_descriptor.h \ - include/mpf_termination.h \ - include/mpf_termination_factory.h \ - include/mpf_rtp_termination_factory.h \ - include/mpf_file_termination_factory.h \ - include/mpf_scheduler.h \ - include/mpf_types.h \ - include/mpf_encoder.h \ - include/mpf_decoder.h \ - include/mpf_jitter_buffer.h \ - include/mpf_rtp_header.h \ - include/mpf_rtp_descriptor.h \ - include/mpf_rtp_stream.h \ - include/mpf_rtp_stat.h \ - include/mpf_rtp_defs.h \ - include/mpf_rtp_attribs.h \ - include/mpf_rtp_pt.h \ - include/mpf_rtcp_packet.h \ - include/mpf_resampler.h - -libmpf_la_SOURCES = codecs/g711/g711.c \ - src/mpf_activity_detector.c \ - src/mpf_audio_file_stream.c \ - src/mpf_bridge.c \ - src/mpf_buffer.c \ - src/mpf_codec_descriptor.c \ - src/mpf_codec_g711.c \ - src/mpf_codec_linear.c \ - src/mpf_codec_manager.c \ - src/mpf_context.c \ - src/mpf_dtmf_detector.c \ - src/mpf_dtmf_generator.c \ - src/mpf_engine.c \ - src/mpf_engine_factory.c \ - src/mpf_mixer.c \ - src/mpf_multiplier.c \ - src/mpf_named_event.c \ - src/mpf_termination.c \ - src/mpf_termination_factory.c \ - src/mpf_rtp_termination_factory.c \ - src/mpf_file_termination_factory.c \ - src/mpf_frame_buffer.c \ - src/mpf_scheduler.c \ - src/mpf_encoder.c \ - src/mpf_decoder.c \ - src/mpf_jitter_buffer.c \ - src/mpf_rtp_stream.c \ - src/mpf_rtp_attribs.c \ - src/mpf_resampler.c \ - src/mpf_stream.c diff --git a/libs/unimrcp/libs/mpf/codecs/g711/g711.c b/libs/unimrcp/libs/mpf/codecs/g711/g711.c deleted file mode 100644 index 1d2a079152..0000000000 --- a/libs/unimrcp/libs/mpf/codecs/g711/g711.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * SpanDSP - a series of DSP components for telephony - * - * g711.c - A-law and u-law transcoding routines - * - * Written by Steve Underwood - * - * Copyright (C) 2006 Steve Underwood - * - * Despite my general liking of the GPL, I place this code in the - * public domain for the benefit of all mankind - even the slimy - * ones who might try to proprietize my work and use it to my - * detriment. - * - */ - -#include "g711.h" - -/* Copied from the CCITT G.711 specification */ -static const apr_byte_t ulaw_to_alaw_table[256] = -{ - 42, 43, 40, 41, 46, 47, 44, 45, 34, 35, 32, 33, 38, 39, 36, 37, - 58, 59, 56, 57, 62, 63, 60, 61, 50, 51, 48, 49, 54, 55, 52, 53, - 10, 11, 8, 9, 14, 15, 12, 13, 2, 3, 0, 1, 6, 7, 4, 26, - 27, 24, 25, 30, 31, 28, 29, 18, 19, 16, 17, 22, 23, 20, 21, 106, - 104, 105, 110, 111, 108, 109, 98, 99, 96, 97, 102, 103, 100, 101, 122, 120, - 126, 127, 124, 125, 114, 115, 112, 113, 118, 119, 116, 117, 75, 73, 79, 77, - 66, 67, 64, 65, 70, 71, 68, 69, 90, 91, 88, 89, 94, 95, 92, 93, - 82, 82, 83, 83, 80, 80, 81, 81, 86, 86, 87, 87, 84, 84, 85, 85, - 170, 171, 168, 169, 174, 175, 172, 173, 162, 163, 160, 161, 166, 167, 164, 165, - 186, 187, 184, 185, 190, 191, 188, 189, 178, 179, 176, 177, 182, 183, 180, 181, - 138, 139, 136, 137, 142, 143, 140, 141, 130, 131, 128, 129, 134, 135, 132, 154, - 155, 152, 153, 158, 159, 156, 157, 146, 147, 144, 145, 150, 151, 148, 149, 234, - 232, 233, 238, 239, 236, 237, 226, 227, 224, 225, 230, 231, 228, 229, 250, 248, - 254, 255, 252, 253, 242, 243, 240, 241, 246, 247, 244, 245, 203, 201, 207, 205, - 194, 195, 192, 193, 198, 199, 196, 197, 218, 219, 216, 217, 222, 223, 220, 221, - 210, 210, 211, 211, 208, 208, 209, 209, 214, 214, 215, 215, 212, 212, 213, 213 -}; - -/* These transcoding tables are copied from the CCITT G.711 specification. To achieve - optimal results, do not change them. */ -static const apr_byte_t alaw_to_ulaw_table[256] = -{ - 42, 43, 40, 41, 46, 47, 44, 45, 34, 35, 32, 33, 38, 39, 36, 37, - 57, 58, 55, 56, 61, 62, 59, 60, 49, 50, 47, 48, 53, 54, 51, 52, - 10, 11, 8, 9, 14, 15, 12, 13, 2, 3, 0, 1, 6, 7, 4, 5, - 26, 27, 24, 25, 30, 31, 28, 29, 18, 19, 16, 17, 22, 23, 20, 21, - 98, 99, 96, 97, 102, 103, 100, 101, 93, 93, 92, 92, 95, 95, 94, 94, - 116, 118, 112, 114, 124, 126, 120, 122, 106, 107, 104, 105, 110, 111, 108, 109, - 72, 73, 70, 71, 76, 77, 74, 75, 64, 65, 63, 63, 68, 69, 66, 67, - 86, 87, 84, 85, 90, 91, 88, 89, 79, 79, 78, 78, 82, 83, 80, 81, - 170, 171, 168, 169, 174, 175, 172, 173, 162, 163, 160, 161, 166, 167, 164, 165, - 185, 186, 183, 184, 189, 190, 187, 188, 177, 178, 175, 176, 181, 182, 179, 180, - 138, 139, 136, 137, 142, 143, 140, 141, 130, 131, 128, 129, 134, 135, 132, 133, - 154, 155, 152, 153, 158, 159, 156, 157, 146, 147, 144, 145, 150, 151, 148, 149, - 226, 227, 224, 225, 230, 231, 228, 229, 221, 221, 220, 220, 223, 223, 222, 222, - 244, 246, 240, 242, 252, 254, 248, 250, 234, 235, 232, 233, 238, 239, 236, 237, - 200, 201, 198, 199, 204, 205, 202, 203, 192, 193, 191, 191, 196, 197, 194, 195, - 214, 215, 212, 213, 218, 219, 216, 217, 207, 207, 206, 206, 210, 211, 208, 209 -}; - -apr_byte_t alaw_to_ulaw(apr_byte_t alaw) -{ - return alaw_to_ulaw_table[alaw]; -} -/*- End of function --------------------------------------------------------*/ - -apr_byte_t ulaw_to_alaw(apr_byte_t ulaw) -{ - return ulaw_to_alaw_table[ulaw]; -} -/*- End of function --------------------------------------------------------*/ -/*- End of file ------------------------------------------------------------*/ diff --git a/libs/unimrcp/libs/mpf/codecs/g711/g711.h b/libs/unimrcp/libs/mpf/codecs/g711/g711.h deleted file mode 100644 index 3814dd79dc..0000000000 --- a/libs/unimrcp/libs/mpf/codecs/g711/g711.h +++ /dev/null @@ -1,374 +0,0 @@ -/* - * SpanDSP - a series of DSP components for telephony - * - * g711.h - In line A-law and u-law conversion routines - * - * Written by Steve Underwood - * - * Copyright (C) 2001 Steve Underwood - * - * Despite my general liking of the GPL, I place this code in the - * public domain for the benefit of all mankind - even the slimy - * ones who might try to proprietize my work and use it to my - * detriment. - * - */ - -/* g711_page A-law and mu-law handling -Lookup tables for A-law and u-law look attractive, until you consider the impact -on the CPU cache. If it causes a substantial area of your processor cache to get -hit too often, cache sloshing will severely slow things down. The main reason -these routines are slow in C, is the lack of direct access to the CPU's "find -the first 1" instruction. A little in-line assembler fixes that, and the -conversion routines can be faster than lookup tables, in most real world usage. -A "find the first 1" instruction is available on most modern CPUs, and is a -much underused feature. - -If an assembly language method of bit searching is not available, these routines -revert to a method that can be a little slow, so the cache thrashing might not -seem so bad :( - -Feel free to submit patches to add fast "find the first 1" support for your own -favourite processor. - -Look up tables are used for transcoding between A-law and u-law, since it is -difficult to achieve the precise transcoding procedure laid down in the G.711 -specification by other means. -*/ - -#ifndef MPF_G711_H -#define MPF_G711_H - -/** - * @file g711.h - * @brief A-law and u-law conversion routines - */ - -#include "mpf.h" - -APT_BEGIN_EXTERN_C - -#if defined(__i386__) -/*! \brief Find the bit position of the highest set bit in a word - \param bits The word to be searched - \return The bit number of the highest set bit, or -1 if the word is zero. */ -static APR_INLINE int top_bit(unsigned int bits) -{ - int res; - - __asm__ __volatile__(" movl $-1,%%edx;\n" - " bsrl %%eax,%%edx;\n" - : "=d" (res) - : "a" (bits)); - return res; -} -/*- End of function --------------------------------------------------------*/ - -/*! \brief Find the bit position of the lowest set bit in a word - \param bits The word to be searched - \return The bit number of the lowest set bit, or -1 if the word is zero. */ -static APR_INLINE int bottom_bit(unsigned int bits) -{ - int res; - - __asm__ __volatile__(" movl $-1,%%edx;\n" - " bsfl %%eax,%%edx;\n" - : "=d" (res) - : "a" (bits)); - return res; -} -/*- End of function --------------------------------------------------------*/ -#elif defined(__x86_64__) -static APR_INLINE int top_bit(unsigned int bits) -{ - int res; - - __asm__ __volatile__(" movq $-1,%%rdx;\n" - " bsrq %%rax,%%rdx;\n" - : "=d" (res) - : "a" (bits)); - return res; -} -/*- End of function --------------------------------------------------------*/ - -static APR_INLINE int bottom_bit(unsigned int bits) -{ - int res; - - __asm__ __volatile__(" movq $-1,%%rdx;\n" - " bsfq %%rax,%%rdx;\n" - : "=d" (res) - : "a" (bits)); - return res; -} -/*- End of function --------------------------------------------------------*/ -#else -static APR_INLINE int top_bit(unsigned int bits) -{ - int i; - - if (bits == 0) - return -1; - i = 0; - if (bits & 0xFFFF0000) - { - bits &= 0xFFFF0000; - i += 16; - } - if (bits & 0xFF00FF00) - { - bits &= 0xFF00FF00; - i += 8; - } - if (bits & 0xF0F0F0F0) - { - bits &= 0xF0F0F0F0; - i += 4; - } - if (bits & 0xCCCCCCCC) - { - bits &= 0xCCCCCCCC; - i += 2; - } - if (bits & 0xAAAAAAAA) - { - bits &= 0xAAAAAAAA; - i += 1; - } - return i; -} -/*- End of function --------------------------------------------------------*/ - -static APR_INLINE int bottom_bit(unsigned int bits) -{ - int i; - - if (bits == 0) - return -1; - i = 32; - if (bits & 0x0000FFFF) - { - bits &= 0x0000FFFF; - i -= 16; - } - if (bits & 0x00FF00FF) - { - bits &= 0x00FF00FF; - i -= 8; - } - if (bits & 0x0F0F0F0F) - { - bits &= 0x0F0F0F0F; - i -= 4; - } - if (bits & 0x33333333) - { - bits &= 0x33333333; - i -= 2; - } - if (bits & 0x55555555) - { - bits &= 0x55555555; - i -= 1; - } - return i; -} -/*- End of function --------------------------------------------------------*/ -#endif - -/* N.B. It is tempting to use look-up tables for A-law and u-law conversion. - * However, you should consider the cache footprint. - * - * A 64K byte table for linear to x-law and a 512 byte table for x-law to - * linear sound like peanuts these days, and shouldn't an array lookup be - * real fast? No! When the cache sloshes as badly as this one will, a tight - * calculation may be better. The messiest part is normally finding the - * segment, but a little inline assembly can fix that on an i386, x86_64 and - * many other modern processors. - */ - -/* - * Mu-law is basically as follows: - * - * Biased Linear Input Code Compressed Code - * ------------------------ --------------- - * 00000001wxyza 000wxyz - * 0000001wxyzab 001wxyz - * 000001wxyzabc 010wxyz - * 00001wxyzabcd 011wxyz - * 0001wxyzabcde 100wxyz - * 001wxyzabcdef 101wxyz - * 01wxyzabcdefg 110wxyz - * 1wxyzabcdefgh 111wxyz - * - * Each biased linear code has a leading 1 which identifies the segment - * number. The value of the segment number is equal to 7 minus the number - * of leading 0's. The quantization interval is directly available as the - * four bits wxyz. * The trailing bits (a - h) are ignored. - * - * Ordinarily the complement of the resulting code word is used for - * transmission, and so the code word is complemented before it is returned. - * - * For further information see John C. Bellamy's Digital Telephony, 1982, - * John Wiley & Sons, pps 98-111 and 472-476. - */ - -//#define ULAW_ZEROTRAP /* turn on the trap as per the MIL-STD */ -#define ULAW_BIAS 0x84 /* Bias for linear code. */ - -/*! \brief Encode a linear sample to u-law - \param linear The sample to encode. - \return The u-law value. -*/ -static APR_INLINE apr_byte_t linear_to_ulaw(int linear) -{ - apr_byte_t u_val; - int mask; - int seg; - - /* Get the sign and the magnitude of the value. */ - if (linear < 0) - { - linear = ULAW_BIAS - linear - 1; - mask = 0x7F; - } - else - { - linear = ULAW_BIAS + linear; - mask = 0xFF; - } - - seg = top_bit(linear | 0xFF) - 7; - - /* - * Combine the sign, segment, quantization bits, - * and complement the code word. - */ - if (seg >= 8) - u_val = (apr_byte_t) (0x7F ^ mask); - else - u_val = (apr_byte_t) (((seg << 4) | ((linear >> (seg + 3)) & 0xF)) ^ mask); -#ifdef ULAW_ZEROTRAP - /* Optional ITU trap */ - if (u_val == 0) - u_val = 0x02; -#endif - return u_val; -} -/*- End of function --------------------------------------------------------*/ - -/*! \brief Decode an u-law sample to a linear value. - \param ulaw The u-law sample to decode. - \return The linear value. -*/ -static APR_INLINE apr_int16_t ulaw_to_linear(apr_byte_t ulaw) -{ - int t; - - /* Complement to obtain normal u-law value. */ - ulaw = ~ulaw; - /* - * Extract and bias the quantization bits. Then - * shift up by the segment number and subtract out the bias. - */ - t = (((ulaw & 0x0F) << 3) + ULAW_BIAS) << (((int) ulaw & 0x70) >> 4); - return (apr_int16_t) ((ulaw & 0x80) ? (ULAW_BIAS - t) : (t - ULAW_BIAS)); -} -/*- End of function --------------------------------------------------------*/ - -/* - * A-law is basically as follows: - * - * Linear Input Code Compressed Code - * ----------------- --------------- - * 0000000wxyza 000wxyz - * 0000001wxyza 001wxyz - * 000001wxyzab 010wxyz - * 00001wxyzabc 011wxyz - * 0001wxyzabcd 100wxyz - * 001wxyzabcde 101wxyz - * 01wxyzabcdef 110wxyz - * 1wxyzabcdefg 111wxyz - * - * For further information see John C. Bellamy's Digital Telephony, 1982, - * John Wiley & Sons, pps 98-111 and 472-476. - */ - -#define ALAW_AMI_MASK 0x55 - -/*! \brief Encode a linear sample to A-law - \param linear The sample to encode. - \return The A-law value. -*/ -static APR_INLINE apr_byte_t linear_to_alaw(int linear) -{ - int mask; - int seg; - - if (linear >= 0) - { - /* Sign (bit 7) bit = 1 */ - mask = ALAW_AMI_MASK | 0x80; - } - else - { - /* Sign (bit 7) bit = 0 */ - mask = ALAW_AMI_MASK; - linear = -linear - 1; - } - - /* Convert the scaled magnitude to segment number. */ - seg = top_bit(linear | 0xFF) - 7; - if (seg >= 8) - { - if (linear >= 0) - { - /* Out of range. Return maximum value. */ - return (apr_byte_t) (0x7F ^ mask); - } -#if 0 /* This code is no longer reachable, since linear must be at least 0. */ - /* We must be just a tiny step below zero */ - return (apr_byte_t) (0x00 ^ mask); -#endif - } - /* Combine the sign, segment, and quantization bits. */ - return (apr_byte_t) (((seg << 4) | ((linear >> ((seg) ? (seg + 3) : 4)) & 0x0F)) ^ mask); -} -/*- End of function --------------------------------------------------------*/ - -/*! \brief Decode an A-law sample to a linear value. - \param alaw The A-law sample to decode. - \return The linear value. -*/ -static APR_INLINE apr_int16_t alaw_to_linear(apr_byte_t alaw) -{ - int i; - int seg; - - alaw ^= ALAW_AMI_MASK; - i = ((alaw & 0x0F) << 4); - seg = (((int) alaw & 0x70) >> 4); - if (seg) - i = (i + 0x108) << (seg - 1); - else - i += 8; - return (apr_int16_t) ((alaw & 0x80) ? i : -i); -} -/*- End of function --------------------------------------------------------*/ - -/*! \brief Transcode from A-law to u-law, using the procedure defined in G.711. - \param alaw The A-law sample to transcode. - \return The best matching u-law value. -*/ -apr_byte_t alaw_to_ulaw(apr_byte_t alaw); - -/*! \brief Transcode from u-law to A-law, using the procedure defined in G.711. - \param alaw The u-law sample to transcode. - \return The best matching A-law value. -*/ -apr_byte_t ulaw_to_alaw(apr_byte_t ulaw); - -APT_END_EXTERN_C - -#endif /* MPF_G711_H */ -/*- End of file ------------------------------------------------------------*/ diff --git a/libs/unimrcp/libs/mpf/include/mpf.h b/libs/unimrcp/libs/mpf/include/mpf.h deleted file mode 100644 index a435893595..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_H -#define MPF_H - -/** - * @file mpf.h - * @brief Media Processing Framework Definitions - */ - -#include - -/** lib export/import defines (win32) */ -#ifdef WIN32 -#ifdef MPF_STATIC_LIB -#define MPF_DECLARE(type) type __stdcall -#else -#ifdef MPF_LIB_EXPORT -#define MPF_DECLARE(type) __declspec(dllexport) type __stdcall -#else -#define MPF_DECLARE(type) __declspec(dllimport) type __stdcall -#endif -#endif -#else -#define MPF_DECLARE(type) type -#endif - -#endif /* MPF_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_activity_detector.h b/libs/unimrcp/libs/mpf/include/mpf_activity_detector.h deleted file mode 100644 index fe2f15cec0..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_activity_detector.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_activity_detector.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_ACTIVITY_DETECTOR_H -#define MPF_ACTIVITY_DETECTOR_H - -/** - * @file mpf_activity_detector.h - * @brief MPF Voice Activity Detector - */ - -#include "mpf_frame.h" -#include "mpf_codec_descriptor.h" - -APT_BEGIN_EXTERN_C - -/** Opaque (voice) activity detector */ -typedef struct mpf_activity_detector_t mpf_activity_detector_t; - -/** Events of activity detector */ -typedef enum { - MPF_DETECTOR_EVENT_NONE, /**< no event occurred */ - MPF_DETECTOR_EVENT_ACTIVITY, /**< voice activity (transition to activity from inactivity state) */ - MPF_DETECTOR_EVENT_INACTIVITY, /**< voice inactivity (transition to inactivity from activity state) */ - MPF_DETECTOR_EVENT_NOINPUT /**< noinput event occurred */ -} mpf_detector_event_e; - - -/** Create activity detector */ -MPF_DECLARE(mpf_activity_detector_t*) mpf_activity_detector_create(apr_pool_t *pool); - -/** Reset activity detector */ -MPF_DECLARE(void) mpf_activity_detector_reset(mpf_activity_detector_t *detector); - -/** Set threshold of voice activity (silence) level */ -MPF_DECLARE(void) mpf_activity_detector_level_set(mpf_activity_detector_t *detector, apr_size_t level_threshold); - -/** Set noinput timeout */ -MPF_DECLARE(void) mpf_activity_detector_noinput_timeout_set(mpf_activity_detector_t *detector, apr_size_t noinput_timeout); - -/** Set timeout required to trigger speech (transition from inactive to active state) */ -MPF_DECLARE(void) mpf_activity_detector_speech_timeout_set(mpf_activity_detector_t *detector, apr_size_t speech_timeout); - -/** Set timeout required to trigger silence (transition from active to inactive state) */ -MPF_DECLARE(void) mpf_activity_detector_silence_timeout_set(mpf_activity_detector_t *detector, apr_size_t silence_timeout); - -/** Process current frame, return detected event if any */ -MPF_DECLARE(mpf_detector_event_e) mpf_activity_detector_process(mpf_activity_detector_t *detector, const mpf_frame_t *frame); - - -APT_END_EXTERN_C - -#endif /* MPF_ACTIVITY_DETECTOR_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_audio_file_descriptor.h b/libs/unimrcp/libs/mpf/include/mpf_audio_file_descriptor.h deleted file mode 100644 index d7673004ea..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_audio_file_descriptor.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_audio_file_descriptor.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_AUDIO_FILE_DESCRIPTOR_H -#define MPF_AUDIO_FILE_DESCRIPTOR_H - -/** - * @file mpf_audio_file_descriptor.h - * @brief MPF Audio File Descriptor - */ - -#include -#include "mpf_stream_descriptor.h" - -APT_BEGIN_EXTERN_C - -/** FILE_READER defined as a stream source */ -#define FILE_READER STREAM_DIRECTION_RECEIVE -/** FILE_WRITER defined as a stream sink */ -#define FILE_WRITER STREAM_DIRECTION_SEND - -/** Audio file descriptor declaration */ -typedef struct mpf_audio_file_descriptor_t mpf_audio_file_descriptor_t; - -/** Audio file descriptor */ -struct mpf_audio_file_descriptor_t { - /** Indicate descriptor type (reader and/or writer) */ - mpf_stream_direction_e mask; - /** Codec descriptor to use for audio file read/write */ - mpf_codec_descriptor_t *codec_descriptor; - /** File handle to read audio stream */ - FILE *read_handle; - /** File handle to write audio stream */ - FILE *write_handle; - /** Max size of file */ - apr_size_t max_write_size; -}; - -APT_END_EXTERN_C - -#endif /* MPF_AUDIO_FILE_DESCRIPTOR_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_audio_file_stream.h b/libs/unimrcp/libs/mpf/include/mpf_audio_file_stream.h deleted file mode 100644 index 92da4bead0..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_audio_file_stream.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_audio_file_stream.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_AUDIO_FILE_STREAM_H -#define MPF_AUDIO_FILE_STREAM_H - -/** - * @file mpf_audio_file_stream.h - * @brief MPF Audio FIle Stream - */ - -#include "mpf_stream.h" -#include "mpf_audio_file_descriptor.h" - -APT_BEGIN_EXTERN_C - -/** - * Create file stream. - * @param termination the back pointer to hold - * @param pool the pool to allocate memory from - */ -MPF_DECLARE(mpf_audio_stream_t*) mpf_file_stream_create(mpf_termination_t *termination, apr_pool_t *pool); - -/** - * Modify file stream. - * @param stream file stream to modify - * @param descriptor the descriptor to modify stream according - */ -MPF_DECLARE(apt_bool_t) mpf_file_stream_modify(mpf_audio_stream_t *stream, mpf_audio_file_descriptor_t *descriptor); - -APT_END_EXTERN_C - -#endif /* MPF_AUDIO_FILE_STREAM_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_bridge.h b/libs/unimrcp/libs/mpf/include/mpf_bridge.h deleted file mode 100644 index 2cde68194d..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_bridge.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_bridge.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_BRIDGE_H -#define MPF_BRIDGE_H - -/** - * @file mpf_bridge.h - * @brief MPF Stream Bridge - */ - -#include "mpf_object.h" - -APT_BEGIN_EXTERN_C - -/** - * Create bridge of audio streams. - * @param source the source audio stream - * @param sink the sink audio stream - * @param codec_manager the codec manager - * @param name the informative name used for debugging - * @param pool the pool to allocate memory from - */ -MPF_DECLARE(mpf_object_t*) mpf_bridge_create( - mpf_audio_stream_t *source, - mpf_audio_stream_t *sink, - const mpf_codec_manager_t *codec_manager, - const char *name, - apr_pool_t *pool); - - -APT_END_EXTERN_C - -#endif /* MPF_BRIDGE_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_buffer.h b/libs/unimrcp/libs/mpf/include/mpf_buffer.h deleted file mode 100644 index bb82f24ade..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_buffer.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_buffer.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_BUFFER_H -#define MPF_BUFFER_H - -/** - * @file mpf_buffer.h - * @brief Buffer of Media Chunks - */ - -#include "mpf_frame.h" - -APT_BEGIN_EXTERN_C - -/** Opaque media buffer declaration */ -typedef struct mpf_buffer_t mpf_buffer_t; - - -/** Create buffer */ -mpf_buffer_t* mpf_buffer_create(apr_pool_t *pool); - -/** Destroy buffer */ -void mpf_buffer_destroy(mpf_buffer_t *buffer); - -/** Restart buffer */ -apt_bool_t mpf_buffer_restart(mpf_buffer_t *buffer); - -/** Write audio chunk to buffer */ -apt_bool_t mpf_buffer_audio_write(mpf_buffer_t *buffer, void *data, apr_size_t size); - -/** Write event to buffer */ -apt_bool_t mpf_buffer_event_write(mpf_buffer_t *buffer, mpf_frame_type_e event_type); - -/** Read media frame from buffer */ -apt_bool_t mpf_buffer_frame_read(mpf_buffer_t *buffer, mpf_frame_t *media_frame); - -/** Get size of buffer **/ -apr_size_t mpf_buffer_get_size(const mpf_buffer_t *buffer); - -APT_END_EXTERN_C - -#endif /* MPF_BUFFER_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_codec.h b/libs/unimrcp/libs/mpf/include/mpf_codec.h deleted file mode 100644 index b34a53aaa0..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_codec.h +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_codec.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_CODEC_H -#define MPF_CODEC_H - -/** - * @file mpf_codec.h - * @brief MPF Codec - */ - -#include "mpf_codec_descriptor.h" - -APT_BEGIN_EXTERN_C - -/** Codec virtual table declaration */ -typedef struct mpf_codec_vtable_t mpf_codec_vtable_t; -/** Codec declaration*/ -typedef struct mpf_codec_t mpf_codec_t; - -/** Codec */ -struct mpf_codec_t { - /** Codec manipulators (encode, decode, dissect) */ - const mpf_codec_vtable_t *vtable; - /** Codec attributes (capabilities) */ - const mpf_codec_attribs_t *attribs; - /** Optional static codec descriptor (pt < 96) */ - const mpf_codec_descriptor_t *static_descriptor; -}; - -/** Table of codec virtual methods */ -struct mpf_codec_vtable_t { - /** Virtual open method */ - apt_bool_t (*open)(mpf_codec_t *codec); - /** Virtual close method */ - apt_bool_t (*close)(mpf_codec_t *codec); - - /** Virtual encode method */ - apt_bool_t (*encode)(mpf_codec_t *codec, const mpf_codec_frame_t *frame_in, mpf_codec_frame_t *frame_out); - /** Virtual decode method */ - apt_bool_t (*decode)(mpf_codec_t *codec, const mpf_codec_frame_t *frame_in, mpf_codec_frame_t *frame_out); - - /** Virtual dissect method */ - apt_bool_t (*dissect)(mpf_codec_t *codec, void **buffer, apr_size_t *size, mpf_codec_frame_t *frame); - - /** Virtual initialize method */ - apt_bool_t (*initialize)(mpf_codec_t *codec, mpf_codec_frame_t *frame_out); -}; - -/** - * Create codec. - * @param vtable the table of virtual mthods - * @param attribs the codec attributes - * @param descriptor the codec descriptor - * @param pool the pool to allocate memory from - */ -static APR_INLINE mpf_codec_t* mpf_codec_create( - const mpf_codec_vtable_t *vtable, - const mpf_codec_attribs_t *attribs, - const mpf_codec_descriptor_t *descriptor, - apr_pool_t *pool) -{ - mpf_codec_t *codec = (mpf_codec_t*)apr_palloc(pool,sizeof(mpf_codec_t)); - codec->vtable = vtable; - codec->attribs = attribs; - codec->static_descriptor = descriptor; - return codec; -} - -/** - * Clone codec. - * @param src_codec the source (original) codec to clone - * @param pool the pool to allocate memory from - */ -static APR_INLINE mpf_codec_t* mpf_codec_clone(mpf_codec_t *src_codec, apr_pool_t *pool) -{ - mpf_codec_t *codec = (mpf_codec_t*)apr_palloc(pool,sizeof(mpf_codec_t)); - codec->vtable = src_codec->vtable; - codec->attribs = src_codec->attribs; - codec->static_descriptor = src_codec->static_descriptor; - return codec; -} - -/** Open codec */ -static APR_INLINE apt_bool_t mpf_codec_open(mpf_codec_t *codec) -{ - apt_bool_t rv = TRUE; - if(codec->vtable->open) { - rv = codec->vtable->open(codec); - } - return rv; -} - -/** Close codec */ -static APR_INLINE apt_bool_t mpf_codec_close(mpf_codec_t *codec) -{ - apt_bool_t rv = TRUE; - if(codec->vtable->close) { - rv = codec->vtable->close(codec); - } - return rv; -} - -/** Encode codec frame */ -static APR_INLINE apt_bool_t mpf_codec_encode(mpf_codec_t *codec, const mpf_codec_frame_t *frame_in, mpf_codec_frame_t *frame_out) -{ - apt_bool_t rv = TRUE; - if(codec->vtable->encode) { - rv = codec->vtable->encode(codec,frame_in,frame_out); - } - return rv; -} - -/** Decode codec frame */ -static APR_INLINE apt_bool_t mpf_codec_decode(mpf_codec_t *codec, const mpf_codec_frame_t *frame_in, mpf_codec_frame_t *frame_out) -{ - apt_bool_t rv = TRUE; - if(codec->vtable->decode) { - rv = codec->vtable->decode(codec,frame_in,frame_out); - } - return rv; -} - -/** Dissect codec frame (navigate through codec frames in a buffer, which may contain multiple frames) */ -static APR_INLINE apt_bool_t mpf_codec_dissect(mpf_codec_t *codec, void **buffer, apr_size_t *size, mpf_codec_frame_t *frame) -{ - apt_bool_t rv = TRUE; - if(codec->vtable->dissect) { - /* custom dissector for codecs like G.729, G.723 */ - rv = codec->vtable->dissect(codec,buffer,size,frame); - } - else { - /* default dissector */ - if(*size >= frame->size && frame->size) { - memcpy(frame->buffer,*buffer,frame->size); - - *buffer = (apr_byte_t*)*buffer + frame->size; - *size = *size - frame->size; - } - else { - rv = FALSE; - } - } - return rv; -} - -/** Initialize (fill) codec frame with silence */ -static APR_INLINE apt_bool_t mpf_codec_initialize(mpf_codec_t *codec, mpf_codec_frame_t *frame_out) -{ - apt_bool_t rv = TRUE; - if(codec->vtable->initialize) { - rv = codec->vtable->initialize(codec,frame_out); - } - else { - memset(frame_out->buffer,0,frame_out->size); - } - return rv; -} - -APT_END_EXTERN_C - -#endif /* MPF_CODEC_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_codec_descriptor.h b/libs/unimrcp/libs/mpf/include/mpf_codec_descriptor.h deleted file mode 100644 index f4ed54e322..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_codec_descriptor.h +++ /dev/null @@ -1,283 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_codec_descriptor.h 2239 2014-11-12 01:52:59Z achaloyan@gmail.com $ - */ - -#ifndef MPF_CODEC_DESCRIPTOR_H -#define MPF_CODEC_DESCRIPTOR_H - -/** - * @file mpf_codec_descriptor.h - * @brief MPF Codec Descriptor - */ - -#include -#include "apt_string.h" -#include "mpf.h" - -APT_BEGIN_EXTERN_C - -/** Codec frame time base in msec */ -#define CODEC_FRAME_TIME_BASE 10 -/** Bytes per sample for linear pcm */ -#define BYTES_PER_SAMPLE 2 -/** Bits per sample for linear pcm */ -#define BITS_PER_SAMPLE 16 - -/** Supported sampling rates */ -typedef enum { - MPF_SAMPLE_RATE_NONE = 0x00, - MPF_SAMPLE_RATE_8000 = 0x01, - MPF_SAMPLE_RATE_16000 = 0x02, - MPF_SAMPLE_RATE_32000 = 0x04, - MPF_SAMPLE_RATE_48000 = 0x08, - - MPF_SAMPLE_RATE_SUPPORTED = MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000 | - MPF_SAMPLE_RATE_32000 | MPF_SAMPLE_RATE_48000 -} mpf_sample_rates_e; - -/** Codec descriptor declaration */ -typedef struct mpf_codec_descriptor_t mpf_codec_descriptor_t; -/** Codec attributes declaration */ -typedef struct mpf_codec_attribs_t mpf_codec_attribs_t; -/** Codec list declaration */ -typedef struct mpf_codec_list_t mpf_codec_list_t; -/** Codec capabilities declaration */ -typedef struct mpf_codec_capabilities_t mpf_codec_capabilities_t; -/** Codec frame declaration */ -typedef struct mpf_codec_frame_t mpf_codec_frame_t; - - -/** Codec descriptor */ -struct mpf_codec_descriptor_t { - /** Payload type used in RTP packet */ - apr_byte_t payload_type; - /** Codec name */ - apt_str_t name; - /** Sampling rate */ - apr_uint16_t sampling_rate; - /** Channel count */ - apr_byte_t channel_count; - /** Codec dependent additional format */ - apt_str_t format; - /** Enabled/disabled state */ - apt_bool_t enabled; -}; - -/** List of codec descriptors */ -struct mpf_codec_list_t { - /** Dynamic array of codec descriptors (mpf_codec_descriptor_t) */ - apr_array_header_t *descriptor_arr; - /** Preffered primary (audio/video codec) descriptor from descriptor_arr */ - mpf_codec_descriptor_t *primary_descriptor; - /** Preffered named event (telephone-event) descriptor from descriptor_arr */ - mpf_codec_descriptor_t *event_descriptor; -}; - -/** Codec attributes */ -struct mpf_codec_attribs_t { - /** Codec name */ - apt_str_t name; - /** Bits per sample */ - apr_byte_t bits_per_sample; - /** Supported sampling rates (mpf_sample_rates_e) */ - int sample_rates; -}; - -/** List of codec attributes (capabilities) */ -struct mpf_codec_capabilities_t { - /** Dynamic array of codec attributes (mpf_codec_attrribs_t) */ - apr_array_header_t *attrib_arr; - /** Allow/support named events */ - apt_bool_t allow_named_events; -}; - -/** Codec frame */ -struct mpf_codec_frame_t { - /** Raw buffer, which may contain encoded or decoded data */ - void *buffer; - /** Buffer size */ - apr_size_t size; -}; - - -/** Initialize codec descriptor */ -static APR_INLINE void mpf_codec_descriptor_init(mpf_codec_descriptor_t *descriptor) -{ - descriptor->payload_type = 0; - apt_string_reset(&descriptor->name); - descriptor->sampling_rate = 0; - descriptor->channel_count = 0; - apt_string_reset(&descriptor->format); - descriptor->enabled = TRUE; -} - -/** Initialize codec descriptor */ -static APR_INLINE mpf_codec_descriptor_t* mpf_codec_descriptor_create(apr_pool_t *pool) -{ - mpf_codec_descriptor_t *descriptor = (mpf_codec_descriptor_t*) apr_palloc(pool,sizeof(mpf_codec_descriptor_t)); - mpf_codec_descriptor_init(descriptor); - return descriptor; -} - -/** Calculate encoded frame size in bytes */ -static APR_INLINE apr_size_t mpf_codec_frame_size_calculate(const mpf_codec_descriptor_t *descriptor, const mpf_codec_attribs_t *attribs) -{ - return (size_t) descriptor->channel_count * attribs->bits_per_sample * CODEC_FRAME_TIME_BASE * - descriptor->sampling_rate / 1000 / 8; /* 1000 - msec per sec, 8 - bits per byte */ -} - -/** Calculate samples of the frame (ts) */ -static APR_INLINE apr_size_t mpf_codec_frame_samples_calculate(const mpf_codec_descriptor_t *descriptor) -{ - return (size_t) descriptor->channel_count * CODEC_FRAME_TIME_BASE * descriptor->sampling_rate / 1000; -} - -/** Calculate linear frame size in bytes */ -static APR_INLINE apr_size_t mpf_codec_linear_frame_size_calculate(apr_uint16_t sampling_rate, apr_byte_t channel_count) -{ - return (size_t) channel_count * BYTES_PER_SAMPLE * CODEC_FRAME_TIME_BASE * sampling_rate / 1000; -} - - - -/** Reset list of codec descriptors */ -static APR_INLINE void mpf_codec_list_reset(mpf_codec_list_t *codec_list) -{ - codec_list->descriptor_arr = NULL; - codec_list->primary_descriptor = NULL; - codec_list->event_descriptor = NULL; -} - -/** Initialize list of codec descriptors */ -static APR_INLINE void mpf_codec_list_init(mpf_codec_list_t *codec_list, apr_size_t initial_count, apr_pool_t *pool) -{ - codec_list->descriptor_arr = apr_array_make(pool,(int)initial_count, sizeof(mpf_codec_descriptor_t)); - codec_list->primary_descriptor = NULL; - codec_list->event_descriptor = NULL; -} - -/** Copy list of codec descriptors */ -static APR_INLINE void mpf_codec_list_copy(mpf_codec_list_t *codec_list, const mpf_codec_list_t *src_codec_list, apr_pool_t *pool) -{ - codec_list->descriptor_arr = apr_array_copy(pool,src_codec_list->descriptor_arr); -} - -/** Increment number of codec descriptors in the list and return the descriptor to fill */ -static APR_INLINE mpf_codec_descriptor_t* mpf_codec_list_add(mpf_codec_list_t *codec_list) -{ - mpf_codec_descriptor_t *descriptor = (mpf_codec_descriptor_t*)apr_array_push(codec_list->descriptor_arr); - mpf_codec_descriptor_init(descriptor); - return descriptor; -} - -/** Determine if codec list is empty */ -static APR_INLINE apt_bool_t mpf_codec_list_is_empty(const mpf_codec_list_t *codec_list) -{ - return apr_is_empty_array(codec_list->descriptor_arr); -} - -/** Get codec descriptor by index */ -static APR_INLINE mpf_codec_descriptor_t* mpf_codec_list_descriptor_get(const mpf_codec_list_t *codec_list, apr_size_t id) -{ - if(id >= (apr_size_t)codec_list->descriptor_arr->nelts) { - return NULL; - } - return &APR_ARRAY_IDX(codec_list->descriptor_arr,id,mpf_codec_descriptor_t); -} - -/** Create linear PCM descriptor */ -MPF_DECLARE(mpf_codec_descriptor_t*) mpf_codec_lpcm_descriptor_create(apr_uint16_t sampling_rate, apr_byte_t channel_count, apr_pool_t *pool); - -/** Create codec descriptor by capabilities */ -MPF_DECLARE(mpf_codec_descriptor_t*) mpf_codec_descriptor_create_by_capabilities(const mpf_codec_capabilities_t *capabilities, const mpf_codec_descriptor_t *peer, apr_pool_t *pool); - -/** Match two codec descriptors */ -MPF_DECLARE(apt_bool_t) mpf_codec_descriptors_match(const mpf_codec_descriptor_t *descriptor1, const mpf_codec_descriptor_t *descriptor2); - -/** Match specified codec descriptor and the default lpcm one */ -MPF_DECLARE(apt_bool_t) mpf_codec_lpcm_descriptor_match(const mpf_codec_descriptor_t *descriptor); - -/** Match codec descriptor by attribs specified */ -MPF_DECLARE(apt_bool_t) mpf_codec_descriptor_match_by_attribs(mpf_codec_descriptor_t *descriptor, const mpf_codec_descriptor_t *static_descriptor, const mpf_codec_attribs_t *attribs); - - - -/** Initialize codec capabilities */ -static APR_INLINE void mpf_codec_capabilities_init(mpf_codec_capabilities_t *capabilities, apr_size_t initial_count, apr_pool_t *pool) -{ - capabilities->attrib_arr = apr_array_make(pool,(int)initial_count, sizeof(mpf_codec_attribs_t)); - capabilities->allow_named_events = TRUE; -} - -/** Clone codec capabilities */ -static APR_INLINE void mpf_codec_capabilities_clone(mpf_codec_capabilities_t *capabilities, const mpf_codec_capabilities_t *src_capabilities, apr_pool_t *pool) -{ - capabilities->attrib_arr = apr_array_copy(pool,src_capabilities->attrib_arr); - capabilities->allow_named_events = src_capabilities->allow_named_events; -} - -/** Merge codec capabilities */ -static APR_INLINE apt_bool_t mpf_codec_capabilities_merge(mpf_codec_capabilities_t *capabilities, const mpf_codec_capabilities_t *src_capabilities, apr_pool_t *pool) -{ - if(capabilities->allow_named_events == FALSE && src_capabilities->allow_named_events == TRUE) { - capabilities->allow_named_events = src_capabilities->allow_named_events; - } - capabilities->attrib_arr = apr_array_append(pool,capabilities->attrib_arr,src_capabilities->attrib_arr); - return TRUE; -} - -/** Add codec capabilities */ -static APR_INLINE apt_bool_t mpf_codec_capabilities_add(mpf_codec_capabilities_t *capabilities, int sample_rates, const char *codec_name) -{ - mpf_codec_attribs_t *attribs = (mpf_codec_attribs_t*)apr_array_push(capabilities->attrib_arr); - apt_string_assign(&attribs->name,codec_name,capabilities->attrib_arr->pool); - attribs->sample_rates = sample_rates; - attribs->bits_per_sample = 0; - return TRUE; -} - -/** Add default (linear PCM) capabilities */ -MPF_DECLARE(apt_bool_t) mpf_codec_default_capabilities_add(mpf_codec_capabilities_t *capabilities); - -/** Validate codec capabilities */ -static APR_INLINE apt_bool_t mpf_codec_capabilities_validate(mpf_codec_capabilities_t *capabilities) -{ - if(apr_is_empty_array(capabilities->attrib_arr) == TRUE) { - mpf_codec_default_capabilities_add(capabilities); - } - return TRUE; -} - - - -/** Find matched descriptor in codec list */ -MPF_DECLARE(mpf_codec_descriptor_t*) mpf_codec_list_descriptor_find(const mpf_codec_list_t *codec_list, const mpf_codec_descriptor_t *descriptor); - -/** Match codec list with specified capabilities */ -MPF_DECLARE(apt_bool_t) mpf_codec_list_match(mpf_codec_list_t *codec_list, const mpf_codec_capabilities_t *capabilities); - -/** Intersect two codec lists */ -MPF_DECLARE(apt_bool_t) mpf_codec_lists_intersect(mpf_codec_list_t *codec_list1, mpf_codec_list_t *codec_list2); - - -/** Get sampling rate mask (mpf_sample_rate_e) by integer value */ -MPF_DECLARE(int) mpf_sample_rate_mask_get(apr_uint16_t sampling_rate); - - -APT_END_EXTERN_C - -#endif /* MPF_CODEC_DESCRIPTOR_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_codec_manager.h b/libs/unimrcp/libs/mpf/include/mpf_codec_manager.h deleted file mode 100644 index 919d5112bb..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_codec_manager.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_codec_manager.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_CODEC_MANAGER_H -#define MPF_CODEC_MANAGER_H - -/** - * @file mpf_codec_manager.h - * @brief MPF Codec Manager - */ - -#include "mpf_types.h" -#include "mpf_codec.h" - -APT_BEGIN_EXTERN_C - -/** Create codec manager */ -MPF_DECLARE(mpf_codec_manager_t*) mpf_codec_manager_create(apr_size_t codec_count, apr_pool_t *pool); - -/** Destroy codec manager */ -MPF_DECLARE(void) mpf_codec_manager_destroy(mpf_codec_manager_t *codec_manager); - -/** Register codec in codec manager */ -MPF_DECLARE(apt_bool_t) mpf_codec_manager_codec_register(mpf_codec_manager_t *codec_manager, mpf_codec_t *codec); - -/** Get (allocate) codec by codec descriptor */ -MPF_DECLARE(mpf_codec_t*) mpf_codec_manager_codec_get(const mpf_codec_manager_t *codec_manager, mpf_codec_descriptor_t *descriptor, apr_pool_t *pool); - -/** Get (allocate) list of available codecs */ -MPF_DECLARE(apt_bool_t) mpf_codec_manager_codec_list_get(const mpf_codec_manager_t *codec_manager, mpf_codec_list_t *codec_list, apr_pool_t *pool); - -/** Load (allocate) list of codecs */ -MPF_DECLARE(apt_bool_t) mpf_codec_manager_codec_list_load(const mpf_codec_manager_t *codec_manager, mpf_codec_list_t *codec_list, const char *str, apr_pool_t *pool); - -/** Find codec by name */ -MPF_DECLARE(const mpf_codec_t*) mpf_codec_manager_codec_find(const mpf_codec_manager_t *codec_manager, const apt_str_t *codec_name); - -APT_END_EXTERN_C - -#endif /* MPF_CODEC_MANAGER_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_context.h b/libs/unimrcp/libs/mpf/include/mpf_context.h deleted file mode 100644 index 24e519ab81..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_context.h +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_context.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_CONTEXT_H -#define MPF_CONTEXT_H - -/** - * @file mpf_context.h - * @brief MPF Context - */ - -#include "mpf_types.h" - -APT_BEGIN_EXTERN_C - -/** Opaque factory of media contexts */ -typedef struct mpf_context_factory_t mpf_context_factory_t; - -/** - * Create factory of media contexts. - */ -MPF_DECLARE(mpf_context_factory_t*) mpf_context_factory_create(apr_pool_t *pool); - -/** - * Destroy factory of media contexts. - */ -MPF_DECLARE(void) mpf_context_factory_destroy(mpf_context_factory_t *factory); - -/** - * Process factory of media contexts. - */ -MPF_DECLARE(apt_bool_t) mpf_context_factory_process(mpf_context_factory_t *factory); - -/** - * Create MPF context. - * @param factory the factory context belongs to - * @param name the informative name of the context - * @param obj the external object associated with context - * @param max_termination_count the max number of terminations in context - * @param pool the pool to allocate memory from - */ -MPF_DECLARE(mpf_context_t*) mpf_context_create( - mpf_context_factory_t *factory, - const char *name, - void *obj, - apr_size_t max_termination_count, - apr_pool_t *pool); - -/** - * Destroy MPF context. - * @param context the context to destroy - */ -MPF_DECLARE(apt_bool_t) mpf_context_destroy(mpf_context_t *context); - -/** - * Get external object associated with MPF context. - * @param context the context to get object from - */ -MPF_DECLARE(void*) mpf_context_object_get(const mpf_context_t *context); - -/** - * Add termination to context. - * @param context the context to add termination to - * @param termination the termination to add - */ -MPF_DECLARE(apt_bool_t) mpf_context_termination_add(mpf_context_t *context, mpf_termination_t *termination); - -/** - * Subtract termination from context. - * @param context the context to subtract termination from - * @param termination the termination to subtract - */ -MPF_DECLARE(apt_bool_t) mpf_context_termination_subtract(mpf_context_t *context, mpf_termination_t *termination); - -/** - * Add association between specified terminations. - * @param context the context to add association in the scope of - * @param termination1 the first termination to associate - * @param termination2 the second termination to associate - */ -MPF_DECLARE(apt_bool_t) mpf_context_association_add(mpf_context_t *context, mpf_termination_t *termination1, mpf_termination_t *termination2); - -/** - * Remove association between specified terminations. - * @param context the context to remove association in the scope of - * @param termination1 the first termination - * @param termination2 the second termination - */ -MPF_DECLARE(apt_bool_t) mpf_context_association_remove(mpf_context_t *context, mpf_termination_t *termination1, mpf_termination_t *termination2); - -/** - * Reset assigned associations and destroy applied topology. - * @param context the context to reset associations for - */ -MPF_DECLARE(apt_bool_t) mpf_context_associations_reset(mpf_context_t *context); - -/** - * Apply topology. - * @param context the context to apply topology for - */ -MPF_DECLARE(apt_bool_t) mpf_context_topology_apply(mpf_context_t *context); - -/** - * Destroy topology. - * @param context the context to destroy topology for - */ -MPF_DECLARE(apt_bool_t) mpf_context_topology_destroy(mpf_context_t *context); - -/** - * Process context. - * @param context the context to process - */ -MPF_DECLARE(apt_bool_t) mpf_context_process(mpf_context_t *context); - - -APT_END_EXTERN_C - -#endif /* MPF_CONTEXT_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_decoder.h b/libs/unimrcp/libs/mpf/include/mpf_decoder.h deleted file mode 100644 index 930b1dcb6b..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_decoder.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_decoder.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_DECODER_H -#define MPF_DECODER_H - -/** - * @file mpf_decoder.h - * @brief MPF Stream Decoder - */ - -#include "mpf_stream.h" - -APT_BEGIN_EXTERN_C - -/** - * Create audio stream decoder. - * @param source the source to get encoded stream from - * @param codec the codec to use for decode - * @param pool the pool to allocate memory from - */ -MPF_DECLARE(mpf_audio_stream_t*) mpf_decoder_create(mpf_audio_stream_t *source, mpf_codec_t *codec, apr_pool_t *pool); - - -APT_END_EXTERN_C - -#endif /* MPF_ENCODER_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_dtmf_detector.h b/libs/unimrcp/libs/mpf/include/mpf_dtmf_detector.h deleted file mode 100644 index 4108e3bd9b..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_dtmf_detector.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright 2009-2010 Tomas Valenta, Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_dtmf_detector.h 1474 2010-02-07 20:51:47Z achaloyan $ - */ - -#ifndef MPF_DTMF_DETECTOR_H -#define MPF_DTMF_DETECTOR_H - -/** - * @file mpf_dtmf_detector.h - * @brief DTMF detector - * - * Detector of DTMF tones sent both out-of-band (RFC4733) and in-band (audio). - */ - -#include "apr.h" -#include "apr_pools.h" -#include "apt.h" -#include "mpf_frame.h" -#include "mpf_stream.h" - -APT_BEGIN_EXTERN_C - -/** DTMF detector band */ -typedef enum mpf_dtmf_detector_band_e { - /** Detect tones in-band */ - MPF_DTMF_DETECTOR_INBAND = 0x1, - /** Detect named events out-of-band */ - MPF_DTMF_DETECTOR_OUTBAND = 0x2, - /** Detect both in-band and out-of-band digits */ - MPF_DTMF_DETECTOR_BOTH = MPF_DTMF_DETECTOR_INBAND | MPF_DTMF_DETECTOR_OUTBAND -} mpf_dtmf_detector_band_e; - -/** Opaque MPF DTMF detector structure definition */ -typedef struct mpf_dtmf_detector_t mpf_dtmf_detector_t; - - -/** - * Create MPF DTMF detector (advanced). - * @param stream A stream to get digits from. - * @param band One of: - * - MPF_DTMF_DETECTOR_INBAND: detect audible tones only - * - MPF_DTMF_DETECTOR_OUTBAND: detect out-of-band named-events only - * - MPF_DTMF_DETECTOR_BOTH: detect digits in both bands if supported by - * stream. When out-of-band digit arrives, in-band detection is turned off. - * @param pool Memory pool to allocate DTMF detector from. - * @return The object or NULL on error. - * @see mpf_dtmf_detector_create - */ -MPF_DECLARE(struct mpf_dtmf_detector_t *) mpf_dtmf_detector_create_ex( - const struct mpf_audio_stream_t *stream, - enum mpf_dtmf_detector_band_e band, - struct apr_pool_t *pool); - -/** - * Create MPF DTMF detector (simple). Calls mpf_dtmf_detector_create_ex - * with band = MPF_DTMF_DETECTOR_BOTH if out-of-band supported by the stream, - * MPF_DTMF_DETECTOR_INBAND otherwise. - * @param stream A stream to get digits from. - * @param pool Memory pool to allocate DTMF detector from. - * @return The object or NULL on error. - * @see mpf_dtmf_detector_create_ex - */ -static APR_INLINE struct mpf_dtmf_detector_t *mpf_dtmf_detector_create( - const struct mpf_audio_stream_t *stream, - struct apr_pool_t *pool) -{ - return mpf_dtmf_detector_create_ex(stream, - stream->tx_event_descriptor ? MPF_DTMF_DETECTOR_BOTH : MPF_DTMF_DETECTOR_INBAND, - pool); -} - -/** - * Get DTMF digit from buffer of digits detected so far and remove it. - * @param detector The detector. - * @return DTMF character [0-9*#A-D] or NUL if the buffer is empty. - */ -MPF_DECLARE(char) mpf_dtmf_detector_digit_get(struct mpf_dtmf_detector_t *detector); - -/** - * Retrieve how many digits was lost due to full buffer. - * @param detector The detector. - * @return Number of lost digits. - */ -MPF_DECLARE(apr_size_t) mpf_dtmf_detector_digits_lost(const struct mpf_dtmf_detector_t *detector); - -/** - * Empty the buffer and reset detection states. - * @param detector The detector. - */ -MPF_DECLARE(void) mpf_dtmf_detector_reset(struct mpf_dtmf_detector_t *detector); - -/** - * Detect DTMF digits in the frame. - * @param detector The detector. - * @param frame Frame object passed in stream_write(). - */ -MPF_DECLARE(void) mpf_dtmf_detector_get_frame( - struct mpf_dtmf_detector_t *detector, - const struct mpf_frame_t *frame); - -/** - * Free all resources associated with the detector. - * @param detector The detector. - */ -MPF_DECLARE(void) mpf_dtmf_detector_destroy(struct mpf_dtmf_detector_t *detector); - -APT_END_EXTERN_C - -#endif /* MPF_DTMF_DETECTOR_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_dtmf_generator.h b/libs/unimrcp/libs/mpf/include/mpf_dtmf_generator.h deleted file mode 100644 index ea28bba432..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_dtmf_generator.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright 2009-2010 Tomas Valenta, Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef MPF_DTMF_GENERATOR_H -#define MPF_DTMF_GENERATOR_H - -/** - * @file mpf_dtmf_generator.h - * @brief DTMF generator - * - * Generator used to send DTMF tones. Capable to send digits - * either in-band as audible tones or out-of-band according - * to RFC4733. - */ - -#include "apr_pools.h" -#include "apt.h" -#include "mpf_frame.h" -#include "mpf_stream.h" - -APT_BEGIN_EXTERN_C - -/** DTMF generator band */ -typedef enum mpf_dtmf_generator_band_e { - /** Generate tones in-band */ - MPF_DTMF_GENERATOR_INBAND = 0x1, - /** Generate named events out-of-band */ - MPF_DTMF_GENERATOR_OUTBAND = 0x2, - /** Generate both tones and named events */ - MPF_DTMF_GENERATOR_BOTH = MPF_DTMF_GENERATOR_INBAND | MPF_DTMF_GENERATOR_OUTBAND -} mpf_dtmf_generator_band_e; - -/** Opaque MPF DTMF generator structure definition */ -typedef struct mpf_dtmf_generator_t mpf_dtmf_generator_t; - - -/** - * Create MPF DTMF generator (advanced). - * @param stream A stream to transport digits via. - * @param band MPF_DTMF_GENERATOR_INBAND or MPF_DTMF_GENERATOR_OUTBAND - * @param tone_ms Tone duration in milliseconds. - * @param silence_ms Inter-digit silence in milliseconds. - * @param pool Memory pool to allocate DTMF generator from. - * @return The object or NULL on error. - * @see mpf_dtmf_generator_create - */ -MPF_DECLARE(struct mpf_dtmf_generator_t *) mpf_dtmf_generator_create_ex( - const struct mpf_audio_stream_t *stream, - enum mpf_dtmf_generator_band_e band, - apr_uint32_t tone_ms, - apr_uint32_t silence_ms, - struct apr_pool_t *pool); - -/** - * Create MPF DTMF generator (simple). Calls mpf_dtmf_generator_create_ex - * with band = MPF_DTMF_GENERATOR_OUTBAND if supported by the stream or - * MPF_DTMF_GENERATOR_INBAND otherwise, tone_ms = 70, silence_ms = 50. - * @param stream A stream to transport digits via. - * @param pool Memory pool to allocate DTMF generator from. - * @return The object or NULL on error. - * @see mpf_dtmf_generator_create_ex - */ -static APR_INLINE struct mpf_dtmf_generator_t *mpf_dtmf_generator_create( - const struct mpf_audio_stream_t *stream, - struct apr_pool_t *pool) -{ - return mpf_dtmf_generator_create_ex(stream, - stream->rx_event_descriptor ? MPF_DTMF_GENERATOR_OUTBAND : MPF_DTMF_GENERATOR_INBAND, - 70, 50, pool); -} - -/** - * Add DTMF digits to the queue. - * @param generator The generator. - * @param digits DTMF character sequence [0-9*#A-D]. - * @return TRUE if ok, FALSE if there are too many digits. - */ -MPF_DECLARE(apt_bool_t) mpf_dtmf_generator_enqueue( - struct mpf_dtmf_generator_t *generator, - const char *digits); - -/** - * Empty the queue and immediately stop generating. - * @param generator The generator. - */ -MPF_DECLARE(void) mpf_dtmf_generator_reset(struct mpf_dtmf_generator_t *generator); - -/** - * Check state of the generator. - * @param generator The generator. - * @return TRUE if generating a digit or there are digits waiting in queue. - * FALSE if the queue is empty or generating silence after the last digit. - */ -MPF_DECLARE(apt_bool_t) mpf_dtmf_generator_sending(const struct mpf_dtmf_generator_t *generator); - -/** - * Put frame into the stream. - * @param generator The generator. - * @param frame Frame object passed in stream_read(). - * @return TRUE if frame with tone (both in-band and out-of-band) was generated, - * FALSE otherwise. In contrast to mpf_dtmf_generator_sending, returns FALSE even - * if generating inter-digit silence. In other words returns TRUE iff the frame - * object was filled with data. This method MUST be called for each frame for - * proper timing. - */ -MPF_DECLARE(apt_bool_t) mpf_dtmf_generator_put_frame( - struct mpf_dtmf_generator_t *generator, - struct mpf_frame_t *frame); - -/** - * Free all resources associated with the generator. - * @param generator The generator. - */ -MPF_DECLARE(void) mpf_dtmf_generator_destroy(struct mpf_dtmf_generator_t *generator); - -APT_END_EXTERN_C - -#endif /* MPF_DTMF_GENERATOR_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_encoder.h b/libs/unimrcp/libs/mpf/include/mpf_encoder.h deleted file mode 100644 index 21e49120db..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_encoder.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_encoder.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_ENCODER_H -#define MPF_ENCODER_H - -/** - * @file mpf_encoder.h - * @brief MPF Stream Encoder - */ - -#include "mpf_stream.h" - -APT_BEGIN_EXTERN_C - -/** - * Create audio stream encoder. - * @param sink the sink to write encoded stream to - * @param codec the codec to use for encode - * @param pool the pool to allocate memory from - */ -MPF_DECLARE(mpf_audio_stream_t*) mpf_encoder_create(mpf_audio_stream_t *sink, mpf_codec_t *codec, apr_pool_t *pool); - - -APT_END_EXTERN_C - -#endif /* MPF_ENCODER_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_engine.h b/libs/unimrcp/libs/mpf/include/mpf_engine.h deleted file mode 100644 index 4192ccf33b..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_engine.h +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_engine.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_ENGINE_H -#define MPF_ENGINE_H - -/** - * @file mpf_engine.h - * @brief Media Processing Framework Engine - */ - -#include "apt_task.h" -#include "mpf_message.h" - -APT_BEGIN_EXTERN_C - -/** MPF task message definition */ -typedef apt_task_msg_t mpf_task_msg_t; - -/** - * Create MPF engine. - * @param id the identifier of the engine - * @param pool the pool to allocate memory from - */ -MPF_DECLARE(mpf_engine_t*) mpf_engine_create(const char *id, apr_pool_t *pool); - -/** - * Create MPF codec manager. - * @param pool the pool to allocate memory from - */ -MPF_DECLARE(mpf_codec_manager_t*) mpf_engine_codec_manager_create(apr_pool_t *pool); - -/** - * Register MPF codec manager. - * @param engine the engine to register codec manager for - * @param codec_manager the codec manager to register - */ -MPF_DECLARE(apt_bool_t) mpf_engine_codec_manager_register(mpf_engine_t *engine, const mpf_codec_manager_t *codec_manager); - -/** - * Create MPF context. - * @param engine the engine to create context for - * @param name the informative name of the context - * @param obj the external object associated with context - * @param max_termination_count the max number of terminations in context - * @param pool the pool to allocate memory from - */ -MPF_DECLARE(mpf_context_t*) mpf_engine_context_create( - mpf_engine_t *engine, - const char *name, - void *obj, - apr_size_t max_termination_count, - apr_pool_t *pool); - -/** - * Destroy MPF context. - * @param context the context to destroy - */ -MPF_DECLARE(apt_bool_t) mpf_engine_context_destroy(mpf_context_t *context); - -/** - * Get external object associated with MPF context. - * @param context the context to get object from - */ -MPF_DECLARE(void*) mpf_engine_context_object_get(const mpf_context_t *context); - -/** - * Get task. - * @param engine the engine to get task from - */ -MPF_DECLARE(apt_task_t*) mpf_task_get(const mpf_engine_t *engine); - -/** - * Set task msg type to send responses and events with. - * @param engine the engine to set task msg type for - * @param type the type to set - */ -MPF_DECLARE(void) mpf_engine_task_msg_type_set(mpf_engine_t *engine, apt_task_msg_type_e type); - -/** - * Create task message(if not created) and add MPF termination message to it. - * @param engine the engine task message belongs to - * @param command_id the MPF command identifier - * @param context the context to add termination to - * @param termination the termination to add - * @param descriptor the termination dependent descriptor - * @param task_msg the task message to create and add constructed MPF message to - */ -MPF_DECLARE(apt_bool_t) mpf_engine_termination_message_add( - mpf_engine_t *engine, - mpf_command_type_e command_id, - mpf_context_t *context, - mpf_termination_t *termination, - void *descriptor, - mpf_task_msg_t **task_msg); - -/** - * Create task message(if not created) and add MPF association message to it. - * @param engine the engine task message belongs to - * @param command_id the MPF command identifier - * @param context the context to add association of terminations for - * @param termination the termination to associate - * @param assoc_termination the termination to associate - * @param task_msg the task message to create and add constructed MPF message to - */ -MPF_DECLARE(apt_bool_t) mpf_engine_assoc_message_add( - mpf_engine_t *engine, - mpf_command_type_e command_id, - mpf_context_t *context, - mpf_termination_t *termination, - mpf_termination_t *assoc_termination, - mpf_task_msg_t **task_msg); - -/** - * Create task message(if not created) and add MPF topology message to it. - * @param engine the engine task message belongs to - * @param command_id the MPF command identifier - * @param context the context to modify topology for - * @param task_msg the task message to create and add constructed MPF message to - */ -MPF_DECLARE(apt_bool_t) mpf_engine_topology_message_add( - mpf_engine_t *engine, - mpf_command_type_e command_id, - mpf_context_t *context, - mpf_task_msg_t **task_msg); - -/** - * Send MPF task message. - * @param engine the engine to send task message to - * @param task_msg the task message to send - */ -MPF_DECLARE(apt_bool_t) mpf_engine_message_send(mpf_engine_t *engine, mpf_task_msg_t **task_msg); - -/** - * Set scheduler rate. - * @param engine the engine to set rate for - * @param rate the rate (n times faster than real-time) - */ -MPF_DECLARE(apt_bool_t) mpf_engine_scheduler_rate_set(mpf_engine_t *engine, unsigned long rate); - -/** - * Get the identifier of the engine . - * @param engine the engine to get name of - */ -MPF_DECLARE(const char*) mpf_engine_id_get(const mpf_engine_t *engine); - - -APT_END_EXTERN_C - -#endif /* MPF_ENGINE_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_engine_factory.h b/libs/unimrcp/libs/mpf/include/mpf_engine_factory.h deleted file mode 100644 index d53607e2a4..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_engine_factory.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_engine_factory.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_ENGINE_FACTORY_H -#define MPF_ENGINE_FACTORY_H - -/** - * @file mpf_engine.h - * @brief Factory of Media Processing Engines - */ - -#include "mpf_types.h" - -APT_BEGIN_EXTERN_C - -/** Create factory of media engines. */ -MPF_DECLARE(mpf_engine_factory_t*) mpf_engine_factory_create(apr_pool_t *pool); - -/** Add media engine to factory. */ -MPF_DECLARE(apt_bool_t) mpf_engine_factory_engine_add(mpf_engine_factory_t *mpf_factory, mpf_engine_t *media_engine); - -/** Determine whether factory is empty. */ -MPF_DECLARE(apt_bool_t) mpf_engine_factory_is_empty(const mpf_engine_factory_t *mpf_factory); - -/** Select next available media engine. */ -MPF_DECLARE(mpf_engine_t*) mpf_engine_factory_engine_select(mpf_engine_factory_t *mpf_factory); - -/** Associate media engines with RTP termination factory. */ -MPF_DECLARE(apt_bool_t) mpf_engine_factory_rtp_factory_assign(mpf_engine_factory_t *mpf_factory, mpf_termination_factory_t *rtp_factory); - -APT_END_EXTERN_C - -#endif /* MPF_ENGINE_FACTORY_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_file_termination_factory.h b/libs/unimrcp/libs/mpf/include/mpf_file_termination_factory.h deleted file mode 100644 index f1c9cbe99b..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_file_termination_factory.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_file_termination_factory.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_FILE_TERMINATION_FACTORY_H -#define MPF_FILE_TERMINATION_FACTORY_H - -/** - * @file mpf_file_termination_factory.h - * @brief MPF File Termination Factory - */ - -#include "mpf_termination_factory.h" - -APT_BEGIN_EXTERN_C - -/** - * Create file termination factory. - */ -MPF_DECLARE(mpf_termination_factory_t*) mpf_file_termination_factory_create(apr_pool_t *pool); - - -APT_END_EXTERN_C - -#endif /* MPF_RTP_TERMINATION_FACTORY_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_frame.h b/libs/unimrcp/libs/mpf/include/mpf_frame.h deleted file mode 100644 index af37459962..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_frame.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_frame.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_FRAME_H -#define MPF_FRAME_H - -/** - * @file mpf_frame.h - * @brief MPF Audio/Video/Named-event Frame - */ - -#include "mpf_codec_descriptor.h" -#include "mpf_named_event.h" - -APT_BEGIN_EXTERN_C - -/** Media frame types */ -typedef enum { - MEDIA_FRAME_TYPE_NONE = 0x0, /**< none */ - MEDIA_FRAME_TYPE_AUDIO = 0x1, /**< audio frame */ - MEDIA_FRAME_TYPE_VIDEO = 0x2, /**< video frame */ - MEDIA_FRAME_TYPE_EVENT = 0x4 /**< named event frame (RFC4733/RFC2833) */ -} mpf_frame_type_e; - -/** Media frame marker */ -typedef enum { - MPF_MARKER_NONE, /**< none */ - MPF_MARKER_START_OF_EVENT, /**< start of event */ - MPF_MARKER_END_OF_EVENT, /**< end of event */ - MPF_MARKER_NEW_SEGMENT /**< start of new segment (long-lasting events) */ -} mpf_frame_marker_e; - -/** Media frame declaration */ -typedef struct mpf_frame_t mpf_frame_t; - -/** Media frame */ -struct mpf_frame_t { - /** frame type (audio/video/named-event) mpf_frame_type_e */ - int type; - /** frame marker (start-of-event,end-of-event) mpf_frame_marker_e */ - int marker; - /** codec frame */ - mpf_codec_frame_t codec_frame; - /** named-event frame */ - mpf_named_event_frame_t event_frame; -}; - - -APT_END_EXTERN_C - -#endif /* MPF_FRAME_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_frame_buffer.h b/libs/unimrcp/libs/mpf/include/mpf_frame_buffer.h deleted file mode 100644 index 749479fe22..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_frame_buffer.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_frame_buffer.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_FRAME_BUFFER_H -#define MPF_FRAME_BUFFER_H - -/** - * @file mpf_frame_buffer.h - * @brief Buffer of Media Frames - */ - -#include "mpf_frame.h" - -APT_BEGIN_EXTERN_C - -/** Opaque frame buffer declaration */ -typedef struct mpf_frame_buffer_t mpf_frame_buffer_t; - - -/** Create frame buffer */ -mpf_frame_buffer_t* mpf_frame_buffer_create(apr_size_t frame_size, apr_size_t frame_count, apr_pool_t *pool); - -/** Destroy frame buffer */ -void mpf_frame_buffer_destroy(mpf_frame_buffer_t *buffer); - -/** Restart frame buffer */ -apt_bool_t mpf_frame_buffer_restart(mpf_frame_buffer_t *buffer); - -/** Write frame to buffer */ -apt_bool_t mpf_frame_buffer_write(mpf_frame_buffer_t *buffer, const mpf_frame_t *frame); - -/** Read frame from buffer */ -apt_bool_t mpf_frame_buffer_read(mpf_frame_buffer_t *buffer, mpf_frame_t *frame); - -#ifdef MPF_FRAME_BUFFER_DEBUG -apt_bool_t mpf_frame_buffer_file_open(mpf_frame_buffer_t *buffer, const char *utt_file_in, const char *utt_file_out); -#endif - -APT_END_EXTERN_C - -#endif /* MPF_FRAME_BUFFER_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_jitter_buffer.h b/libs/unimrcp/libs/mpf/include/mpf_jitter_buffer.h deleted file mode 100644 index 5b483607fb..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_jitter_buffer.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_jitter_buffer.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_JITTER_BUFFER_H -#define MPF_JITTER_BUFFER_H - -/** - * @file mpf_jitter_buffer.h - * @brief Jitter Buffer - */ - -#include "mpf_frame.h" -#include "mpf_codec.h" -#include "mpf_rtp_descriptor.h" - -APT_BEGIN_EXTERN_C - -/** Jitter buffer write result */ -typedef enum { - JB_OK, /**< successful write */ - JB_DISCARD_NOT_ALLIGNED, /**< discarded write (frame isn't alligned to CODEC_FRAME_TIME_BASE) */ - JB_DISCARD_TOO_LATE, /**< discarded write (frame is arrived too late) */ - JB_DISCARD_TOO_EARLY, /**< discarded write (frame is arrived too early, buffer is full) */ -} jb_result_t; - -/** Opaque jitter buffer declaration */ -typedef struct mpf_jitter_buffer_t mpf_jitter_buffer_t; - - -/** Create jitter buffer */ -mpf_jitter_buffer_t* mpf_jitter_buffer_create(mpf_jb_config_t *jb_config, mpf_codec_descriptor_t *descriptor, mpf_codec_t *codec, apr_pool_t *pool); - -/** Destroy jitter buffer */ -void mpf_jitter_buffer_destroy(mpf_jitter_buffer_t *jb); - -/** Restart jitter buffer */ -apt_bool_t mpf_jitter_buffer_restart(mpf_jitter_buffer_t *jb); - -/** Write audio data to jitter buffer */ -jb_result_t mpf_jitter_buffer_write(mpf_jitter_buffer_t *jb, void *buffer, apr_size_t size, apr_uint32_t ts, apr_byte_t marker); - -/** Write named event to jitter buffer */ -jb_result_t mpf_jitter_buffer_event_write(mpf_jitter_buffer_t *jb, const mpf_named_event_frame_t *named_event, apr_uint32_t ts, apr_byte_t marker); - -/** Read media frame from jitter buffer */ -apt_bool_t mpf_jitter_buffer_read(mpf_jitter_buffer_t *jb, mpf_frame_t *media_frame); - -/** Get current playout delay */ -apr_uint32_t mpf_jitter_buffer_playout_delay_get(const mpf_jitter_buffer_t *jb); - -APT_END_EXTERN_C - -#endif /* MPF_JITTER_BUFFER_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_message.h b/libs/unimrcp/libs/mpf/include/mpf_message.h deleted file mode 100644 index 91db7f0946..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_message.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_message.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_MESSAGE_H -#define MPF_MESSAGE_H - -/** - * @file mpf_message.h - * @brief Media Processing Framework Message Definitions - */ - -#include "mpf_types.h" - -APT_BEGIN_EXTERN_C - -/** Max number of messages grouped in a container */ -#define MAX_MPF_MESSAGE_COUNT 5 - -/** Enumeration of MPF message types */ -typedef enum { - MPF_MESSAGE_TYPE_REQUEST, /**< request message */ - MPF_MESSAGE_TYPE_RESPONSE, /**< response message */ - MPF_MESSAGE_TYPE_EVENT /**< event message */ -} mpf_message_type_e; - -/** Enumeration of MPF status codes */ -typedef enum { - MPF_STATUS_CODE_SUCCESS, /**< indicates success */ - MPF_STATUS_CODE_FAILURE /**< indicates failure */ -} mpf_status_code_e; - - -/** Enumeration of MPF commands */ -typedef enum { - MPF_ADD_TERMINATION, /**< add termination to context */ - MPF_MODIFY_TERMINATION, /**< modify termination properties */ - MPF_SUBTRACT_TERMINATION,/**< subtract termination from context */ - MPF_ADD_ASSOCIATION, /**< add association between terminations */ - MPF_REMOVE_ASSOCIATION, /**< remove association between terminations */ - MPF_RESET_ASSOCIATIONS, /**< reset associations among terminations (also destroy topology) */ - MPF_APPLY_TOPOLOGY, /**< apply topology based on assigned associations */ - MPF_DESTROY_TOPOLOGY /**< destroy applied topology */ -} mpf_command_type_e; - -/** MPF message declaration */ -typedef struct mpf_message_t mpf_message_t; -/** MPF message container declaration */ -typedef struct mpf_message_container_t mpf_message_container_t; - -/** MPF message definition */ -struct mpf_message_t { - /** Message type (request/response/event) */ - mpf_message_type_e message_type; - /** Command identifier (add, modify, subtract, ...) */ - mpf_command_type_e command_id; - /** Status code used in responses */ - mpf_status_code_e status_code; - - /** Context */ - mpf_context_t *context; - /** Termination */ - mpf_termination_t *termination; - /** Associated termination */ - mpf_termination_t *assoc_termination; - /** Termination type dependent descriptor */ - void *descriptor; -}; - -/** MPF message container definition */ -struct mpf_message_container_t { - /** Number of actual messages */ - apr_size_t count; - /** Array of messages */ - mpf_message_t messages[MAX_MPF_MESSAGE_COUNT]; -}; - -APT_END_EXTERN_C - -#endif /* MPF_MESSAGE_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_mixer.h b/libs/unimrcp/libs/mpf/include/mpf_mixer.h deleted file mode 100644 index c4e66542d2..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_mixer.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_mixer.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_MIXER_H -#define MPF_MIXER_H - -/** - * @file mpf_mixer.h - * @brief MPF Stream Mixer (n-sources, 1-sink) - */ - -#include "mpf_object.h" - -APT_BEGIN_EXTERN_C - -/** - * Create audio stream mixer. - * @param source_arr the array of audio sources - * @param source_count the number of audio sources - * @param sink the audio sink - * @param codec_manager the codec manager - * @param name the informative name used for debugging - * @param pool the pool to allocate memory from - */ -MPF_DECLARE(mpf_object_t*) mpf_mixer_create( - mpf_audio_stream_t **source_arr, - apr_size_t source_count, - mpf_audio_stream_t *sink, - const mpf_codec_manager_t *codec_manager, - const char *name, - apr_pool_t *pool); - - -APT_END_EXTERN_C - -#endif /* MPF_MIXER_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_multiplier.h b/libs/unimrcp/libs/mpf/include/mpf_multiplier.h deleted file mode 100644 index 04d36469eb..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_multiplier.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_multiplier.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_MULTIPLIER_H -#define MPF_MULTIPLIER_H - -/** - * @file mpf_multiplier.h - * @brief MPF Stream Multiplier (1-source, n-sinks) - */ - -#include "mpf_object.h" - -APT_BEGIN_EXTERN_C - -/** - * Create audio stream multiplier. - * @param source the audio source - * @param sink_arr the array of audio sinks - * @param sink_count the number of audio sinks - * @param codec_manager the codec manager - * @param name the informative name used for debugging - * @param pool the pool to allocate memory from - */ -MPF_DECLARE(mpf_object_t*) mpf_multiplier_create( - mpf_audio_stream_t *source, - mpf_audio_stream_t **sink_arr, - apr_size_t sink_count, - const mpf_codec_manager_t *codec_manager, - const char *name, - apr_pool_t *pool); - - -APT_END_EXTERN_C - -#endif /* MPF_MULTIPLIER_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_named_event.h b/libs/unimrcp/libs/mpf/include/mpf_named_event.h deleted file mode 100644 index 1ffc71fc2b..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_named_event.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_named_event.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_NAMED_EVENT_H -#define MPF_NAMED_EVENT_H - -/** - * @file mpf_named_event.h - * @brief MPF Named Events (RFC4733/RFC2833) - */ - -#include "mpf_codec_descriptor.h" - -APT_BEGIN_EXTERN_C - -/** Named event declaration */ -typedef struct mpf_named_event_frame_t mpf_named_event_frame_t; - - -/** Named event (RFC4733/RFC2833, out-of-band DTMF) */ -struct mpf_named_event_frame_t { - /** event (DTMF, tone) identifier */ - apr_uint32_t event_id: 8; -#if (APR_IS_BIGENDIAN == 1) - /** end of event */ - apr_uint32_t edge: 1; - /** reserved */ - apr_uint32_t reserved: 1; - /** tone volume */ - apr_uint32_t volume: 6; -#else - /** tone volume */ - apr_uint32_t volume: 6; - /** reserved */ - apr_uint32_t reserved: 1; - /** end of event */ - apr_uint32_t edge: 1; -#endif - /** event duration */ - apr_uint32_t duration: 16; -}; - -/** Create named event descriptor */ -MPF_DECLARE(mpf_codec_descriptor_t*) mpf_event_descriptor_create(apr_uint16_t sampling_rate, apr_pool_t *pool); - -/** Check whether the specified descriptor is named event one */ -MPF_DECLARE(apt_bool_t) mpf_event_descriptor_check(const mpf_codec_descriptor_t *descriptor); - -/** Convert DTMF character to event identifier */ -MPF_DECLARE(apr_uint32_t) mpf_dtmf_char_to_event_id(const char dtmf_char); - -/** Convert event identifier to DTMF character */ -MPF_DECLARE(char) mpf_event_id_to_dtmf_char(const apr_uint32_t event_id); - - -APT_END_EXTERN_C - -#endif /* MPF_NAMED_EVENT_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_object.h b/libs/unimrcp/libs/mpf/include/mpf_object.h deleted file mode 100644 index 2e8db829b5..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_object.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_object.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_OBJECT_H -#define MPF_OBJECT_H - -/** - * @file mpf_object.h - * @brief Media Processing Object Base (bridge, multiplexor, mixer, ...) - */ - -#include "mpf_types.h" - -APT_BEGIN_EXTERN_C - -/** MPF object declaration */ -typedef struct mpf_object_t mpf_object_t; - -/** Media processing objects base */ -struct mpf_object_t { - /** Informative name used for debugging */ - const char *name; - /** Virtual destroy */ - apt_bool_t (*destroy)(mpf_object_t *object); - /** Virtual process */ - apt_bool_t (*process)(mpf_object_t *object); - /** Virtual trace of media path */ - void (*trace)(mpf_object_t *object); -}; - -/** Initialize object */ -static APR_INLINE void mpf_object_init(mpf_object_t *object, const char *name) -{ - object->name = name; - object->destroy = NULL; - object->process = NULL; - object->trace = NULL; -} - -/** Destroy object */ -static APR_INLINE void mpf_object_destroy(mpf_object_t *object) -{ - if(object->destroy) - object->destroy(object); -} - -/** Process object */ -static APR_INLINE void mpf_object_process(mpf_object_t *object) -{ - if(object->process) - object->process(object); -} - -/** Trace media path */ -static APR_INLINE void mpf_object_trace(mpf_object_t *object) -{ - if(object->trace) - object->trace(object); -} - - -APT_END_EXTERN_C - -#endif /* MPF_OBJECT_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_resampler.h b/libs/unimrcp/libs/mpf/include/mpf_resampler.h deleted file mode 100644 index 13e0e59143..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_resampler.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_resampler.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_RESAMPLER_H -#define MPF_RESAMPLER_H - -/** - * @file mpf_resampler.h - * @brief MPF Stream Resampler - */ - -#include "mpf_stream.h" - -APT_BEGIN_EXTERN_C - -/** - * Create audio stream resampler. - * @param source the source stream to resample - * @param sink the sink stream to resample to - * @param pool the pool to allocate memory from - */ -MPF_DECLARE(mpf_audio_stream_t*) mpf_resampler_create(mpf_audio_stream_t *source, mpf_audio_stream_t *sink, apr_pool_t *pool); - - -APT_END_EXTERN_C - -#endif /* MPF_RESAMPLER_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_rtcp_packet.h b/libs/unimrcp/libs/mpf/include/mpf_rtcp_packet.h deleted file mode 100644 index 7afa55ede1..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_rtcp_packet.h +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_rtcp_packet.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_RTCP_PACKET_H -#define MPF_RTCP_PACKET_H - -/** - * @file mpf_rtcp_packet.h - * @brief RTCP Packet Definition - */ - -#include "mpf_rtp_stat.h" - -APT_BEGIN_EXTERN_C - - -/** RTCP payload (packet) types */ -typedef enum { - RTCP_SR = 200, - RTCP_RR = 201, - RTCP_SDES = 202, - RTCP_BYE = 203, - RTCP_APP = 204 -} rtcp_type_e; - -/** RTCP SDES types */ -typedef enum { - RTCP_SDES_END = 0, - RTCP_SDES_CNAME = 1, - RTCP_SDES_NAME = 2, - RTCP_SDES_EMAIL = 3, - RTCP_SDES_PHONE = 4, - RTCP_SDES_LOC = 5, - RTCP_SDES_TOOL = 6, - RTCP_SDES_NOTE = 7, - RTCP_SDES_PRIV = 8 -} rtcp_sdes_type_e; - -/** RTCP header declaration */ -typedef struct rtcp_header_t rtcp_header_t; -/** RTCP packet declaration */ -typedef struct rtcp_packet_t rtcp_packet_t; -/** SDES item declaration*/ -typedef struct rtcp_sdes_item_t rtcp_sdes_item_t; - - -/** RTCP header */ -struct rtcp_header_t { -#if (APR_IS_BIGENDIAN == 1) - /** protocol version */ - unsigned int version: 2; - /** padding flag */ - unsigned int padding: 1; - /** varies by packet type */ - unsigned int count: 5; - /** packet type */ - unsigned int pt: 8; -#else - /** varies by packet type */ - unsigned int count: 5; - /** padding flag */ - unsigned int padding: 1; - /** protocol version */ - unsigned int version: 2; - /** packet type */ - unsigned int pt: 8; -#endif - - /** packet length in words, w/o this word */ - unsigned int length: 16; -}; - -/** SDES item */ -struct rtcp_sdes_item_t { - /** type of item (rtcp_sdes_type_t) */ - apr_byte_t type; - /** length of item (in octets) */ - apr_byte_t length; - /** text, not null-terminated */ - char data[1]; -}; - -/** RTCP packet */ -struct rtcp_packet_t { - /** common header */ - rtcp_header_t header; - /** union of RTCP reports */ - union { - /** sender report (SR) */ - struct { - /** sr stat */ - rtcp_sr_stat_t sr_stat; - /** variable-length list rr stats */ - rtcp_rr_stat_t rr_stat[1]; - } sr; - - /** reception report (RR) */ - struct { - /** receiver generating this report */ - apr_uint32_t ssrc; - /** variable-length list rr stats */ - rtcp_rr_stat_t rr_stat[1]; - } rr; - - /** source description (SDES) */ - struct { - /** first SSRC/CSRC */ - apr_uint32_t ssrc; - /** list of SDES items */ - rtcp_sdes_item_t item[1]; - } sdes; - - /** BYE */ - struct { - /** list of sources */ - apr_uint32_t ssrc[1]; - /* optional length of reason string (in octets) */ - apr_byte_t length; - /* optional reason string, not null-terminated */ - char data[1]; - } bye; - } r; -}; - -/** Initialize RTCP header */ -static APR_INLINE void rtcp_header_init(rtcp_header_t *header, rtcp_type_e pt) -{ - header->version = RTP_VERSION; - header->padding = 0; - header->count = 0; - header->pt = pt; - header->length = 0; -} - -static APR_INLINE void rtcp_header_length_set(rtcp_header_t *header, apr_size_t length) -{ - header->length = htons((apr_uint16_t)length / 4 - 1); -} - -static APR_INLINE void rtcp_sr_hton(rtcp_sr_stat_t *sr_stat) -{ - sr_stat->ssrc = htonl(sr_stat->ssrc); - sr_stat->ntp_sec = htonl(sr_stat->ntp_sec); - sr_stat->ntp_frac = htonl(sr_stat->ntp_frac); - sr_stat->rtp_ts = htonl(sr_stat->rtp_ts); - sr_stat->sent_packets = htonl(sr_stat->sent_packets); - sr_stat->sent_octets = htonl(sr_stat->sent_octets); -} - -static APR_INLINE void rtcp_sr_ntoh(rtcp_sr_stat_t *sr_stat) -{ - sr_stat->ssrc = ntohl(sr_stat->ssrc); - sr_stat->ntp_sec = ntohl(sr_stat->ntp_sec); - sr_stat->ntp_frac = ntohl(sr_stat->ntp_frac); - sr_stat->rtp_ts = ntohl(sr_stat->rtp_ts); - sr_stat->sent_packets = ntohl(sr_stat->sent_packets); - sr_stat->sent_octets = ntohl(sr_stat->sent_octets); -} - -static APR_INLINE void rtcp_rr_hton(rtcp_rr_stat_t *rr_stat) -{ - rr_stat->ssrc = htonl(rr_stat->ssrc); - rr_stat->last_seq = htonl(rr_stat->last_seq); - rr_stat->jitter = htonl(rr_stat->jitter); - -#if (APR_IS_BIGENDIAN == 0) - rr_stat->lost = ((rr_stat->lost >> 16) & 0x000000ff) | - (rr_stat->lost & 0x0000ff00) | - ((rr_stat->lost << 16) & 0x00ff0000); -#endif -} - -static APR_INLINE void rtcp_rr_ntoh(rtcp_rr_stat_t *rr_stat) -{ - rr_stat->ssrc = ntohl(rr_stat->ssrc); - rr_stat->last_seq = ntohl(rr_stat->last_seq); - rr_stat->jitter = ntohl(rr_stat->jitter); - -#if (APR_IS_BIGENDIAN == 0) - rr_stat->lost = ((rr_stat->lost >> 16) & 0x000000ff) | - (rr_stat->lost & 0x0000ff00) | - ((rr_stat->lost << 16) & 0x00ff0000); -#endif -} - -APT_END_EXTERN_C - -#endif /* MPF_RTCP_PACKET_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_rtp_attribs.h b/libs/unimrcp/libs/mpf/include/mpf_rtp_attribs.h deleted file mode 100644 index 033e198851..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_rtp_attribs.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_rtp_attribs.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_RTP_ATTRIBS_H -#define MPF_RTP_ATTRIBS_H - -/** - * @file mpf_rtp_attribs.h - * @brief RTP Attributes (SDP) - */ - -#include "mpf_rtp_descriptor.h" - -APT_BEGIN_EXTERN_C - -/** RTP attributes */ -typedef enum { - RTP_ATTRIB_RTPMAP, - RTP_ATTRIB_SENDONLY, - RTP_ATTRIB_RECVONLY, - RTP_ATTRIB_SENDRECV, - RTP_ATTRIB_MID, - RTP_ATTRIB_PTIME, - - RTP_ATTRIB_COUNT, - RTP_ATTRIB_UNKNOWN = RTP_ATTRIB_COUNT -} mpf_rtp_attrib_e; - - -/** Get audio media attribute name by attribute identifier */ -MPF_DECLARE(const apt_str_t*) mpf_rtp_attrib_str_get(mpf_rtp_attrib_e attrib_id); - -/** Find audio media attribute identifier by attribute name */ -MPF_DECLARE(mpf_rtp_attrib_e) mpf_rtp_attrib_id_find(const apt_str_t *attrib); - -/** Get string by RTP direction (send/receive) */ -MPF_DECLARE(const apt_str_t*) mpf_rtp_direction_str_get(mpf_stream_direction_e direction); - -APT_END_EXTERN_C - -#endif /* MPF_RTP_ATTRIBS_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_rtp_defs.h b/libs/unimrcp/libs/mpf/include/mpf_rtp_defs.h deleted file mode 100644 index 6ea541862a..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_rtp_defs.h +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_rtp_defs.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_RTP_DEFS_H -#define MPF_RTP_DEFS_H - -/** - * @file mpf_rtp_defs.h - * @brief Internal RTP Definitions - */ - -#include "mpf_rtp_stat.h" -#include "mpf_jitter_buffer.h" - -APT_BEGIN_EXTERN_C - -/** Used to calculate actual number of received packets (32bit) in - * case seq number (16bit) wrapped around */ -#define RTP_SEQ_MOD (1 << 16) -/** Number of max dropout packets (seq numbers) is used to trigger - * either a drift in the seq numbers or a misorder packet */ -#define MAX_DROPOUT 3000 -/** Number of max misorder packets (seq numbers) is used to - * differentiate a drift in the seq numbers from a misorder packet */ -#define MAX_MISORDER 100 -/** Restart receiver if threshold is reached */ -#define DISCARDED_TO_RECEIVED_RATIO_THRESHOLD 30 /* 30% */ -/** Deviation threshold is used to trigger a drift in timestamps */ -#define DEVIATION_THRESHOLD 4000 -/** This threshold is used to detect a new talkspurt */ -#define INTER_TALKSPURT_GAP 1000 /* msec */ - -/** RTP receiver history declaration */ -typedef struct rtp_rx_history_t rtp_rx_history_t; -/** RTP receiver periodic history declaration */ -typedef struct rtp_rx_periodic_history_t rtp_rx_periodic_history_t; -/** RTP receiver declaration */ -typedef struct rtp_receiver_t rtp_receiver_t; -/** RTP transmitter declaration */ -typedef struct rtp_transmitter_t rtp_transmitter_t; - -/** History of RTP receiver */ -struct rtp_rx_history_t { - /** Updated on every seq num wrap around */ - apr_uint32_t seq_cycles; - - /** First seq num received */ - apr_uint16_t seq_num_base; - /** Max seq num received */ - apr_uint16_t seq_num_max; - - /** Last timestamp received */ - apr_uint32_t ts_last; - /** Local time measured on last packet received */ - apr_time_t time_last; - - /** New ssrc, which is in probation */ - apr_uint32_t ssrc_new; - /** Period of ssrc probation */ - apr_byte_t ssrc_probation; -}; - -/** Periodic history of RTP receiver (initialized after every N packets) */ -struct rtp_rx_periodic_history_t { - /** Number of packets received */ - apr_uint32_t received_prior; - /** Number of packets expected */ - apr_uint32_t expected_prior; - /** Number of packets discarded */ - apr_uint32_t discarded_prior; - - /** Min jitter */ - apr_uint32_t jitter_min; - /** Max jitter */ - apr_uint32_t jitter_max; -}; - -/** Reset RTP receiver history */ -static APR_INLINE void mpf_rtp_rx_history_reset(rtp_rx_history_t *rx_history) -{ - memset(rx_history,0,sizeof(rtp_rx_history_t)); -} - -/** Reset RTP receiver periodic history */ -static APR_INLINE void mpf_rtp_rx_periodic_history_reset(rtp_rx_periodic_history_t *rx_periodic_history) -{ - memset(rx_periodic_history,0,sizeof(rtp_rx_periodic_history_t)); -} - -/** RTP receiver */ -struct rtp_receiver_t { - /** Jitter buffer */ - mpf_jitter_buffer_t *jb; - - /** RTCP statistics used in RR */ - rtcp_rr_stat_t rr_stat; - /** RTP receiver statistics */ - rtp_rx_stat_t stat; - /** RTP history */ - rtp_rx_history_t history; - /** RTP periodic history */ - rtp_rx_periodic_history_t periodic_history; -}; - - -/** RTP transmitter */ -struct rtp_transmitter_t { - /** Packetization time in msec */ - apr_uint16_t ptime; - - /** Number of frames in a packet */ - apr_uint16_t packet_frames; - /** Current number of frames */ - apr_uint16_t current_frames; - /** Samples in frames in timestamp units */ - apr_uint32_t samples_per_frame; - - /** Indicate silence period among the talkspurts */ - apr_byte_t inactivity; - /** Last seq number sent */ - apr_uint16_t last_seq_num; - /** Current timestamp (samples processed) */ - apr_uint32_t timestamp; - /** Event timestamp base */ - apr_uint32_t timestamp_base; - - /** RTP packet payload */ - char *packet_data; - /** RTP packet payload size */ - apr_size_t packet_size; - - /** RTCP statistics used in SR */ - rtcp_sr_stat_t sr_stat; -}; - - -/** Initialize RTP receiver */ -static APR_INLINE void rtp_receiver_init(rtp_receiver_t *receiver) -{ - receiver->jb = NULL; - - mpf_rtcp_rr_stat_reset(&receiver->rr_stat); - mpf_rtp_rx_stat_reset(&receiver->stat); - mpf_rtp_rx_history_reset(&receiver->history); - mpf_rtp_rx_periodic_history_reset(&receiver->periodic_history); -} - -/** Initialize RTP transmitter */ -static APR_INLINE void rtp_transmitter_init(rtp_transmitter_t *transmitter) -{ - transmitter->ptime = 0; - - transmitter->packet_frames = 0; - transmitter->current_frames = 0; - transmitter->samples_per_frame = 0; - - transmitter->inactivity = 0; - transmitter->last_seq_num = 0; - transmitter->timestamp = 0; - transmitter->timestamp_base = 0; - - transmitter->packet_data = NULL; - transmitter->packet_size = 0; - - mpf_rtcp_sr_stat_reset(&transmitter->sr_stat); -} - -APT_END_EXTERN_C - -#endif /* MPF_RTP_DEFS_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_rtp_descriptor.h b/libs/unimrcp/libs/mpf/include/mpf_rtp_descriptor.h deleted file mode 100644 index 60fac7aefa..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_rtp_descriptor.h +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_rtp_descriptor.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_RTP_DESCRIPTOR_H -#define MPF_RTP_DESCRIPTOR_H - -/** - * @file mpf_rtp_descriptor.h - * @brief MPF RTP Stream Descriptor - */ - -#include -#include "apt_string.h" -#include "mpf_stream_descriptor.h" - -APT_BEGIN_EXTERN_C - -/** RTP media descriptor declaration */ -typedef struct mpf_rtp_media_descriptor_t mpf_rtp_media_descriptor_t; -/** RTP stream descriptor declaration */ -typedef struct mpf_rtp_stream_descriptor_t mpf_rtp_stream_descriptor_t; -/** RTP termination descriptor declaration */ -typedef struct mpf_rtp_termination_descriptor_t mpf_rtp_termination_descriptor_t; -/** RTP configuration declaration */ -typedef struct mpf_rtp_config_t mpf_rtp_config_t; -/** RTP settings declaration */ -typedef struct mpf_rtp_settings_t mpf_rtp_settings_t; -/** Jitter buffer configuration declaration */ -typedef struct mpf_jb_config_t mpf_jb_config_t; - -/** MPF media state */ -typedef enum { - MPF_MEDIA_DISABLED, /**< disabled media */ - MPF_MEDIA_ENABLED /**< enabled media */ -} mpf_media_state_e; - -/** RTP media (local/remote) descriptor */ -struct mpf_rtp_media_descriptor_t { - /** Media state (disabled/enabled)*/ - mpf_media_state_e state; - /** Ip address */ - apt_str_t ip; - /** External (NAT) Ip address */ - apt_str_t ext_ip; - /** Port */ - apr_port_t port; - /** Stream mode (send/receive) */ - mpf_stream_direction_e direction; - /** Packetization time */ - apr_uint16_t ptime; - /** Codec list */ - mpf_codec_list_t codec_list; - /** Media identifier */ - apr_size_t mid; - /** Position, order in SDP message (0,1,...) */ - apr_size_t id; -}; - -/** RTP stream descriptor */ -struct mpf_rtp_stream_descriptor_t { - /** Stream capabilities */ - mpf_stream_capabilities_t *capabilities; - /** Local media descriptor */ - mpf_rtp_media_descriptor_t *local; - /** Remote media descriptor */ - mpf_rtp_media_descriptor_t *remote; - /** Settings loaded from config */ - mpf_rtp_settings_t *settings; -}; - -/** RTP termination descriptor */ -struct mpf_rtp_termination_descriptor_t { - /** Audio stream descriptor */ - mpf_rtp_stream_descriptor_t audio; - /** Video stream descriptor */ - mpf_rtp_stream_descriptor_t video; -}; - -/** Jitter buffer configuration */ -struct mpf_jb_config_t { - /** Min playout delay in msec */ - apr_uint32_t min_playout_delay; - /** Initial playout delay in msec */ - apr_uint32_t initial_playout_delay; - /** Max playout delay in msec */ - apr_uint32_t max_playout_delay; - /** Mode of operation of the jitter buffer: static - 0, adaptive - 1 */ - apr_byte_t adaptive; - /** Enable/disable time skew detection */ - apr_byte_t time_skew_detection; -}; - -/** RTCP BYE transmission policy */ -typedef enum { - RTCP_BYE_DISABLE, /**< disable RTCP BYE transmission */ - RTCP_BYE_PER_SESSION, /**< transmit RTCP BYE at the end of session */ - RTCP_BYE_PER_TALKSPURT /**< transmit RTCP BYE at the end of each talkspurt (input) */ -} rtcp_bye_policy_e; - -/** RTP factory config */ -struct mpf_rtp_config_t { - /** Local IP address to bind to */ - apt_str_t ip; - /** External (NAT) IP address */ - apt_str_t ext_ip; - /** Min RTP port */ - apr_port_t rtp_port_min; - /** Max RTP port */ - apr_port_t rtp_port_max; - /** Current RTP port */ - apr_port_t rtp_port_cur; -}; - -/** RTP settings */ -struct mpf_rtp_settings_t { - /** Packetization time */ - apr_uint16_t ptime; - /** Codec list */ - mpf_codec_list_t codec_list; - /** Preference in offer/anwser: 1 - own(local) preference, 0 - remote preference */ - apt_bool_t own_preferrence; - /** Enable/disable RTCP support */ - apt_bool_t rtcp; - /** RTCP BYE policy */ - rtcp_bye_policy_e rtcp_bye_policy; - /** RTCP report transmission interval */ - apr_uint16_t rtcp_tx_interval; - /** RTCP rx resolution (timeout to check for a new RTCP message) */ - apr_uint16_t rtcp_rx_resolution; - /** Jitter buffer config */ - mpf_jb_config_t jb_config; -}; - -/** Initialize media descriptor */ -static APR_INLINE void mpf_rtp_media_descriptor_init(mpf_rtp_media_descriptor_t *media) -{ - media->state = MPF_MEDIA_DISABLED; - apt_string_reset(&media->ip); - apt_string_reset(&media->ext_ip); - media->port = 0; - media->direction = STREAM_DIRECTION_NONE; - media->ptime = 0; - mpf_codec_list_reset(&media->codec_list); - media->mid = 0; - media->id = 0; -} - -/** Initialize stream descriptor */ -static APR_INLINE void mpf_rtp_stream_descriptor_init(mpf_rtp_stream_descriptor_t *descriptor) -{ - descriptor->capabilities = NULL; - descriptor->local = NULL; - descriptor->remote = NULL; - descriptor->settings = NULL; -} - -/** Initialize RTP termination descriptor */ -static APR_INLINE void mpf_rtp_termination_descriptor_init(mpf_rtp_termination_descriptor_t *rtp_descriptor) -{ - mpf_rtp_stream_descriptor_init(&rtp_descriptor->audio); - mpf_rtp_stream_descriptor_init(&rtp_descriptor->video); -} - -/** Initialize JB config */ -static APR_INLINE void mpf_jb_config_init(mpf_jb_config_t *jb_config) -{ - jb_config->adaptive = 0; - jb_config->initial_playout_delay = 0; - jb_config->min_playout_delay = 0; - jb_config->max_playout_delay = 0; - jb_config->time_skew_detection = 1; -} - -/** Allocate RTP config */ -static APR_INLINE mpf_rtp_config_t* mpf_rtp_config_alloc(apr_pool_t *pool) -{ - mpf_rtp_config_t *rtp_config = (mpf_rtp_config_t*)apr_palloc(pool,sizeof(mpf_rtp_config_t)); - apt_string_reset(&rtp_config->ip); - apt_string_reset(&rtp_config->ext_ip); - rtp_config->rtp_port_cur = 0; - rtp_config->rtp_port_min = 0; - rtp_config->rtp_port_max = 0; - return rtp_config; -} - -/** Allocate RTP settings */ -static APR_INLINE mpf_rtp_settings_t* mpf_rtp_settings_alloc(apr_pool_t *pool) -{ - mpf_rtp_settings_t *rtp_settings = (mpf_rtp_settings_t*)apr_palloc(pool,sizeof(mpf_rtp_settings_t)); - rtp_settings->ptime = 0; - mpf_codec_list_init(&rtp_settings->codec_list,0,pool); - rtp_settings->own_preferrence = FALSE; - rtp_settings->rtcp = FALSE; - rtp_settings->rtcp_bye_policy = RTCP_BYE_DISABLE; - rtp_settings->rtcp_tx_interval = 0; - rtp_settings->rtcp_rx_resolution = 0; - mpf_jb_config_init(&rtp_settings->jb_config); - return rtp_settings; -} - - -APT_END_EXTERN_C - -#endif /* MPF_RTP_DESCRIPTOR_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_rtp_header.h b/libs/unimrcp/libs/mpf/include/mpf_rtp_header.h deleted file mode 100644 index 36c50c0b42..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_rtp_header.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_rtp_header.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_RTP_HEADER_H -#define MPF_RTP_HEADER_H - -/** - * @file mpf_rtp_header.h - * @brief RTP Header Definition - */ - -#include "mpf.h" - -APT_BEGIN_EXTERN_C - -/** Protocol version */ -#define RTP_VERSION 2 - -/** RTP header declaration */ -typedef struct rtp_header_t rtp_header_t; -/** RTP extension header declaration */ -typedef struct rtp_extension_header_t rtp_extension_header_t; - - -/** RTP header */ -struct rtp_header_t { -#if (APR_IS_BIGENDIAN == 1) - /** protocol version */ - apr_uint32_t version: 2; - /** padding flag */ - apr_uint32_t padding: 1; - /** header extension flag */ - apr_uint32_t extension: 1; - /** CSRC count */ - apr_uint32_t count: 4; - /** marker bit */ - apr_uint32_t marker: 1; - /** payload type */ - apr_uint32_t type: 7; -#else - /** CSRC count */ - apr_uint32_t count: 4; - /** header extension flag */ - apr_uint32_t extension: 1; - /** padding flag */ - apr_uint32_t padding: 1; - /** protocol version */ - apr_uint32_t version: 2; - /** payload type */ - apr_uint32_t type: 7; - /** marker bit */ - apr_uint32_t marker: 1; -#endif - - /** sequence number */ - apr_uint32_t sequence: 16; - /** timestamp */ - apr_uint32_t timestamp; - /** synchronization source */ - apr_uint32_t ssrc; -}; - -/** RTP extension header */ -struct rtp_extension_header_t { - /** profile */ - apr_uint16_t profile; - /** length */ - apr_uint16_t length; -}; - -APT_END_EXTERN_C - -#endif /* MPF_RTP_HEADER_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_rtp_pt.h b/libs/unimrcp/libs/mpf/include/mpf_rtp_pt.h deleted file mode 100644 index 2d01346308..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_rtp_pt.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_rtp_pt.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_RTP_PT_H -#define MPF_RTP_PT_H - -/** - * @file mpf_rtp_pt.h - * @brief RTP Payload Types (RFC3551) - */ - -#include "mpf.h" - -APT_BEGIN_EXTERN_C - -/** RTP payload types */ -typedef enum { - RTP_PT_PCMU = 0, /**< PCMU Audio 8kHz 1 */ - RTP_PT_PCMA = 8, /**< PCMA Audio 8kHz 1 */ - - RTP_PT_CN = 13, /**< Comfort Noise Audio 8kHz 1 */ - - RTP_PT_RESERVED = 19, /**< Not used for any particular codec */ - - RTP_PT_DYNAMIC = 96, /**< Start of dynamic payload types */ - RTP_PT_DYNAMIC_MAX = 127, /**< End of dynamic payload types */ - - RTP_PT_UNKNOWN = 128 /**< Unknown (invalid) payload type */ -} mpf_rtp_pt_e; - -APT_END_EXTERN_C - -#endif /* MPF_RTP_PT_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_rtp_stat.h b/libs/unimrcp/libs/mpf/include/mpf_rtp_stat.h deleted file mode 100644 index d312e75be5..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_rtp_stat.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_rtp_stat.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_RTP_STAT_H -#define MPF_RTP_STAT_H - -/** - * @file mpf_rtp_stat.h - * @brief RTP/RTCP Statistics - */ - -#include "mpf.h" - -APT_BEGIN_EXTERN_C - -/** RTP receiver statistics */ -typedef struct rtp_rx_stat_t rtp_rx_stat_t; - -/** RTCP statistics used in Sender Report (SR) */ -typedef struct rtcp_sr_stat_t rtcp_sr_stat_t; -/** RTCP statistics used in Receiver Report (RR) */ -typedef struct rtcp_rr_stat_t rtcp_rr_stat_t; - - -/** RTP receiver statistics */ -struct rtp_rx_stat_t { - /** number of valid RTP packets received */ - apr_uint32_t received_packets; - /** number of invalid RTP packets received */ - apr_uint32_t invalid_packets; - - /** number of discarded in jitter buffer packets */ - apr_uint32_t discarded_packets; - /** number of ignored packets */ - apr_uint32_t ignored_packets; - - /** number of lost in network packets */ - apr_uint32_t lost_packets; - - /** number of restarts */ - apr_byte_t restarts; -}; - -/** RTCP statistics used in Sender Report (SR) */ -struct rtcp_sr_stat_t { - /** sender source identifier */ - apr_uint32_t ssrc; - /** NTP timestamp (seconds) */ - apr_uint32_t ntp_sec; - /** NTP timestamp (fractions) */ - apr_uint32_t ntp_frac; - /** RTP timestamp */ - apr_uint32_t rtp_ts; - /** packets sent */ - apr_uint32_t sent_packets; - /** octets (bytes) sent */ - apr_uint32_t sent_octets; -}; - -/** RTCP statistics used in Receiver Report (RR) */ -struct rtcp_rr_stat_t { - /** source identifier of RTP stream being received */ - apr_uint32_t ssrc; - /** fraction lost since last SR/RR */ - apr_uint32_t fraction:8; - /** cumulative number of packets lost (signed!) */ - apr_int32_t lost:24; - /** extended last sequence number received */ - apr_uint32_t last_seq; - /** interarrival jitter (RFC3550) */ - apr_uint32_t jitter; - /** last SR packet from this source */ - apr_uint32_t lsr; - /** delay since last SR packet */ - apr_uint32_t dlsr; -}; - - - -/** Reset RTCP SR statistics */ -static APR_INLINE void mpf_rtcp_sr_stat_reset(rtcp_sr_stat_t *sr_stat) -{ - memset(sr_stat,0,sizeof(rtcp_sr_stat_t)); -} - -/** Reset RTCP RR statistics */ -static APR_INLINE void mpf_rtcp_rr_stat_reset(rtcp_rr_stat_t *rr_stat) -{ - memset(rr_stat,0,sizeof(rtcp_rr_stat_t)); -} - -/** Reset RTP receiver statistics */ -static APR_INLINE void mpf_rtp_rx_stat_reset(rtp_rx_stat_t *rx_stat) -{ - memset(rx_stat,0,sizeof(rtp_rx_stat_t)); -} - -APT_END_EXTERN_C - -#endif /* MPF_RTP_STAT_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_rtp_stream.h b/libs/unimrcp/libs/mpf/include/mpf_rtp_stream.h deleted file mode 100644 index 00e6baf557..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_rtp_stream.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_rtp_stream.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_RTP_STREAM_H -#define MPF_RTP_STREAM_H - -/** - * @file mpf_rtp_stream.h - * @brief MPF RTP Stream - */ - -#include "mpf_stream.h" -#include "mpf_rtp_descriptor.h" - -APT_BEGIN_EXTERN_C - -/** - * Create RTP stream. - * @param termination the back pointer to hold - * @param config the configuration of RTP factory - * @param settings the settings to use - * @param pool the pool to allocate memory from - */ -MPF_DECLARE(mpf_audio_stream_t*) mpf_rtp_stream_create(mpf_termination_t *termination, mpf_rtp_config_t *config, mpf_rtp_settings_t *settings, apr_pool_t *pool); - -/** - * Add/enable RTP stream. - * @param stream RTP stream to add - */ -MPF_DECLARE(apt_bool_t) mpf_rtp_stream_add(mpf_audio_stream_t *stream); - -/** - * Subtract/disable RTP stream. - * @param stream RTP stream to subtract - */ -MPF_DECLARE(apt_bool_t) mpf_rtp_stream_remove(mpf_audio_stream_t *stream); - -/** - * Modify RTP stream. - * @param stream RTP stream to modify - * @param descriptor the descriptor to modify stream according - */ -MPF_DECLARE(apt_bool_t) mpf_rtp_stream_modify(mpf_audio_stream_t *stream, mpf_rtp_stream_descriptor_t *descriptor); - -APT_END_EXTERN_C - -#endif /* MPF_RTP_STREAM_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_rtp_termination_factory.h b/libs/unimrcp/libs/mpf/include/mpf_rtp_termination_factory.h deleted file mode 100644 index f639f261b9..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_rtp_termination_factory.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_rtp_termination_factory.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_RTP_TERMINATION_FACTORY_H -#define MPF_RTP_TERMINATION_FACTORY_H - -/** - * @file mpf_rtp_termination_factory.h - * @brief MPF RTP Termination Factory - */ - -#include "mpf_termination_factory.h" -#include "mpf_rtp_descriptor.h" - -APT_BEGIN_EXTERN_C - -/** - * Create RTP termination factory. - */ -MPF_DECLARE(mpf_termination_factory_t*) mpf_rtp_termination_factory_create( - mpf_rtp_config_t *rtp_config, - apr_pool_t *pool); - - -APT_END_EXTERN_C - -#endif /* MPF_RTP_TERMINATION_FACTORY_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_scheduler.h b/libs/unimrcp/libs/mpf/include/mpf_scheduler.h deleted file mode 100644 index fe8e79af46..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_scheduler.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_scheduler.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_SCHEDULER_H -#define MPF_SCHEDULER_H - -/** - * @file mpf_scheduler.h - * @brief MPF Scheduler (High Resolution Clock for Media Processing and Timer) - */ - -#include "mpf_types.h" - -APT_BEGIN_EXTERN_C - -/** Prototype of scheduler callback */ -typedef void (*mpf_scheduler_proc_f)(mpf_scheduler_t *scheduler, void *obj); - -/** Create scheduler */ -MPF_DECLARE(mpf_scheduler_t*) mpf_scheduler_create(apr_pool_t *pool); - -/** Destroy scheduler */ -MPF_DECLARE(void) mpf_scheduler_destroy(mpf_scheduler_t *scheduler); - -/** Set media processing clock */ -MPF_DECLARE(apt_bool_t) mpf_scheduler_media_clock_set( - mpf_scheduler_t *scheduler, - unsigned long resolution, - mpf_scheduler_proc_f proc, - void *obj); - -/** Set timer clock */ -MPF_DECLARE(apt_bool_t) mpf_scheduler_timer_clock_set( - mpf_scheduler_t *scheduler, - unsigned long resolution, - mpf_scheduler_proc_f proc, - void *obj); - -/** Set scheduler rate (n times faster than real-time) */ -MPF_DECLARE(apt_bool_t) mpf_scheduler_rate_set( - mpf_scheduler_t *scheduler, - unsigned long rate); - -/** Start scheduler */ -MPF_DECLARE(apt_bool_t) mpf_scheduler_start(mpf_scheduler_t *scheduler); - -/** Stop scheduler */ -MPF_DECLARE(apt_bool_t) mpf_scheduler_stop(mpf_scheduler_t *scheduler); - - -APT_END_EXTERN_C - -#endif /* MPF_SCHEDULER_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_stream.h b/libs/unimrcp/libs/mpf/include/mpf_stream.h deleted file mode 100644 index 33276aa7b7..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_stream.h +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_stream.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_STREAM_H -#define MPF_STREAM_H - -/** - * @file mpf_stream.h - * @brief MPF Bidirectional Stream - */ - -#include "mpf_types.h" -#include "mpf_frame.h" -#include "mpf_stream_descriptor.h" -#include "mpf_codec.h" -#include "apt_text_stream.h" - -APT_BEGIN_EXTERN_C - -/** Declaration of virtual table of audio stream */ -typedef struct mpf_audio_stream_vtable_t mpf_audio_stream_vtable_t; - -/** Audio stream */ -struct mpf_audio_stream_t { - /** External object */ - void *obj; - /** Table of virtual methods */ - const mpf_audio_stream_vtable_t *vtable; - /** Back pointer */ - mpf_termination_t *termination; - - /** Stream capabilities */ - const mpf_stream_capabilities_t *capabilities; - - /** Stream direction send/receive (bitmask of mpf_stream_direction_e) */ - mpf_stream_direction_e direction; - /** Rx codec descriptor */ - mpf_codec_descriptor_t *rx_descriptor; - /** Rx event descriptor */ - mpf_codec_descriptor_t *rx_event_descriptor; - /** Tx codec descriptor */ - mpf_codec_descriptor_t *tx_descriptor; - /** Tx event descriptor */ - mpf_codec_descriptor_t *tx_event_descriptor; -}; - -/** Video stream */ -struct mpf_video_stream_t { - /** Back pointer */ - mpf_termination_t *termination; - /** Stream direction send/receive (bitmask of mpf_stream_direction_e) */ - mpf_stream_direction_e direction; -}; - -/** Table of audio stream virtual methods */ -struct mpf_audio_stream_vtable_t { - /** Virtual destroy method */ - apt_bool_t (*destroy)(mpf_audio_stream_t *stream); - - /** Virtual open receiver method */ - apt_bool_t (*open_rx)(mpf_audio_stream_t *stream, mpf_codec_t *codec); - /** Virtual close receiver method */ - apt_bool_t (*close_rx)(mpf_audio_stream_t *stream); - /** Virtual read frame method */ - apt_bool_t (*read_frame)(mpf_audio_stream_t *stream, mpf_frame_t *frame); - - /** Virtual open transmitter method */ - apt_bool_t (*open_tx)(mpf_audio_stream_t *stream, mpf_codec_t *codec); - /** Virtual close transmitter method */ - apt_bool_t (*close_tx)(mpf_audio_stream_t *stream); - /** Virtual write frame method */ - apt_bool_t (*write_frame)(mpf_audio_stream_t *stream, const mpf_frame_t *frame); - - /** Virtual trace method */ - void (*trace)(mpf_audio_stream_t *stream, mpf_stream_direction_e direction, apt_text_stream_t *output); -}; - -/** Create audio stream */ -MPF_DECLARE(mpf_audio_stream_t*) mpf_audio_stream_create(void *obj, const mpf_audio_stream_vtable_t *vtable, const mpf_stream_capabilities_t *capabilities, apr_pool_t *pool); - -/** Validate audio stream receiver */ -MPF_DECLARE(apt_bool_t) mpf_audio_stream_rx_validate( - mpf_audio_stream_t *stream, - const mpf_codec_descriptor_t *descriptor, - const mpf_codec_descriptor_t *event_descriptor, - apr_pool_t *pool); - -/** Validate audio stream transmitter */ -MPF_DECLARE(apt_bool_t) mpf_audio_stream_tx_validate( - mpf_audio_stream_t *stream, - const mpf_codec_descriptor_t *descriptor, - const mpf_codec_descriptor_t *event_descriptor, - apr_pool_t *pool); - -/** Destroy audio stream */ -static APR_INLINE apt_bool_t mpf_audio_stream_destroy(mpf_audio_stream_t *stream) -{ - if(stream->vtable->destroy) - return stream->vtable->destroy(stream); - return TRUE; -} - -/** Open audio stream receiver */ -static APR_INLINE apt_bool_t mpf_audio_stream_rx_open(mpf_audio_stream_t *stream, mpf_codec_t *codec) -{ - if(stream->vtable->open_rx) - return stream->vtable->open_rx(stream,codec); - return TRUE; -} - -/** Close audio stream receiver */ -static APR_INLINE apt_bool_t mpf_audio_stream_rx_close(mpf_audio_stream_t *stream) -{ - if(stream->vtable->close_rx) - return stream->vtable->close_rx(stream); - return TRUE; -} - -/** Read frame */ -static APR_INLINE apt_bool_t mpf_audio_stream_frame_read(mpf_audio_stream_t *stream, mpf_frame_t *frame) -{ - if(stream->vtable->read_frame) - return stream->vtable->read_frame(stream,frame); - return TRUE; -} - -/** Open audio stream transmitter */ -static APR_INLINE apt_bool_t mpf_audio_stream_tx_open(mpf_audio_stream_t *stream, mpf_codec_t *codec) -{ - if(stream->vtable->open_tx) - return stream->vtable->open_tx(stream,codec); - return TRUE; -} - -/** Close audio stream transmitter */ -static APR_INLINE apt_bool_t mpf_audio_stream_tx_close(mpf_audio_stream_t *stream) -{ - if(stream->vtable->close_tx) - return stream->vtable->close_tx(stream); - return TRUE; -} - -/** Write frame */ -static APR_INLINE apt_bool_t mpf_audio_stream_frame_write(mpf_audio_stream_t *stream, const mpf_frame_t *frame) -{ - if(stream->vtable->write_frame) - return stream->vtable->write_frame(stream,frame); - return TRUE; -} - -/** Trace media path */ -MPF_DECLARE(void) mpf_audio_stream_trace(mpf_audio_stream_t *stream, mpf_stream_direction_e direction, apt_text_stream_t *output); - -APT_END_EXTERN_C - -#endif /* MPF_STREAM_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_stream_descriptor.h b/libs/unimrcp/libs/mpf/include/mpf_stream_descriptor.h deleted file mode 100644 index d91f5166eb..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_stream_descriptor.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_stream_descriptor.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_STREAM_DESCRIPTOR_H -#define MPF_STREAM_DESCRIPTOR_H - -/** - * @file mpf_stream_descriptor.h - * @brief MPF Stream Descriptor - */ - -#include "mpf_codec_descriptor.h" - -APT_BEGIN_EXTERN_C - -/** Stream capabilities declaration */ -typedef struct mpf_stream_capabilities_t mpf_stream_capabilities_t; - -/** Stream directions (none, send, receive, duplex) */ -typedef enum { - STREAM_DIRECTION_NONE = 0x0, /**< none */ - STREAM_DIRECTION_SEND = 0x1, /**< send (sink) */ - STREAM_DIRECTION_RECEIVE = 0x2, /**< receive (source) */ - - STREAM_DIRECTION_DUPLEX = STREAM_DIRECTION_SEND | STREAM_DIRECTION_RECEIVE /**< duplex */ -} mpf_stream_direction_e; - - -/** Stream capabilities */ -struct mpf_stream_capabilities_t { - /** Supported directions either send, receive or bidirectional stream (bitmask of mpf_stream_direction_e) */ - mpf_stream_direction_e direction; - /** Codec capabilities (supported codecs and named events) */ - mpf_codec_capabilities_t codecs; -}; - -/** Create stream capabilities */ -MPF_DECLARE(mpf_stream_capabilities_t*) mpf_stream_capabilities_create(mpf_stream_direction_e directions, apr_pool_t *pool); - -/** Create source stream capabilities */ -static APR_INLINE mpf_stream_capabilities_t* mpf_source_stream_capabilities_create(apr_pool_t *pool) -{ - return mpf_stream_capabilities_create(STREAM_DIRECTION_RECEIVE,pool); -} - -/** Create sink stream capabilities */ -static APR_INLINE mpf_stream_capabilities_t* mpf_sink_stream_capabilities_create(apr_pool_t *pool) -{ - return mpf_stream_capabilities_create(STREAM_DIRECTION_SEND,pool); -} - -/** Clone stream capabilities */ -MPF_DECLARE(mpf_stream_capabilities_t*) mpf_stream_capabilities_clone(const mpf_stream_capabilities_t *src_capabilities, apr_pool_t *pool); - -/** Merge stream capabilities */ -MPF_DECLARE(apt_bool_t) mpf_stream_capabilities_merge(mpf_stream_capabilities_t *capabilities, const mpf_stream_capabilities_t *src_capabilities, apr_pool_t *pool); - - -/** Get reverse direction */ -static APR_INLINE mpf_stream_direction_e mpf_stream_reverse_direction_get(mpf_stream_direction_e direction) -{ - mpf_stream_direction_e rev_direction = direction; - if(rev_direction == STREAM_DIRECTION_SEND) { - rev_direction = STREAM_DIRECTION_RECEIVE; - } - else if(rev_direction == STREAM_DIRECTION_RECEIVE) { - rev_direction = STREAM_DIRECTION_SEND; - } - return rev_direction; -} - - -APT_END_EXTERN_C - -#endif /* MPF_STREAM_DESCRIPTOR_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_termination.h b/libs/unimrcp/libs/mpf/include/mpf_termination.h deleted file mode 100644 index 6d45aeeddb..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_termination.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_termination.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_TERMINATION_H -#define MPF_TERMINATION_H - -/** - * @file mpf_termination.h - * @brief MPF Termination - */ - -#include "mpf_types.h" -#include "apt_timer_queue.h" - -APT_BEGIN_EXTERN_C - -/** Prototype of termination event handler */ -typedef apt_bool_t (*mpf_termination_event_handler_f)(mpf_termination_t *termination, int event_id, void *descriptor); - -/** Termination vtable declaration */ -typedef struct mpf_termination_vtable_t mpf_termination_vtable_t; - -/** Table of termination virtual methods */ -struct mpf_termination_vtable_t { - /** Virtual termination destroy method */ - apt_bool_t (*destroy)(mpf_termination_t *termination); - - /** Virtual termination add method */ - apt_bool_t (*add)(mpf_termination_t *termination, void *descriptor); - /** Virtual termination modify method */ - apt_bool_t (*modify)(mpf_termination_t *termination, void *descriptor); - /** Virtual termination subtract method */ - apt_bool_t (*subtract)(mpf_termination_t *termination); -}; - - -/** MPF Termination */ -struct mpf_termination_t { - /** Pool to allocate memory from */ - apr_pool_t *pool; - /** Informative name used for debugging */ - const char *name; - /** External object */ - void *obj; - /** Media engine to send events to */ - void *media_engine; - /** Event handler */ - mpf_termination_event_handler_f event_handler; - /** Codec manager */ - const mpf_codec_manager_t *codec_manager; - /** Timer queue */ - apt_timer_queue_t *timer_queue; - /** Termination factory entire termination created by */ - mpf_termination_factory_t *termination_factory; - /** Table of virtual methods */ - const mpf_termination_vtable_t *vtable; - /** Slot in context */ - apr_size_t slot; - - /** Audio stream */ - mpf_audio_stream_t *audio_stream; - /** Video stream */ - mpf_video_stream_t *video_stream; -}; - -/** - * Create MPF termination base. - * @param termination_factory the termination factory - * @param obj the external object associated with termination - * @param vtable the table of virtual functions of termination - * @param audio_stream the audio stream - * @param video_stream the video stream - * @param pool the pool to allocate memory from - */ -MPF_DECLARE(mpf_termination_t*) mpf_termination_base_create( - mpf_termination_factory_t *termination_factory, - void *obj, - const mpf_termination_vtable_t *vtable, - mpf_audio_stream_t *audio_stream, - mpf_video_stream_t *video_stream, - apr_pool_t *pool); - -/** - * Add MPF termination. - * @param termination the termination to add - * @param descriptor the termination specific descriptor - */ -MPF_DECLARE(apt_bool_t) mpf_termination_add(mpf_termination_t *termination, void *descriptor); - -/** - * Modify MPF termination. - * @param termination the termination to modify - * @param descriptor the termination specific descriptor - */ -MPF_DECLARE(apt_bool_t) mpf_termination_modify(mpf_termination_t *termination, void *descriptor); - -/** - * Subtract MPF termination. - * @param termination the termination to subtract - */ -MPF_DECLARE(apt_bool_t) mpf_termination_subtract(mpf_termination_t *termination); - - -APT_END_EXTERN_C - -#endif /* MPF_TERMINATION_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_termination_factory.h b/libs/unimrcp/libs/mpf/include/mpf_termination_factory.h deleted file mode 100644 index 08d46fc64f..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_termination_factory.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_termination_factory.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_TERMINATION_FACTORY_H -#define MPF_TERMINATION_FACTORY_H - -/** - * @file mpf_termination_factory.h - * @brief MPF Termination Factory - */ - -#include "mpf_types.h" - -APT_BEGIN_EXTERN_C - -/** MPF termination factory */ -struct mpf_termination_factory_t { - /** Virtual create */ - mpf_termination_t* (*create_termination)(mpf_termination_factory_t *factory, void *obj, apr_pool_t *pool); - /** Virtual assign engine */ - apt_bool_t (*assign_engine)(mpf_termination_factory_t *factory, mpf_engine_t *media_engine); -}; - -/** - * Assign media engine to termination factory. - * @param termination_factory the termination factory to assign media engine to - * @param media_engine the media engine to assign - */ -MPF_DECLARE(apt_bool_t) mpf_termination_factory_engine_assign( - mpf_termination_factory_t *termination_factory, - mpf_engine_t *media_engine); - -/** - * Create MPF termination from termination factory. - * @param termination_factory the termination factory to create termination from - * @param obj the external object associated with termination - * @param pool the pool to allocate memory from - */ -MPF_DECLARE(mpf_termination_t*) mpf_termination_create( - mpf_termination_factory_t *termination_factory, - void *obj, - apr_pool_t *pool); - -/** - * Create raw MPF termination. - * @param obj the external object associated with termination - * @param audio_stream the audio stream of the termination - * @param video_stream the video stream of the termination - * @param pool the pool to allocate memory from - */ -MPF_DECLARE(mpf_termination_t*) mpf_raw_termination_create( - void *obj, - mpf_audio_stream_t *audio_stream, - mpf_video_stream_t *video_stream, - apr_pool_t *pool); - -/** - * Destroy MPF termination. - * @param termination the termination to destroy - */ -MPF_DECLARE(apt_bool_t) mpf_termination_destroy(mpf_termination_t *termination); - -/** - * Get termination name. - * @param termination the termination to get name of - */ -MPF_DECLARE(const char*) mpf_termination_name_get(const mpf_termination_t *termination); - -/** - * Get associated object. - * @param termination the termination to get object from - */ -MPF_DECLARE(void*) mpf_termination_object_get(const mpf_termination_t *termination); - -/** - * Get audio stream. - * @param termination the termination to get audio stream from - */ -MPF_DECLARE(mpf_audio_stream_t*) mpf_termination_audio_stream_get(const mpf_termination_t *termination); - -/** - * Get video stream. - * @param termination the termination to get video stream from - */ -MPF_DECLARE(mpf_video_stream_t*) mpf_termination_video_stream_get(const mpf_termination_t *termination); - - -APT_END_EXTERN_C - -#endif /* MPF_TERMINATION_FACTORY_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_trace.h b/libs/unimrcp/libs/mpf/include/mpf_trace.h deleted file mode 100644 index 323cc034ba..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_trace.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: apt_log.h 1792 2011-01-10 21:08:52Z achaloyan $ - */ - -#ifndef MPF_TRACE_H -#define MPF_TRACE_H - -/** - * @file mpf_trace.h - * @brief MPF Tracer - */ - -#include -#include "mpf.h" - -APT_BEGIN_EXTERN_C - -#ifdef WIN32 -static void mpf_debug_output_trace(const char* format, ...) -{ - char buf[1024]; - va_list arg; - va_start(arg, format); - apr_vsnprintf(buf, sizeof(buf), format, arg); - va_end(arg); - - OutputDebugStringA(buf); -} -#else -static APR_INLINE void mpf_debug_output_trace() {} -#endif - -static APR_INLINE void mpf_null_trace() {} - -APT_END_EXTERN_C - -#endif /* MPF_TRACE_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_types.h b/libs/unimrcp/libs/mpf/include/mpf_types.h deleted file mode 100644 index 3b8637eaba..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_types.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_types.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_TYPES_H -#define MPF_TYPES_H - -/** - * @file mpf_types.h - * @brief MPF Types Declarations - */ - -#include "mpf.h" - -APT_BEGIN_EXTERN_C - -/** Opaque MPF engine declaration */ -typedef struct mpf_engine_t mpf_engine_t; - -/** Opaque MPF engine factory declaration */ -typedef struct mpf_engine_factory_t mpf_engine_factory_t; - -/** Opaque MPF scheduler declaration */ -typedef struct mpf_scheduler_t mpf_scheduler_t; - -/** Opaque codec manager declaration */ -typedef struct mpf_codec_manager_t mpf_codec_manager_t; - -/** Opaque MPF context declaration */ -typedef struct mpf_context_t mpf_context_t; - -/** Opaque MPF termination declaration */ -typedef struct mpf_termination_t mpf_termination_t; - -/** Opaque MPF termination factory declaration */ -typedef struct mpf_termination_factory_t mpf_termination_factory_t; - -/** Opaque MPF audio stream declaration */ -typedef struct mpf_audio_stream_t mpf_audio_stream_t; - -/** Opaque MPF video stream declaration */ -typedef struct mpf_video_stream_t mpf_video_stream_t; - - -APT_END_EXTERN_C - -#endif /* MPF_TYPES_H */ diff --git a/libs/unimrcp/libs/mpf/mpf.2010.vcxproj.filters b/libs/unimrcp/libs/mpf/mpf.2010.vcxproj.filters deleted file mode 100644 index d79e3f31a4..0000000000 --- a/libs/unimrcp/libs/mpf/mpf.2010.vcxproj.filters +++ /dev/null @@ -1,236 +0,0 @@ - - - - - {3d69fc35-a195-4376-9508-ef77d7b27e71} - - - {81e2eace-c57a-4135-92cd-cc3575dfb088} - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {6fc3533a-b688-477d-914d-e0ffb15aa9a9} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - codecs\g711 - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - - - codecs\g711 - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mpf/mpf.2017.vcxproj b/libs/unimrcp/libs/mpf/mpf.2017.vcxproj deleted file mode 100644 index 4cd900b2df..0000000000 --- a/libs/unimrcp/libs/mpf/mpf.2017.vcxproj +++ /dev/null @@ -1,201 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - mpf - {B5A00BFA-6083-4FAE-A097-71642D6473B5} - mpf - Win32Proj - - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(SolutionDir)$(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - - - - codecs;%(AdditionalIncludeDirectories) - APT_STATIC_LIB;MPF_STATIC_LIB;%(PreprocessorDefinitions) - - - - - X64 - - - codecs;%(AdditionalIncludeDirectories) - APT_STATIC_LIB;MPF_STATIC_LIB;%(PreprocessorDefinitions) - false - ProgramDatabase - - - - - codecs;%(AdditionalIncludeDirectories) - APT_STATIC_LIB;MPF_STATIC_LIB;%(PreprocessorDefinitions) - - - - - X64 - - - codecs;%(AdditionalIncludeDirectories) - APT_STATIC_LIB;MPF_STATIC_LIB;%(PreprocessorDefinitions) - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {f6c55d93-b927-4483-bb69-15aef3dd2dff} - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mpf/mpf.vcproj b/libs/unimrcp/libs/mpf/mpf.vcproj deleted file mode 100644 index 043486d580..0000000000 --- a/libs/unimrcp/libs/mpf/mpf.vcproj +++ /dev/null @@ -1,552 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/libs/mpf/mpf.vcxproj b/libs/unimrcp/libs/mpf/mpf.vcxproj deleted file mode 100644 index 6bbb3f5371..0000000000 --- a/libs/unimrcp/libs/mpf/mpf.vcxproj +++ /dev/null @@ -1,200 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {B5A00BFA-6083-4FAE-A097-71642D6473B5} - mpf - Win32Proj - - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - codecs;%(AdditionalIncludeDirectories) - - - - - codecs;%(AdditionalIncludeDirectories) - - - - - X64 - - - codecs;%(AdditionalIncludeDirectories) - ProgramDatabase - - - - - X64 - - - codecs;%(AdditionalIncludeDirectories) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {13deeca0-bdd4-4744-a1a2-8eb0a44df3d2} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mpf/mpf.vcxproj.filters b/libs/unimrcp/libs/mpf/mpf.vcxproj.filters deleted file mode 100644 index 16ecf0e62f..0000000000 --- a/libs/unimrcp/libs/mpf/mpf.vcxproj.filters +++ /dev/null @@ -1,239 +0,0 @@ - - - - - {33a3a10a-4697-4720-8c24-20340757326e} - - - {148f1b8f-859b-4dd9-96b0-0474d7bb875b} - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {35011b8a-6a42-4e9f-b55b-a84db1d929a8} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - codecs\g711 - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - - - codecs\g711 - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mpf/src/mpf_activity_detector.c b/libs/unimrcp/libs/mpf/src/mpf_activity_detector.c deleted file mode 100644 index 09b1a813a3..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_activity_detector.c +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_activity_detector.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mpf_activity_detector.h" -#include "apt_log.h" - -/** Detector states */ -typedef enum { - DETECTOR_STATE_INACTIVITY, /**< inactivity detected */ - DETECTOR_STATE_ACTIVITY_TRANSITION, /**< activity detection is in-progress */ - DETECTOR_STATE_ACTIVITY, /**< activity detected */ - DETECTOR_STATE_INACTIVITY_TRANSITION /**< inactivity detection is in-progress */ -} mpf_detector_state_e; - -/** Activity detector */ -struct mpf_activity_detector_t { - /* voice activity (silence) level threshold */ - apr_size_t level_threshold; - - /* period of activity required to complete transition to active state */ - apr_size_t speech_timeout; - /* period of inactivity required to complete transition to inactive state */ - apr_size_t silence_timeout; - /* noinput timeout */ - apr_size_t noinput_timeout; - - /* current state */ - mpf_detector_state_e state; - /* duration spent in current state */ - apr_size_t duration; -}; - -/** Create activity detector */ -MPF_DECLARE(mpf_activity_detector_t*) mpf_activity_detector_create(apr_pool_t *pool) -{ - mpf_activity_detector_t *detector = apr_palloc(pool,sizeof(mpf_activity_detector_t)); - detector->level_threshold = 2; /* 0 .. 255 */ - detector->speech_timeout = 300; /* 0.3 s */ - detector->silence_timeout = 300; /* 0.3 s */ - detector->noinput_timeout = 5000; /* 5 s */ - detector->duration = 0; - detector->state = DETECTOR_STATE_INACTIVITY; - return detector; -} - -/** Reset activity detector */ -MPF_DECLARE(void) mpf_activity_detector_reset(mpf_activity_detector_t *detector) -{ - detector->duration = 0; - detector->state = DETECTOR_STATE_INACTIVITY; -} - -/** Set threshold of voice activity (silence) level */ -MPF_DECLARE(void) mpf_activity_detector_level_set(mpf_activity_detector_t *detector, apr_size_t level_threshold) -{ - detector->level_threshold = level_threshold; -} - -/** Set noinput timeout */ -MPF_DECLARE(void) mpf_activity_detector_noinput_timeout_set(mpf_activity_detector_t *detector, apr_size_t noinput_timeout) -{ - detector->noinput_timeout = noinput_timeout; -} - -/** Set timeout required to trigger speech (transition from inactive to active state) */ -MPF_DECLARE(void) mpf_activity_detector_speech_timeout_set(mpf_activity_detector_t *detector, apr_size_t speech_timeout) -{ - detector->speech_timeout = speech_timeout; -} - -/** Set timeout required to trigger silence (transition from active to inactive state) */ -MPF_DECLARE(void) mpf_activity_detector_silence_timeout_set(mpf_activity_detector_t *detector, apr_size_t silence_timeout) -{ - detector->silence_timeout = silence_timeout; -} - - -static APR_INLINE void mpf_activity_detector_state_change(mpf_activity_detector_t *detector, mpf_detector_state_e state) -{ - detector->duration = 0; - detector->state = state; -} - -static apr_size_t mpf_activity_detector_level_calculate(const mpf_frame_t *frame) -{ - apr_size_t sum = 0; - apr_size_t count = frame->codec_frame.size/2; - const apr_int16_t *cur = frame->codec_frame.buffer; - const apr_int16_t *end = cur + count; - - for(; cur < end; cur++) { - if(*cur < 0) { - sum -= *cur; - } - else { - sum += *cur; - } - } - - return sum / count; -} - -/** Process current frame */ -MPF_DECLARE(mpf_detector_event_e) mpf_activity_detector_process(mpf_activity_detector_t *detector, const mpf_frame_t *frame) -{ - mpf_detector_event_e det_event = MPF_DETECTOR_EVENT_NONE; - apr_size_t level = 0; - if((frame->type & MEDIA_FRAME_TYPE_AUDIO) == MEDIA_FRAME_TYPE_AUDIO) { - /* first, calculate current activity level of processed frame */ - level = mpf_activity_detector_level_calculate(frame); -#if 0 - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Activity Detector [%"APR_SIZE_T_FMT"]",level); -#endif - } - - if(detector->state == DETECTOR_STATE_INACTIVITY) { - if(level >= detector->level_threshold) { - /* start to detect activity */ - mpf_activity_detector_state_change(detector,DETECTOR_STATE_ACTIVITY_TRANSITION); - } - else { - detector->duration += CODEC_FRAME_TIME_BASE; - if(detector->duration >= detector->noinput_timeout) { - /* detected noinput */ - det_event = MPF_DETECTOR_EVENT_NOINPUT; - } - } - } - else if(detector->state == DETECTOR_STATE_ACTIVITY_TRANSITION) { - if(level >= detector->level_threshold) { - detector->duration += CODEC_FRAME_TIME_BASE; - if(detector->duration >= detector->speech_timeout) { - /* finally detected activity */ - det_event = MPF_DETECTOR_EVENT_ACTIVITY; - mpf_activity_detector_state_change(detector,DETECTOR_STATE_ACTIVITY); - } - } - else { - /* fallback to inactivity */ - mpf_activity_detector_state_change(detector,DETECTOR_STATE_INACTIVITY); - } - } - else if(detector->state == DETECTOR_STATE_ACTIVITY) { - if(level >= detector->level_threshold) { - detector->duration += CODEC_FRAME_TIME_BASE; - } - else { - /* start to detect inactivity */ - mpf_activity_detector_state_change(detector,DETECTOR_STATE_INACTIVITY_TRANSITION); - } - } - else if(detector->state == DETECTOR_STATE_INACTIVITY_TRANSITION) { - if(level >= detector->level_threshold) { - /* fallback to activity */ - mpf_activity_detector_state_change(detector,DETECTOR_STATE_ACTIVITY); - } - else { - detector->duration += CODEC_FRAME_TIME_BASE; - if(detector->duration >= detector->silence_timeout) { - /* detected inactivity */ - det_event = MPF_DETECTOR_EVENT_INACTIVITY; - mpf_activity_detector_state_change(detector,DETECTOR_STATE_INACTIVITY); - } - } - } - - return det_event; -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_audio_file_stream.c b/libs/unimrcp/libs/mpf/src/mpf_audio_file_stream.c deleted file mode 100644 index 5c168ebf00..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_audio_file_stream.c +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_audio_file_stream.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mpf_audio_file_stream.h" -#include "mpf_termination.h" -#include "mpf_frame.h" -#include "mpf_codec_manager.h" -#include "apt_log.h" - -/** Audio file stream */ -typedef struct mpf_audio_file_stream_t mpf_audio_file_stream_t; -struct mpf_audio_file_stream_t { - mpf_audio_stream_t *audio_stream; - - FILE *read_handle; - FILE *write_handle; - - apt_bool_t eof; - apr_size_t max_write_size; - apr_size_t cur_write_size; -}; - -static APR_INLINE void mpf_audio_file_event_raise(mpf_audio_stream_t *stream, int event_id, void *descriptor); - - -static apt_bool_t mpf_audio_file_destroy(mpf_audio_stream_t *stream) -{ - mpf_audio_file_stream_t *file_stream = stream->obj; - if(file_stream->read_handle) { - fclose(file_stream->read_handle); - file_stream->read_handle = NULL; - } - if(file_stream->write_handle) { - fclose(file_stream->write_handle); - file_stream->write_handle = NULL; - } - return TRUE; -} - -static apt_bool_t mpf_audio_file_reader_open(mpf_audio_stream_t *stream, mpf_codec_t *codec) -{ - return TRUE; -} - -static apt_bool_t mpf_audio_file_reader_close(mpf_audio_stream_t *stream) -{ - return TRUE; -} - -static apt_bool_t mpf_audio_file_frame_read(mpf_audio_stream_t *stream, mpf_frame_t *frame) -{ - mpf_audio_file_stream_t *file_stream = stream->obj; - if(file_stream->read_handle && file_stream->eof == FALSE) { - if(fread(frame->codec_frame.buffer,1,frame->codec_frame.size,file_stream->read_handle) == frame->codec_frame.size) { - frame->type = MEDIA_FRAME_TYPE_AUDIO; - } - else { - file_stream->eof = TRUE; - mpf_audio_file_event_raise(stream,0,NULL); - } - } - return TRUE; -} - - -static apt_bool_t mpf_audio_file_writer_open(mpf_audio_stream_t *stream, mpf_codec_t *codec) -{ - return TRUE; -} - -static apt_bool_t mpf_audio_file_writer_close(mpf_audio_stream_t *stream) -{ - return TRUE; -} - -static apt_bool_t mpf_audio_file_frame_write(mpf_audio_stream_t *stream, const mpf_frame_t *frame) -{ - mpf_audio_file_stream_t *file_stream = stream->obj; - if(file_stream->write_handle && - (!file_stream->max_write_size || file_stream->cur_write_size < file_stream->max_write_size)) { - file_stream->cur_write_size += fwrite( - frame->codec_frame.buffer, - 1, - frame->codec_frame.size, - file_stream->write_handle); - if(file_stream->cur_write_size >= file_stream->max_write_size) { - mpf_audio_file_event_raise(stream,0,NULL); - } - } - return TRUE; -} - -static const mpf_audio_stream_vtable_t vtable = { - mpf_audio_file_destroy, - mpf_audio_file_reader_open, - mpf_audio_file_reader_close, - mpf_audio_file_frame_read, - mpf_audio_file_writer_open, - mpf_audio_file_writer_close, - mpf_audio_file_frame_write, - NULL /* mpf_audio_file_trace */ -}; - -MPF_DECLARE(mpf_audio_stream_t*) mpf_file_stream_create(mpf_termination_t *termination, apr_pool_t *pool) -{ - mpf_audio_file_stream_t *file_stream = apr_palloc(pool,sizeof(mpf_audio_file_stream_t)); - mpf_stream_capabilities_t *capabilities = mpf_stream_capabilities_create(STREAM_DIRECTION_DUPLEX,pool); - mpf_audio_stream_t *audio_stream = mpf_audio_stream_create(file_stream,&vtable,capabilities,pool); - if(!audio_stream) { - return NULL; - } - audio_stream->termination = termination; - - file_stream->audio_stream = audio_stream; - file_stream->write_handle = NULL; - file_stream->read_handle = NULL; - file_stream->eof = FALSE; - file_stream->max_write_size = 0; - file_stream->cur_write_size = 0; - - return audio_stream; -} - -MPF_DECLARE(apt_bool_t) mpf_file_stream_modify(mpf_audio_stream_t *stream, mpf_audio_file_descriptor_t *descriptor) -{ - mpf_audio_file_stream_t *file_stream = stream->obj; - if(descriptor->mask & FILE_READER) { - if(file_stream->read_handle) { - fclose(file_stream->read_handle); - } - file_stream->read_handle = descriptor->read_handle; - file_stream->eof = FALSE; - stream->direction |= FILE_READER; - - stream->rx_descriptor = descriptor->codec_descriptor; - } - if(descriptor->mask & FILE_WRITER) { - if(file_stream->write_handle) { - fclose(file_stream->write_handle); - } - file_stream->write_handle = descriptor->write_handle; - file_stream->max_write_size = descriptor->max_write_size; - file_stream->cur_write_size = 0; - stream->direction |= FILE_WRITER; - - stream->tx_descriptor = descriptor->codec_descriptor; - } - return TRUE; -} - -static APR_INLINE void mpf_audio_file_event_raise(mpf_audio_stream_t *stream, int event_id, void *descriptor) -{ - if(stream->termination->event_handler) { - stream->termination->event_handler(stream->termination,event_id,descriptor); - } -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_bridge.c b/libs/unimrcp/libs/mpf/src/mpf_bridge.c deleted file mode 100644 index 0daf11caee..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_bridge.c +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_bridge.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mpf_bridge.h" -#include "mpf_encoder.h" -#include "mpf_decoder.h" -#include "mpf_resampler.h" -#include "mpf_codec_manager.h" -#include "apt_log.h" - -typedef struct mpf_bridge_t mpf_bridge_t; - -/** MPF bridge derived from MPF object */ -struct mpf_bridge_t { - /** MPF bridge base */ - mpf_object_t base; - /** Audio stream source */ - mpf_audio_stream_t *source; - /** Audio stream sink */ - mpf_audio_stream_t *sink; - /** Codec used in case of null bridge */ - mpf_codec_t *codec; - /** Media frame used to read data from source and write it to sink */ - mpf_frame_t frame; -}; - -static apt_bool_t mpf_bridge_process(mpf_object_t *object) -{ - mpf_bridge_t *bridge = (mpf_bridge_t*) object; - bridge->frame.type = MEDIA_FRAME_TYPE_NONE; - bridge->frame.marker = MPF_MARKER_NONE; - bridge->source->vtable->read_frame(bridge->source,&bridge->frame); - - if((bridge->frame.type & MEDIA_FRAME_TYPE_AUDIO) == 0) { - memset( bridge->frame.codec_frame.buffer, - 0, - bridge->frame.codec_frame.size); - } - - bridge->sink->vtable->write_frame(bridge->sink,&bridge->frame); - return TRUE; -} - -static apt_bool_t mpf_null_bridge_process(mpf_object_t *object) -{ - mpf_bridge_t *bridge = (mpf_bridge_t*) object; - bridge->frame.type = MEDIA_FRAME_TYPE_NONE; - bridge->frame.marker = MPF_MARKER_NONE; - bridge->source->vtable->read_frame(bridge->source,&bridge->frame); - - if((bridge->frame.type & MEDIA_FRAME_TYPE_AUDIO) == 0) { - /* generate silence frame */ - mpf_codec_initialize(bridge->codec,&bridge->frame.codec_frame); - } - - bridge->sink->vtable->write_frame(bridge->sink,&bridge->frame); - return TRUE; -} - -static void mpf_bridge_trace(mpf_object_t *object) -{ - mpf_bridge_t *bridge = (mpf_bridge_t*) object; - char buf[1024]; - apr_size_t offset; - - apt_text_stream_t output; - apt_text_stream_init(&output,buf,sizeof(buf)-1); - - mpf_audio_stream_trace(bridge->source,STREAM_DIRECTION_RECEIVE,&output); - - offset = output.pos - output.text.buf; - output.pos += apr_snprintf(output.pos, output.text.length - offset, - "->Bridge->"); - - mpf_audio_stream_trace(bridge->sink,STREAM_DIRECTION_SEND,&output); - - *output.pos = '\0'; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Media Path %s %s",object->name,output.text.buf); -} - - -static apt_bool_t mpf_bridge_destroy(mpf_object_t *object) -{ - mpf_bridge_t *bridge = (mpf_bridge_t*) object; - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Destroy Audio Bridge %s",object->name); - mpf_audio_stream_rx_close(bridge->source); - mpf_audio_stream_tx_close(bridge->sink); - return TRUE; -} - -static mpf_bridge_t* mpf_bridge_base_create(mpf_audio_stream_t *source, mpf_audio_stream_t *sink, const char *name, apr_pool_t *pool) -{ - mpf_bridge_t *bridge; - if(!source || !sink) { - return NULL; - } - - bridge = apr_palloc(pool,sizeof(mpf_bridge_t)); - bridge->source = source; - bridge->sink = sink; - bridge->codec = NULL; - mpf_object_init(&bridge->base,name); - bridge->base.destroy = mpf_bridge_destroy; - bridge->base.process = mpf_bridge_process; - bridge->base.trace = mpf_bridge_trace; - return bridge; -} - -static mpf_object_t* mpf_linear_bridge_create(mpf_audio_stream_t *source, mpf_audio_stream_t *sink, const mpf_codec_manager_t *codec_manager, const char *name, apr_pool_t *pool) -{ - mpf_codec_descriptor_t *descriptor; - apr_size_t frame_size; - mpf_bridge_t *bridge; - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Create Linear Audio Bridge %s",name); - bridge = mpf_bridge_base_create(source,sink,name,pool); - if(!bridge) { - return NULL; - } - - descriptor = source->rx_descriptor; - frame_size = mpf_codec_linear_frame_size_calculate(descriptor->sampling_rate,descriptor->channel_count); - bridge->frame.codec_frame.size = frame_size; - bridge->frame.codec_frame.buffer = apr_palloc(pool,frame_size); - - if(mpf_audio_stream_rx_open(source,NULL) == FALSE) { - return NULL; - } - if(mpf_audio_stream_tx_open(sink,NULL) == FALSE) { - mpf_audio_stream_rx_close(source); - return NULL; - } - return &bridge->base; -} - -static mpf_object_t* mpf_null_bridge_create(mpf_audio_stream_t *source, mpf_audio_stream_t *sink, const mpf_codec_manager_t *codec_manager, const char *name, apr_pool_t *pool) -{ - mpf_codec_t *codec; - apr_size_t frame_size; - mpf_bridge_t *bridge; - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Create Null Audio Bridge %s",name); - bridge = mpf_bridge_base_create(source,sink,name,pool); - if(!bridge) { - return NULL; - } - bridge->base.process = mpf_null_bridge_process; - - codec = mpf_codec_manager_codec_get(codec_manager,source->rx_descriptor,pool); - if(!codec) { - return NULL; - } - - frame_size = mpf_codec_frame_size_calculate(source->rx_descriptor,codec->attribs); - bridge->codec = codec; - bridge->frame.codec_frame.size = frame_size; - bridge->frame.codec_frame.buffer = apr_palloc(pool,frame_size); - - if(mpf_audio_stream_rx_open(source,codec) == FALSE) { - return NULL; - } - if(mpf_audio_stream_tx_open(sink,codec) == FALSE) { - mpf_audio_stream_rx_close(source); - return NULL; - } - return &bridge->base; -} - -MPF_DECLARE(mpf_object_t*) mpf_bridge_create( - mpf_audio_stream_t *source, - mpf_audio_stream_t *sink, - const mpf_codec_manager_t *codec_manager, - const char *name, - apr_pool_t *pool) -{ - if(!source || !sink) { - return NULL; - } - - if(mpf_audio_stream_rx_validate(source,sink->tx_descriptor,sink->tx_event_descriptor,pool) == FALSE || - mpf_audio_stream_tx_validate(sink,source->rx_descriptor,source->rx_event_descriptor,pool) == FALSE) { - return NULL; - } - - if(mpf_codec_descriptors_match(source->rx_descriptor,sink->tx_descriptor) == TRUE) { - return mpf_null_bridge_create(source,sink,codec_manager,name,pool); - } - - if(mpf_codec_lpcm_descriptor_match(source->rx_descriptor) == FALSE) { - mpf_codec_t *codec = mpf_codec_manager_codec_get(codec_manager,source->rx_descriptor,pool); - if(codec) { - /* set decoder before bridge */ - mpf_audio_stream_t *decoder = mpf_decoder_create(source,codec,pool); - source = decoder; - } - } - - if(mpf_codec_lpcm_descriptor_match(sink->tx_descriptor) == FALSE) { - mpf_codec_t *codec = mpf_codec_manager_codec_get(codec_manager,sink->tx_descriptor,pool); - if(codec) { - /* set encoder after bridge */ - mpf_audio_stream_t *encoder = mpf_encoder_create(sink,codec,pool); - sink = encoder; - } - } - - if(source->rx_descriptor->sampling_rate != sink->tx_descriptor->sampling_rate) { - /* set resampler before bridge */ - mpf_audio_stream_t *resampler = mpf_resampler_create(source,sink,pool); - if(!resampler) { - return NULL; - } - source = resampler; - } - - return mpf_linear_bridge_create(source,sink,codec_manager,name,pool); -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_buffer.c b/libs/unimrcp/libs/mpf/src/mpf_buffer.c deleted file mode 100644 index 8db46d0a91..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_buffer.c +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_buffer.c 2181 2014-09-14 04:29:38Z achaloyan@gmail.com $ - */ - -#ifdef WIN32 -#pragma warning(disable: 4127) -#endif -#include -#include "mpf_buffer.h" - -typedef struct mpf_chunk_t mpf_chunk_t; - -struct mpf_chunk_t { - APR_RING_ENTRY(mpf_chunk_t) link; - mpf_frame_t frame; -}; - -struct mpf_buffer_t { - APR_RING_HEAD(mpf_chunk_head_t, mpf_chunk_t) head; - mpf_chunk_t *cur_chunk; - apr_size_t remaining_chunk_size; - apr_thread_mutex_t *guard; - apr_pool_t *pool; - apr_size_t size; /* total size */ -}; - -mpf_buffer_t* mpf_buffer_create(apr_pool_t *pool) -{ - mpf_buffer_t *buffer = apr_palloc(pool,sizeof(mpf_buffer_t)); - buffer->pool = pool; - buffer->cur_chunk = NULL; - buffer->remaining_chunk_size = 0; - buffer->size = 0; - APR_RING_INIT(&buffer->head, mpf_chunk_t, link); - apr_thread_mutex_create(&buffer->guard,APR_THREAD_MUTEX_UNNESTED,pool); - return buffer; -} - -void mpf_buffer_destroy(mpf_buffer_t *buffer) -{ - if(buffer->guard) { - apr_thread_mutex_destroy(buffer->guard); - buffer->guard = NULL; - } -} - -apt_bool_t mpf_buffer_restart(mpf_buffer_t *buffer) -{ - apr_thread_mutex_lock(buffer->guard); - APR_RING_INIT(&buffer->head, mpf_chunk_t, link); - apr_thread_mutex_unlock(buffer->guard); - return TRUE; -} - -static APR_INLINE apt_bool_t mpf_buffer_chunk_write(mpf_buffer_t *buffer, mpf_chunk_t *chunk) -{ - APR_RING_INSERT_TAIL(&buffer->head,chunk,mpf_chunk_t,link); - return TRUE; -} - -static APR_INLINE mpf_chunk_t* mpf_buffer_chunk_read(mpf_buffer_t *buffer) -{ - mpf_chunk_t *chunk = NULL; - if(!APR_RING_EMPTY(&buffer->head,mpf_chunk_t,link)) { - chunk = APR_RING_FIRST(&buffer->head); - APR_RING_REMOVE(chunk,link); - } - return chunk; -} - -apt_bool_t mpf_buffer_audio_write(mpf_buffer_t *buffer, void *data, apr_size_t size) -{ - mpf_chunk_t *chunk; - apt_bool_t status; - apr_thread_mutex_lock(buffer->guard); - - chunk = apr_palloc(buffer->pool,sizeof(mpf_chunk_t)); - APR_RING_ELEM_INIT(chunk,link); - chunk->frame.codec_frame.buffer = apr_palloc(buffer->pool,size); - memcpy(chunk->frame.codec_frame.buffer,data,size); - chunk->frame.codec_frame.size = size; - chunk->frame.type = MEDIA_FRAME_TYPE_AUDIO; - status = mpf_buffer_chunk_write(buffer,chunk); - - buffer->size += size; - apr_thread_mutex_unlock(buffer->guard); - return status; -} - -apt_bool_t mpf_buffer_event_write(mpf_buffer_t *buffer, mpf_frame_type_e event_type) -{ - mpf_chunk_t *chunk; - apt_bool_t status; - apr_thread_mutex_lock(buffer->guard); - - chunk = apr_palloc(buffer->pool,sizeof(mpf_chunk_t)); - APR_RING_ELEM_INIT(chunk,link); - chunk->frame.codec_frame.buffer = NULL; - chunk->frame.codec_frame.size = 0; - chunk->frame.type = event_type; - status = mpf_buffer_chunk_write(buffer,chunk); - - apr_thread_mutex_unlock(buffer->guard); - return status; -} - -apt_bool_t mpf_buffer_frame_read(mpf_buffer_t *buffer, mpf_frame_t *media_frame) -{ - mpf_codec_frame_t *dest; - mpf_codec_frame_t *src; - apr_size_t remaining_frame_size = media_frame->codec_frame.size; - apr_thread_mutex_lock(buffer->guard); - do { - if(!buffer->cur_chunk) { - buffer->cur_chunk = mpf_buffer_chunk_read(buffer); - if(!buffer->cur_chunk) { - /* buffer is empty */ - break; - } - buffer->remaining_chunk_size = buffer->cur_chunk->frame.codec_frame.size; - } - - dest = &media_frame->codec_frame; - src = &buffer->cur_chunk->frame.codec_frame; - media_frame->type |= buffer->cur_chunk->frame.type; - if(remaining_frame_size < buffer->remaining_chunk_size) { - /* copy remaining_frame_size */ - memcpy( - (char*)dest->buffer + dest->size - remaining_frame_size, - (char*)src->buffer + src->size - buffer->remaining_chunk_size, - remaining_frame_size); - buffer->remaining_chunk_size -= remaining_frame_size; - buffer->size -= remaining_frame_size; - remaining_frame_size = 0; - } - else { - /* copy remaining_chunk_size and proceed to the next chunk */ - memcpy( - (char*)dest->buffer + dest->size - remaining_frame_size, - (char*)src->buffer + src->size - buffer->remaining_chunk_size, - buffer->remaining_chunk_size); - remaining_frame_size -= buffer->remaining_chunk_size; - buffer->size -= buffer->remaining_chunk_size; - buffer->remaining_chunk_size = 0; - buffer->cur_chunk = NULL; - } - } - while(remaining_frame_size); - - if(remaining_frame_size) { - apr_size_t offset = media_frame->codec_frame.size - remaining_frame_size; - memset((char*)media_frame->codec_frame.buffer + offset, 0, remaining_frame_size); - } - apr_thread_mutex_unlock(buffer->guard); - return TRUE; -} - -apr_size_t mpf_buffer_get_size(const mpf_buffer_t *buffer) -{ - return buffer->size; -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_codec_descriptor.c b/libs/unimrcp/libs/mpf/src/mpf_codec_descriptor.c deleted file mode 100644 index ca9b903d26..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_codec_descriptor.c +++ /dev/null @@ -1,279 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_codec_descriptor.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mpf_codec_descriptor.h" -#include "mpf_named_event.h" -#include "mpf_rtp_pt.h" - -/* linear PCM (host horder) */ -#define LPCM_CODEC_NAME "LPCM" -#define LPCM_CODEC_NAME_LENGTH (sizeof(LPCM_CODEC_NAME)-1) - -/* linear PCM atrributes */ -static const mpf_codec_attribs_t lpcm_attribs = { - {LPCM_CODEC_NAME, LPCM_CODEC_NAME_LENGTH}, /* codec name */ - 16, /* bits per sample */ - MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000 | - MPF_SAMPLE_RATE_32000 | MPF_SAMPLE_RATE_48000 /* supported sampling rates */ -}; - -/** Find matched attribs in codec capabilities by descriptor specified */ -static mpf_codec_attribs_t* mpf_codec_capabilities_attribs_find(const mpf_codec_capabilities_t *capabilities, const mpf_codec_descriptor_t *descriptor); - - -/** Get sampling rate mask (mpf_sample_rate_e) by integer value */ -MPF_DECLARE(int) mpf_sample_rate_mask_get(apr_uint16_t sampling_rate) -{ - switch(sampling_rate) { - case 8000: - return MPF_SAMPLE_RATE_8000; - case 16000: - return MPF_SAMPLE_RATE_16000; - case 32000: - return MPF_SAMPLE_RATE_32000; - case 48000: - return MPF_SAMPLE_RATE_48000; - } - return MPF_SAMPLE_RATE_NONE; -} - -static APR_INLINE apt_bool_t mpf_sampling_rate_check(apr_uint16_t sampling_rate, int mask) -{ - return (mpf_sample_rate_mask_get(sampling_rate) & mask) ? TRUE : FALSE; -} - -MPF_DECLARE(mpf_codec_descriptor_t*) mpf_codec_lpcm_descriptor_create(apr_uint16_t sampling_rate, apr_byte_t channel_count, apr_pool_t *pool) -{ - mpf_codec_descriptor_t *descriptor = mpf_codec_descriptor_create(pool); - descriptor->payload_type = RTP_PT_UNKNOWN; - descriptor->name = lpcm_attribs.name; - descriptor->sampling_rate = sampling_rate; - descriptor->channel_count = channel_count; - return descriptor; -} - -/** Create codec descriptor by capabilities */ -MPF_DECLARE(mpf_codec_descriptor_t*) mpf_codec_descriptor_create_by_capabilities(const mpf_codec_capabilities_t *capabilities, const mpf_codec_descriptor_t *peer, apr_pool_t *pool) -{ - mpf_codec_descriptor_t *descriptor; - mpf_codec_attribs_t *attribs = NULL; - if(capabilities && peer) { - attribs = mpf_codec_capabilities_attribs_find(capabilities,peer); - } - - if(!attribs) { - return mpf_codec_lpcm_descriptor_create(8000,1,pool); - } - - descriptor = mpf_codec_descriptor_create(pool); - *descriptor = *peer; - if(apt_string_compare(&peer->name,&attribs->name) == FALSE) { - descriptor->payload_type = RTP_PT_UNKNOWN; - descriptor->name = attribs->name; - } - return descriptor; -} - -/** Match two codec descriptors */ -MPF_DECLARE(apt_bool_t) mpf_codec_descriptors_match(const mpf_codec_descriptor_t *descriptor1, const mpf_codec_descriptor_t *descriptor2) -{ - apt_bool_t match = FALSE; - if(descriptor1->payload_type < RTP_PT_DYNAMIC && descriptor2->payload_type < RTP_PT_DYNAMIC) { - if(descriptor1->payload_type == descriptor2->payload_type) { - match = TRUE; - } - } - else { - if(apt_string_compare(&descriptor1->name,&descriptor2->name) == TRUE) { - if(descriptor1->sampling_rate == descriptor2->sampling_rate && - descriptor1->channel_count == descriptor2->channel_count) { - match = TRUE; - } - } - } - return match; -} - -/** Match specified codec descriptor and the default lpcm one */ -MPF_DECLARE(apt_bool_t) mpf_codec_lpcm_descriptor_match(const mpf_codec_descriptor_t *descriptor) -{ - return apt_string_compare(&descriptor->name,&lpcm_attribs.name); -} - -/** Add default (linear PCM) capabilities */ -MPF_DECLARE(apt_bool_t) mpf_codec_default_capabilities_add(mpf_codec_capabilities_t *capabilities) -{ - return mpf_codec_capabilities_add(capabilities,MPF_SAMPLE_RATE_8000,lpcm_attribs.name.buf); -} - -/** Match codec descriptors by attribs specified */ -MPF_DECLARE(apt_bool_t) mpf_codec_descriptor_match_by_attribs(mpf_codec_descriptor_t *descriptor, const mpf_codec_descriptor_t *static_descriptor, const mpf_codec_attribs_t *attribs) -{ - apt_bool_t match = FALSE; - if(descriptor->payload_type < RTP_PT_DYNAMIC) { - if(static_descriptor && static_descriptor->payload_type == descriptor->payload_type) { - descriptor->name = static_descriptor->name; - descriptor->sampling_rate = static_descriptor->sampling_rate; - descriptor->channel_count = static_descriptor->channel_count; - match = TRUE; - } - } - else { - if(apt_string_compare(&attribs->name,&descriptor->name) == TRUE) { - if(mpf_sampling_rate_check(descriptor->sampling_rate,attribs->sample_rates) == TRUE) { - match = TRUE; - } - } - } - return match; -} - -/** Find matched descriptor in codec list */ -MPF_DECLARE(mpf_codec_descriptor_t*) mpf_codec_list_descriptor_find(const mpf_codec_list_t *codec_list, const mpf_codec_descriptor_t *descriptor) -{ - int i; - mpf_codec_descriptor_t *matched_descriptor; - for(i=0; idescriptor_arr->nelts; i++) { - matched_descriptor = &APR_ARRAY_IDX(codec_list->descriptor_arr,i,mpf_codec_descriptor_t); - if(mpf_codec_descriptors_match(descriptor,matched_descriptor) == TRUE) { - return matched_descriptor; - } - } - return NULL; -} - -/** Find matched attribs in codec capabilities by descriptor specified */ -static mpf_codec_attribs_t* mpf_codec_capabilities_attribs_find(const mpf_codec_capabilities_t *capabilities, const mpf_codec_descriptor_t *descriptor) -{ - int i; - mpf_codec_attribs_t *attribs; - for(i=0; iattrib_arr->nelts; i++) { - attribs = &APR_ARRAY_IDX(capabilities->attrib_arr,i,mpf_codec_attribs_t); - if(mpf_sampling_rate_check(descriptor->sampling_rate,attribs->sample_rates) == TRUE) { - return attribs; - } - } - return NULL; -} - -/** Match codec list with specified capabilities */ -MPF_DECLARE(apt_bool_t) mpf_codec_list_match(mpf_codec_list_t *codec_list, const mpf_codec_capabilities_t *capabilities) -{ - int i; - mpf_codec_descriptor_t *descriptor; - apt_bool_t status = FALSE; - if(!capabilities) { - return FALSE; - } - - for(i=0; idescriptor_arr->nelts; i++) { - descriptor = &APR_ARRAY_IDX(codec_list->descriptor_arr,i,mpf_codec_descriptor_t); - if(descriptor->enabled == FALSE) continue; - - /* match capabilities */ - if(mpf_codec_capabilities_attribs_find(capabilities,descriptor)) { - /* at least one codec descriptor matches */ - status = TRUE; - } - else { - descriptor->enabled = FALSE; - } - } - - return status; -} - -/** Intersect two codec lists */ -MPF_DECLARE(apt_bool_t) mpf_codec_lists_intersect(mpf_codec_list_t *codec_list1, mpf_codec_list_t *codec_list2) -{ - int i; - mpf_codec_descriptor_t *descriptor1; - mpf_codec_descriptor_t *descriptor2; - codec_list1->primary_descriptor = NULL; - codec_list1->event_descriptor = NULL; - codec_list2->primary_descriptor = NULL; - codec_list2->event_descriptor = NULL; - /* find only one match for primary and named event descriptors, - set the matched descriptors as preffered, disable the others */ - for(i=0; idescriptor_arr->nelts; i++) { - descriptor1 = &APR_ARRAY_IDX(codec_list1->descriptor_arr,i,mpf_codec_descriptor_t); - if(descriptor1->enabled == FALSE) { - /* this descriptor has been already disabled, process only enabled ones */ - continue; - } - - /* check whether this is a named event descriptor */ - if(mpf_event_descriptor_check(descriptor1) == TRUE) { - /* named event descriptor */ - if(codec_list1->event_descriptor) { - /* named event descriptor has been already set, disable this one */ - descriptor1->enabled = FALSE; - } - else { - /* find if there is a match */ - descriptor2 = mpf_codec_list_descriptor_find(codec_list2,descriptor1); - if(descriptor2 && descriptor2->enabled == TRUE) { - descriptor1->enabled = TRUE; - codec_list1->event_descriptor = descriptor1; - codec_list2->event_descriptor = descriptor2; - } - else { - /* no match found, disable this descriptor */ - descriptor1->enabled = FALSE; - } - } - } - else { - /* primary descriptor */ - if(codec_list1->primary_descriptor) { - /* primary descriptor has been already set, disable this one */ - descriptor1->enabled = FALSE; - } - else { - /* find if there is a match */ - descriptor2 = mpf_codec_list_descriptor_find(codec_list2,descriptor1); - if(descriptor2 && descriptor2->enabled == TRUE) { - descriptor1->enabled = TRUE; - codec_list1->primary_descriptor = descriptor1; - codec_list2->primary_descriptor = descriptor2; - } - else { - /* no match found, disable this descriptor */ - descriptor1->enabled = FALSE; - } - } - } - } - - for(i=0; idescriptor_arr->nelts; i++) { - descriptor2 = &APR_ARRAY_IDX(codec_list2->descriptor_arr,i,mpf_codec_descriptor_t); - if(descriptor2 == codec_list2->primary_descriptor || descriptor2 == codec_list2->event_descriptor) { - descriptor2->enabled = TRUE; - } - else { - descriptor2->enabled = FALSE; - } - } - - /* if primary descriptor is disabled or not set, return FALSE */ - if(!codec_list1->primary_descriptor || codec_list1->primary_descriptor->enabled == FALSE) { - return FALSE; - } - - return TRUE; -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_codec_g711.c b/libs/unimrcp/libs/mpf/src/mpf_codec_g711.c deleted file mode 100644 index 0a3bda25dc..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_codec_g711.c +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_codec_g711.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mpf_codec.h" -#include "mpf_rtp_pt.h" -#include "g711/g711.h" - -#define G711u_CODEC_NAME "PCMU" -#define G711u_CODEC_NAME_LENGTH (sizeof(G711u_CODEC_NAME)-1) - -#define G711a_CODEC_NAME "PCMA" -#define G711a_CODEC_NAME_LENGTH (sizeof(G711a_CODEC_NAME)-1) - -static apt_bool_t g711_open(mpf_codec_t *codec) -{ - return TRUE; -} - -static apt_bool_t g711_close(mpf_codec_t *codec) -{ - return TRUE; -} - -static apt_bool_t g711u_encode(mpf_codec_t *codec, const mpf_codec_frame_t *frame_in, mpf_codec_frame_t *frame_out) -{ - const apr_int16_t *decode_buf; - unsigned char *encode_buf; - apr_size_t i; - - decode_buf = frame_in->buffer; - encode_buf = frame_out->buffer; - - frame_out->size = frame_in->size / sizeof(apr_int16_t); - - for(i=0; isize; i++) { - encode_buf[i] = linear_to_ulaw(decode_buf[i]); - } - - return TRUE; -} - -static apt_bool_t g711u_decode(mpf_codec_t *codec, const mpf_codec_frame_t *frame_in, mpf_codec_frame_t *frame_out) -{ - apr_int16_t *decode_buf; - const unsigned char *encode_buf; - apr_size_t i; - - decode_buf = frame_out->buffer; - encode_buf = frame_in->buffer; - - frame_out->size = frame_in->size * sizeof(apr_int16_t); - - for(i=0; isize; i++) { - decode_buf[i] = ulaw_to_linear(encode_buf[i]); - } - - return TRUE; -} - -static apt_bool_t g711u_init(mpf_codec_t *codec, mpf_codec_frame_t *frame_out) -{ - apr_size_t i; - unsigned char *encode_buf = frame_out->buffer; - for(i=0; isize; i++) { - encode_buf[i] = linear_to_ulaw(0); - } - - return TRUE; -} - -static apt_bool_t g711a_encode(mpf_codec_t *codec, const mpf_codec_frame_t *frame_in, mpf_codec_frame_t *frame_out) -{ - const apr_int16_t *decode_buf; - unsigned char *encode_buf; - apr_size_t i; - - decode_buf = frame_in->buffer; - encode_buf = frame_out->buffer; - - frame_out->size = frame_in->size / sizeof(apr_int16_t); - - for(i=0; isize; i++) { - encode_buf[i] = linear_to_alaw(decode_buf[i]); - } - - return TRUE; -} - -static apt_bool_t g711a_decode(mpf_codec_t *codec, const mpf_codec_frame_t *frame_in, mpf_codec_frame_t *frame_out) -{ - apr_int16_t *decode_buf; - const unsigned char *encode_buf; - apr_size_t i; - - decode_buf = frame_out->buffer; - encode_buf = frame_in->buffer; - - frame_out->size = frame_in->size * sizeof(apr_int16_t); - - for(i=0; isize; i++) { - decode_buf[i] = alaw_to_linear(encode_buf[i]); - } - - return TRUE; -} - -static apt_bool_t g711a_init(mpf_codec_t *codec, mpf_codec_frame_t *frame_out) -{ - apr_size_t i; - unsigned char *encode_buf = frame_out->buffer; - for(i=0; isize; i++) { - encode_buf[i] = linear_to_alaw(0); - } - - return TRUE; -} - -static const mpf_codec_vtable_t g711u_vtable = { - g711_open, - g711_close, - g711u_encode, - g711u_decode, - NULL, - g711u_init -}; - -static const mpf_codec_vtable_t g711a_vtable = { - g711_open, - g711_close, - g711a_encode, - g711a_decode, - NULL, - g711a_init -}; - -static const mpf_codec_descriptor_t g711u_descriptor = { - RTP_PT_PCMU, - {G711u_CODEC_NAME, G711u_CODEC_NAME_LENGTH}, - 8000, - 1, - {NULL, 0}, - TRUE -}; - -static const mpf_codec_descriptor_t g711a_descriptor = { - RTP_PT_PCMA, - {G711a_CODEC_NAME, G711a_CODEC_NAME_LENGTH}, - 8000, - 1, - {NULL,0}, - TRUE -}; - -static const mpf_codec_attribs_t g711u_attribs = { - {G711u_CODEC_NAME, G711u_CODEC_NAME_LENGTH}, /* codec name */ - 8, /* bits per sample */ - MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000 | - MPF_SAMPLE_RATE_32000 | MPF_SAMPLE_RATE_48000 /* supported sampling rates */ -}; - -static const mpf_codec_attribs_t g711a_attribs = { - {G711a_CODEC_NAME, G711a_CODEC_NAME_LENGTH}, /* codec name */ - 8, /* bits per sample */ - MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000 | - MPF_SAMPLE_RATE_32000 | MPF_SAMPLE_RATE_48000 /* supported sampling rates */ -}; - -mpf_codec_t* mpf_codec_g711u_create(apr_pool_t *pool) -{ - return mpf_codec_create(&g711u_vtable,&g711u_attribs,&g711u_descriptor,pool); -} - -mpf_codec_t* mpf_codec_g711a_create(apr_pool_t *pool) -{ - return mpf_codec_create(&g711a_vtable,&g711a_attribs,&g711a_descriptor,pool); -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_codec_linear.c b/libs/unimrcp/libs/mpf/src/mpf_codec_linear.c deleted file mode 100644 index 78a817df03..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_codec_linear.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_codec_linear.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#define APR_WANT_BYTEFUNC -#include -#include "mpf_codec.h" -#include "mpf_rtp_pt.h" - -/* linear 16-bit PCM (RFC3551) */ -#define L16_CODEC_NAME "L16" -#define L16_CODEC_NAME_LENGTH (sizeof(L16_CODEC_NAME)-1) - - -static apt_bool_t l16_open(mpf_codec_t *codec) -{ - return TRUE; -} - -static apt_bool_t l16_close(mpf_codec_t *codec) -{ - return TRUE; -} - -static apt_bool_t l16_encode(mpf_codec_t *codec, const mpf_codec_frame_t *frame_in, mpf_codec_frame_t *frame_out) -{ - apr_uint32_t i; - const apr_int16_t *buf_in = frame_in->buffer; - apr_int16_t *buf_out = frame_out->buffer; - apr_size_t samples = frame_in->size / sizeof(apr_int16_t); - - frame_out->size = frame_in->size; - - for(i=0; ibuffer; - apr_int16_t *buf_out = frame_out->buffer; - apr_size_t samples = frame_in->size / sizeof(apr_int16_t); - - frame_out->size = frame_in->size; - - for(i=0; i -#include "mpf_codec_manager.h" -#include "mpf_rtp_pt.h" -#include "mpf_named_event.h" -#include "apt_log.h" - - -struct mpf_codec_manager_t { - /** Memory pool */ - apr_pool_t *pool; - - /** Dynamic (resizable) array of codecs (mpf_codec_t*) */ - apr_array_header_t *codec_arr; - /** Default named event descriptor */ - mpf_codec_descriptor_t *event_descriptor; -}; - - -MPF_DECLARE(mpf_codec_manager_t*) mpf_codec_manager_create(apr_size_t codec_count, apr_pool_t *pool) -{ - mpf_codec_manager_t *codec_manager = apr_palloc(pool,sizeof(mpf_codec_manager_t)); - codec_manager->pool = pool; - codec_manager->codec_arr = apr_array_make(pool,(int)codec_count,sizeof(mpf_codec_t*)); - codec_manager->event_descriptor = mpf_event_descriptor_create(8000,pool); - return codec_manager; -} - -MPF_DECLARE(void) mpf_codec_manager_destroy(mpf_codec_manager_t *codec_manager) -{ - /* nothing to do */ -} - -MPF_DECLARE(apt_bool_t) mpf_codec_manager_codec_register(mpf_codec_manager_t *codec_manager, mpf_codec_t *codec) -{ - if(!codec || !codec->attribs || !codec->attribs->name.buf) { - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Codec [%s]",codec->attribs->name.buf); - - APR_ARRAY_PUSH(codec_manager->codec_arr,mpf_codec_t*) = codec; - return TRUE; -} - -MPF_DECLARE(mpf_codec_t*) mpf_codec_manager_codec_get(const mpf_codec_manager_t *codec_manager, mpf_codec_descriptor_t *descriptor, apr_pool_t *pool) -{ - int i; - mpf_codec_t *codec; - if(!descriptor) { - return NULL; - } - - for(i=0; icodec_arr->nelts; i++) { - codec = APR_ARRAY_IDX(codec_manager->codec_arr,i,mpf_codec_t*); - if(mpf_codec_descriptor_match_by_attribs(descriptor,codec->static_descriptor,codec->attribs) == TRUE) { - return mpf_codec_clone(codec,pool); - } - } - - return NULL; -} - -MPF_DECLARE(apt_bool_t) mpf_codec_manager_codec_list_get(const mpf_codec_manager_t *codec_manager, mpf_codec_list_t *codec_list, apr_pool_t *pool) -{ - const mpf_codec_descriptor_t *static_descriptor; - mpf_codec_descriptor_t *descriptor; - int i; - mpf_codec_t *codec; - - mpf_codec_list_init(codec_list,codec_manager->codec_arr->nelts,pool); - for(i=0; icodec_arr->nelts; i++) { - codec = APR_ARRAY_IDX(codec_manager->codec_arr,i,mpf_codec_t*); - static_descriptor = codec->static_descriptor; - if(static_descriptor) { - descriptor = mpf_codec_list_add(codec_list); - if(descriptor) { - *descriptor = *static_descriptor; - } - } - } - if(codec_manager->event_descriptor) { - descriptor = mpf_codec_list_add(codec_list); - if(descriptor) { - *descriptor = *codec_manager->event_descriptor; - } - } - return TRUE; -} - -static apt_bool_t mpf_codec_manager_codec_parse(const mpf_codec_manager_t *codec_manager, mpf_codec_list_t *codec_list, char *codec_desc_str, apr_pool_t *pool) -{ - const mpf_codec_t *codec; - mpf_codec_descriptor_t *descriptor; - const char *separator = "/"; - char *state; - /* parse codec name */ - char *str = apr_strtok(codec_desc_str, separator, &state); - codec_desc_str = NULL; /* make sure we pass NULL on subsequent calls of apr_strtok() */ - if(str) { - apt_str_t name; - apt_string_assign(&name,str,pool); - /* find codec by name */ - codec = mpf_codec_manager_codec_find(codec_manager,&name); - if(codec) { - descriptor = mpf_codec_list_add(codec_list); - descriptor->name = name; - - /* set default attributes */ - if(codec->static_descriptor) { - descriptor->payload_type = codec->static_descriptor->payload_type; - descriptor->sampling_rate = codec->static_descriptor->sampling_rate; - descriptor->channel_count = codec->static_descriptor->channel_count; - } - else { - descriptor->payload_type = RTP_PT_DYNAMIC; - descriptor->sampling_rate = 8000; - descriptor->channel_count = 1; - } - } - else { - mpf_codec_descriptor_t *event_descriptor = codec_manager->event_descriptor; - if(event_descriptor && apt_string_compare(&event_descriptor->name,&name) == TRUE) { - descriptor = mpf_codec_list_add(codec_list); - *descriptor = *event_descriptor; - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Such Codec [%s]",str); - return FALSE; - } - } - - - /* parse optional payload type */ - str = apr_strtok(codec_desc_str, separator, &state); - if(str) { - descriptor->payload_type = (apr_byte_t)atol(str); - - /* parse optional sampling rate */ - str = apr_strtok(codec_desc_str, separator, &state); - if(str) { - descriptor->sampling_rate = (apr_uint16_t)atol(str); - - /* parse optional channel count */ - str = apr_strtok(codec_desc_str, separator, &state); - if(str) { - descriptor->channel_count = (apr_byte_t)atol(str); - } - } - } - } - return TRUE; -} - -MPF_DECLARE(apt_bool_t) mpf_codec_manager_codec_list_load(const mpf_codec_manager_t *codec_manager, mpf_codec_list_t *codec_list, const char *str, apr_pool_t *pool) -{ - char *codec_desc_str; - char *state; - char *codec_list_str = apr_pstrdup(pool,str); - do { - codec_desc_str = apr_strtok(codec_list_str, " ", &state); - if(codec_desc_str) { - mpf_codec_manager_codec_parse(codec_manager,codec_list,codec_desc_str,pool); - } - codec_list_str = NULL; /* make sure we pass NULL on subsequent calls of apr_strtok() */ - } - while(codec_desc_str); - return TRUE; -} - -MPF_DECLARE(const mpf_codec_t*) mpf_codec_manager_codec_find(const mpf_codec_manager_t *codec_manager, const apt_str_t *codec_name) -{ - int i; - mpf_codec_t *codec; - for(i=0; icodec_arr->nelts; i++) { - codec = APR_ARRAY_IDX(codec_manager->codec_arr,i,mpf_codec_t*); - if(apt_string_compare(&codec->attribs->name,codec_name) == TRUE) { - return codec; - } - } - return NULL; -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_context.c b/libs/unimrcp/libs/mpf/src/mpf_context.c deleted file mode 100644 index e0c35cce81..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_context.c +++ /dev/null @@ -1,548 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_context.c 2181 2014-09-14 04:29:38Z achaloyan@gmail.com $ - */ - -#ifdef WIN32 -#pragma warning(disable: 4127) -#endif -#include -#include "mpf_context.h" -#include "mpf_termination.h" -#include "mpf_stream.h" -#include "mpf_bridge.h" -#include "mpf_multiplier.h" -#include "mpf_mixer.h" -#include "apt_log.h" - -/** Item of the association matrix */ -typedef struct { - unsigned char on; -} matrix_item_t; - -/** Item of the association matrix header */ -typedef struct { - mpf_termination_t *termination; - unsigned char tx_count; - unsigned char rx_count; -} header_item_t; - -/** Media processing context */ -struct mpf_context_t { - /** Ring entry */ - APR_RING_ENTRY(mpf_context_t) link; - /** Back pointer to the context factory */ - mpf_context_factory_t *factory; - /** Pool to allocate memory from */ - apr_pool_t *pool; - /** Informative name of the context used for debugging */ - const char *name; - /** External object */ - void *obj; - - /** Max number of terminations in the context */ - apr_size_t capacity; - /** Current number of terminations in the context */ - apr_size_t count; - /** Header of the association matrix */ - header_item_t *header; - /** Association matrix, which represents the topology */ - matrix_item_t **matrix; - - /** Array of media processing objects constructed while - applying topology based on association matrix */ - apr_array_header_t *mpf_objects; -}; - -/** Factory of media contexts */ -struct mpf_context_factory_t { - /** Ring head */ - APR_RING_HEAD(mpf_context_head_t, mpf_context_t) head; -}; - - -static APR_INLINE apt_bool_t stream_direction_compatibility_check(mpf_termination_t *termination1, mpf_termination_t *termination2); -static mpf_object_t* mpf_context_bridge_create(mpf_context_t *context, apr_size_t i); -static mpf_object_t* mpf_context_multiplier_create(mpf_context_t *context, apr_size_t i); -static mpf_object_t* mpf_context_mixer_create(mpf_context_t *context, apr_size_t j); - - -MPF_DECLARE(mpf_context_factory_t*) mpf_context_factory_create(apr_pool_t *pool) -{ - mpf_context_factory_t *factory = apr_palloc(pool, sizeof(mpf_context_factory_t)); - APR_RING_INIT(&factory->head, mpf_context_t, link); - return factory; -} - -MPF_DECLARE(void) mpf_context_factory_destroy(mpf_context_factory_t *factory) -{ - mpf_context_t *context; - while(!APR_RING_EMPTY(&factory->head, mpf_context_t, link)) { - context = APR_RING_FIRST(&factory->head); - mpf_context_destroy(context); - APR_RING_REMOVE(context, link); - } -} - -MPF_DECLARE(apt_bool_t) mpf_context_factory_process(mpf_context_factory_t *factory) -{ - mpf_context_t *context; - for(context = APR_RING_FIRST(&factory->head); - context != APR_RING_SENTINEL(&factory->head, mpf_context_t, link); - context = APR_RING_NEXT(context, link)) { - - mpf_context_process(context); - } - - return TRUE; -} - - -MPF_DECLARE(mpf_context_t*) mpf_context_create( - mpf_context_factory_t *factory, - const char *name, - void *obj, - apr_size_t max_termination_count, - apr_pool_t *pool) -{ - apr_size_t i,j; - matrix_item_t *matrix_item; - header_item_t *header_item; - mpf_context_t *context = apr_palloc(pool,sizeof(mpf_context_t)); - APR_RING_ELEM_INIT(context,link); - context->factory = factory; - context->obj = obj; - context->pool = pool; - context->name = name; - if(!context->name) { - context->name = apr_psprintf(pool,"0x%pp",context); - } - context->capacity = max_termination_count; - context->count = 0; - context->mpf_objects = apr_array_make(pool,1,sizeof(mpf_object_t*)); - context->header = apr_palloc(pool,context->capacity * sizeof(header_item_t)); - context->matrix = apr_palloc(pool,context->capacity * sizeof(matrix_item_t*)); - for(i=0; icapacity; i++) { - header_item = &context->header[i]; - header_item->termination = NULL; - header_item->tx_count = 0; - header_item->rx_count = 0; - context->matrix[i] = apr_palloc(pool,context->capacity * sizeof(matrix_item_t)); - for(j=0; jcapacity; j++) { - matrix_item = &context->matrix[i][j]; - matrix_item->on = 0; - } - } - - return context; -} - -MPF_DECLARE(apt_bool_t) mpf_context_destroy(mpf_context_t *context) -{ - apr_size_t i; - mpf_termination_t *termination; - for(i=0; icapacity; i++){ - termination = context->header[i].termination; - if(termination) { - mpf_context_termination_subtract(context,termination); - mpf_termination_subtract(termination); - } - } - return TRUE; -} - -MPF_DECLARE(void*) mpf_context_object_get(const mpf_context_t *context) -{ - return context->obj; -} - -MPF_DECLARE(apt_bool_t) mpf_context_termination_add(mpf_context_t *context, mpf_termination_t *termination) -{ - apr_size_t i; - header_item_t *header_item; - for(i=0; icapacity; i++) { - header_item = &context->header[i]; - if(header_item->termination) { - continue; - } - if(!context->count) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Add Media Context %s",context->name); - APR_RING_INSERT_TAIL(&context->factory->head,context,mpf_context_t,link); - } - - header_item->termination = termination; - header_item->tx_count = 0; - header_item->rx_count = 0; - - termination->slot = i; - context->count++; - return TRUE; - } - return FALSE; -} - -MPF_DECLARE(apt_bool_t) mpf_context_termination_subtract(mpf_context_t *context, mpf_termination_t *termination) -{ - header_item_t *header_item1; - header_item_t *header_item2; - matrix_item_t *item; - apr_size_t j,k; - apr_size_t i = termination->slot; - if(i >= context->capacity) { - return FALSE; - } - header_item1 = &context->header[i]; - if(header_item1->termination != termination) { - return FALSE; - } - - for(j=0,k=0; jcapacity && kcount; j++) { - header_item2 = &context->header[j]; - if(!header_item2->termination) { - continue; - } - k++; - - item = &context->matrix[i][j]; - if(item->on) { - item->on = 0; - header_item1->tx_count--; - header_item2->rx_count--; - } - - item = &context->matrix[j][i]; - if(item->on) { - item->on = 0; - header_item2->tx_count--; - header_item1->rx_count--; - } - } - header_item1->termination = NULL; - - termination->slot = (apr_size_t)-1; - context->count--; - if(!context->count) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Remove Media Context %s",context->name); - APR_RING_REMOVE(context,link); - } - return TRUE; -} - -MPF_DECLARE(apt_bool_t) mpf_context_association_add(mpf_context_t *context, mpf_termination_t *termination1, mpf_termination_t *termination2) -{ - header_item_t *header_item1; - matrix_item_t *matrix_item1; - header_item_t *header_item2; - matrix_item_t *matrix_item2; - apr_size_t i = termination1->slot; - apr_size_t j = termination2->slot; - if(i >= context->capacity || j >= context->capacity) { - return FALSE; - } - - header_item1 = &context->header[i]; - header_item2 = &context->header[j]; - - if(header_item1->termination != termination1 || header_item2->termination != termination2) { - return FALSE; - } - - matrix_item1 = &context->matrix[i][j]; - matrix_item2 = &context->matrix[j][i]; - - /* 1 -> 2 */ - if(!matrix_item1->on) { - if(stream_direction_compatibility_check(header_item1->termination,header_item2->termination) == TRUE) { - matrix_item1->on = 1; - header_item1->tx_count ++; - header_item2->rx_count ++; - } - } - - /* 2 -> 1 */ - if(!matrix_item2->on) { - if(stream_direction_compatibility_check(header_item2->termination,header_item1->termination) == TRUE) { - matrix_item2->on = 1; - header_item2->tx_count ++; - header_item1->rx_count ++; - } - } - return TRUE; -} - -MPF_DECLARE(apt_bool_t) mpf_context_association_remove(mpf_context_t *context, mpf_termination_t *termination1, mpf_termination_t *termination2) -{ - header_item_t *header_item1; - matrix_item_t *matrix_item1; - header_item_t *header_item2; - matrix_item_t *matrix_item2; - apr_size_t i = termination1->slot; - apr_size_t j = termination2->slot; - if(i >= context->capacity || j >= context->capacity) { - return FALSE; - } - - header_item1 = &context->header[i]; - header_item2 = &context->header[j]; - - if(header_item1->termination != termination1 || header_item2->termination != termination2) { - return FALSE; - } - - matrix_item1 = &context->matrix[i][j]; - matrix_item2 = &context->matrix[j][i]; - - /* 1 -> 2 */ - if(matrix_item1->on == 1) { - matrix_item1->on = 0; - header_item1->tx_count --; - header_item2->rx_count --; - } - - /* 2 -> 1 */ - if(matrix_item2->on == 1) { - matrix_item2->on = 0; - header_item2->tx_count --; - header_item1->rx_count --; - } - return TRUE; -} - -MPF_DECLARE(apt_bool_t) mpf_context_associations_reset(mpf_context_t *context) -{ - apr_size_t i,j,k; - header_item_t *header_item1; - header_item_t *header_item2; - matrix_item_t *item; - - /* destroy existing topology / if any */ - mpf_context_topology_destroy(context); - - /* reset assigned associations */ - for(i=0,k=0; icapacity && kcount; i++) { - header_item1 = &context->header[i]; - if(!header_item1->termination) { - continue; - } - k++; - - if(!header_item1->tx_count && !header_item1->rx_count) { - continue; - } - - for(j=i; jcapacity; j++) { - header_item2 = &context->header[j]; - if(!header_item2->termination) { - continue; - } - - item = &context->matrix[i][j]; - if(item->on) { - item->on = 0; - header_item1->tx_count--; - header_item2->rx_count--; - } - - item = &context->matrix[j][i]; - if(item->on) { - item->on = 0; - header_item2->tx_count--; - header_item1->rx_count--; - } - } - } - return TRUE; -} - -static apt_bool_t mpf_context_object_add(mpf_context_t *context, mpf_object_t *object) -{ - if(!object) { - return FALSE; - } - - APR_ARRAY_PUSH(context->mpf_objects, mpf_object_t*) = object; -#if 1 - mpf_object_trace(object); -#endif - return TRUE; -} - -MPF_DECLARE(apt_bool_t) mpf_context_topology_apply(mpf_context_t *context) -{ - apr_size_t i,k; - header_item_t *header_item; - mpf_object_t *object; - - /* first destroy existing topology / if any */ - mpf_context_topology_destroy(context); - - for(i=0,k=0; icapacity && kcount; i++) { - header_item = &context->header[i]; - if(!header_item->termination) { - continue; - } - k++; - - if(header_item->tx_count > 0) { - object = NULL; - if(header_item->tx_count == 1) { - object = mpf_context_bridge_create(context,i); - } - else { /* tx_count > 1 */ - object = mpf_context_multiplier_create(context,i); - } - - mpf_context_object_add(context,object); - } - if(header_item->rx_count > 1) { - object = mpf_context_mixer_create(context,i); - mpf_context_object_add(context,object); - } - } - - return TRUE; -} - -MPF_DECLARE(apt_bool_t) mpf_context_topology_destroy(mpf_context_t *context) -{ - if(context->mpf_objects->nelts) { - int i; - mpf_object_t *object; - for(i=0; impf_objects->nelts; i++) { - object = APR_ARRAY_IDX(context->mpf_objects,i,mpf_object_t*); - mpf_object_destroy(object); - } - apr_array_clear(context->mpf_objects); - } - return TRUE; -} - -MPF_DECLARE(apt_bool_t) mpf_context_process(mpf_context_t *context) -{ - int i; - mpf_object_t *object; - for(i=0; impf_objects->nelts; i++) { - object = APR_ARRAY_IDX(context->mpf_objects,i,mpf_object_t*); - if(object && object->process) { - object->process(object); - } - } - return TRUE; -} - - -static mpf_object_t* mpf_context_bridge_create(mpf_context_t *context, apr_size_t i) -{ - header_item_t *header_item1 = &context->header[i]; - header_item_t *header_item2; - matrix_item_t *item; - apr_size_t j; - for(j=0; jcapacity; j++) { - header_item2 = &context->header[j]; - if(!header_item2->termination) { - continue; - } - item = &context->matrix[i][j]; - if(!item->on) { - continue; - } - - if(header_item2->rx_count > 1) { - /* mixer will be created instead */ - return NULL; - } - - /* create bridge i -> j */ - if(header_item1->termination && header_item2->termination) { - return mpf_bridge_create( - header_item1->termination->audio_stream, - header_item2->termination->audio_stream, - header_item1->termination->codec_manager, - context->name, - context->pool); - } - } - return NULL; -} - -static mpf_object_t* mpf_context_multiplier_create(mpf_context_t *context, apr_size_t i) -{ - mpf_audio_stream_t **sink_arr; - header_item_t *header_item1 = &context->header[i]; - header_item_t *header_item2; - matrix_item_t *item; - apr_size_t j,k; - sink_arr = apr_palloc(context->pool,header_item1->tx_count * sizeof(mpf_audio_stream_t*)); - for(j=0,k=0; jcapacity && ktx_count; j++) { - header_item2 = &context->header[j]; - if(!header_item2->termination) { - continue; - } - item = &context->matrix[i][j]; - if(!item->on) { - continue; - } - sink_arr[k] = header_item2->termination->audio_stream; - k++; - } - return mpf_multiplier_create( - header_item1->termination->audio_stream, - sink_arr, - header_item1->tx_count, - header_item1->termination->codec_manager, - context->name, - context->pool); -} - -static mpf_object_t* mpf_context_mixer_create(mpf_context_t *context, apr_size_t j) -{ - mpf_audio_stream_t **source_arr; - header_item_t *header_item1 = &context->header[j]; - header_item_t *header_item2; - matrix_item_t *item; - apr_size_t i,k; - source_arr = apr_palloc(context->pool,header_item1->rx_count * sizeof(mpf_audio_stream_t*)); - for(i=0,k=0; icapacity && krx_count; i++) { - header_item2 = &context->header[i]; - if(!header_item2->termination) { - continue; - } - item = &context->matrix[i][j]; - if(!item->on) { - continue; - } - source_arr[k] = header_item2->termination->audio_stream; - k++; - } - return mpf_mixer_create( - source_arr, - header_item1->rx_count, - header_item1->termination->audio_stream, - header_item1->termination->codec_manager, - context->name, - context->pool); -} - -static APR_INLINE apt_bool_t stream_direction_compatibility_check(mpf_termination_t *termination1, mpf_termination_t *termination2) -{ - mpf_audio_stream_t *source = termination1->audio_stream; - mpf_audio_stream_t *sink = termination2->audio_stream; - if(source && (source->direction & STREAM_DIRECTION_RECEIVE) == STREAM_DIRECTION_RECEIVE && - sink && (sink->direction & STREAM_DIRECTION_SEND) == STREAM_DIRECTION_SEND) { - return TRUE; - } - return FALSE; -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_decoder.c b/libs/unimrcp/libs/mpf/src/mpf_decoder.c deleted file mode 100644 index f27467101f..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_decoder.c +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_decoder.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mpf_decoder.h" -#include "apt_log.h" - -typedef struct mpf_decoder_t mpf_decoder_t; - -struct mpf_decoder_t { - mpf_audio_stream_t *base; - mpf_audio_stream_t *source; - mpf_codec_t *codec; - mpf_frame_t frame_in; -}; - - -static apt_bool_t mpf_decoder_destroy(mpf_audio_stream_t *stream) -{ - mpf_decoder_t *decoder = stream->obj; - return mpf_audio_stream_destroy(decoder->source); -} - -static apt_bool_t mpf_decoder_open(mpf_audio_stream_t *stream, mpf_codec_t *codec) -{ - mpf_decoder_t *decoder = stream->obj; - mpf_codec_open(decoder->codec); - return mpf_audio_stream_rx_open(decoder->source,decoder->codec); -} - -static apt_bool_t mpf_decoder_close(mpf_audio_stream_t *stream) -{ - mpf_decoder_t *decoder = stream->obj; - mpf_codec_close(decoder->codec); - return mpf_audio_stream_rx_close(decoder->source); -} - -static apt_bool_t mpf_decoder_process(mpf_audio_stream_t *stream, mpf_frame_t *frame) -{ - mpf_decoder_t *decoder = stream->obj; - decoder->frame_in.type = MEDIA_FRAME_TYPE_NONE; - decoder->frame_in.marker = MPF_MARKER_NONE; - if(mpf_audio_stream_frame_read(decoder->source,&decoder->frame_in) != TRUE) { - return FALSE; - } - - frame->type = decoder->frame_in.type; - frame->marker = decoder->frame_in.marker; - if((frame->type & MEDIA_FRAME_TYPE_EVENT) == MEDIA_FRAME_TYPE_EVENT) { - frame->event_frame = decoder->frame_in.event_frame; - } - if((frame->type & MEDIA_FRAME_TYPE_AUDIO) == MEDIA_FRAME_TYPE_AUDIO) { - mpf_codec_decode(decoder->codec,&decoder->frame_in.codec_frame,&frame->codec_frame); - } - return TRUE; -} - -static void mpf_decoder_trace(mpf_audio_stream_t *stream, mpf_stream_direction_e direction, apt_text_stream_t *output) -{ - apr_size_t offset; - mpf_codec_descriptor_t *descriptor; - mpf_decoder_t *decoder = stream->obj; - - mpf_audio_stream_trace(decoder->source,direction,output); - - descriptor = decoder->base->rx_descriptor; - if(descriptor) { - offset = output->pos - output->text.buf; - output->pos += apr_snprintf(output->pos, output->text.length - offset, - "->Decoder->[%s/%d/%d]", - descriptor->name.buf, - descriptor->sampling_rate, - descriptor->channel_count); - } -} - -static const mpf_audio_stream_vtable_t vtable = { - mpf_decoder_destroy, - mpf_decoder_open, - mpf_decoder_close, - mpf_decoder_process, - NULL, - NULL, - NULL, - mpf_decoder_trace -}; - -MPF_DECLARE(mpf_audio_stream_t*) mpf_decoder_create(mpf_audio_stream_t *source, mpf_codec_t *codec, apr_pool_t *pool) -{ - apr_size_t frame_size; - mpf_decoder_t *decoder; - mpf_stream_capabilities_t *capabilities; - if(!source || !codec) { - return NULL; - } - decoder = apr_palloc(pool,sizeof(mpf_decoder_t)); - capabilities = mpf_stream_capabilities_create(STREAM_DIRECTION_RECEIVE,pool); - decoder->base = mpf_audio_stream_create(decoder,&vtable,capabilities,pool); - if(!decoder->base) { - return NULL; - } - decoder->base->rx_descriptor = mpf_codec_lpcm_descriptor_create( - source->rx_descriptor->sampling_rate, - source->rx_descriptor->channel_count, - pool); - decoder->base->rx_event_descriptor = source->rx_event_descriptor; - - decoder->source = source; - decoder->codec = codec; - - frame_size = mpf_codec_frame_size_calculate(source->rx_descriptor,codec->attribs); - decoder->frame_in.codec_frame.size = frame_size; - decoder->frame_in.codec_frame.buffer = apr_palloc(pool,frame_size); - return decoder->base; -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_dtmf_detector.c b/libs/unimrcp/libs/mpf/src/mpf_dtmf_detector.c deleted file mode 100644 index 58ca1916fd..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_dtmf_detector.c +++ /dev/null @@ -1,302 +0,0 @@ -/* - * Copyright 2009-2010 Tomas Valenta, Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_dtmf_detector.c 2227 2014-11-12 01:10:18Z achaloyan@gmail.com $ - */ - -#include "mpf_dtmf_detector.h" -#include "apr_thread_mutex.h" -#include "apt_log.h" -#include "mpf_named_event.h" -#include - -#ifndef M_PI -# define M_PI 3.141592653589793238462643 -#endif - -/** Max detected DTMF digits buffer length */ -#define MPF_DTMFDET_BUFFER_LEN 32 - -/** Number of DTMF frequencies */ -#define DTMF_FREQUENCIES 8 - -/** Window length in samples (at 8kHz) for Goertzel's frequency analysis */ -#define GOERTZEL_SAMPLES_8K 102 - -/** See RFC4733 */ -#define DTMF_EVENT_ID_MAX 15 /* 0123456789*#ABCD */ - -/** - * Goertzel frequency detector (second-order IIR filter) state: - * - * s(t) = x(t) + coef * s(t-1) - s(t-2), where s(0)=0; s(1) = 0; - * x(t) is the input signal - * - * Then energy of frequency f in the signal is: - * X(f)X'(f) = s(t-2)^2 + s(t-1)^2 - coef*s(t-2)*s(t-1) - */ -typedef struct goertzel_state_t { - /** coef = cos(2*pi*f_tone/f_sampling) */ - double coef; - /** s(t-2) or resulting energy @see goertzel_state_t */ - double s1; - /** s(t-1) @see goertzel_state_t */ - double s2; -} goertzel_state_t; - -/** DTMF frequencies */ -static const double dtmf_freqs[DTMF_FREQUENCIES] = { - 697, 770, 852, 941, /* Row frequencies */ - 1209, 1336, 1477, 1633}; /* Col frequencies */ - -/** [row, col] major frequency to digit mapping */ -static const char freq2digits[DTMF_FREQUENCIES/2][DTMF_FREQUENCIES/2] = - { { '1', '2', '3', 'A' }, - { '4', '5', '6', 'B' }, - { '7', '8', '9', 'C' }, - { '*', '0', '#', 'D' } }; - -/** Media Processing Framework's Dual Tone Multiple Frequncy detector */ -struct mpf_dtmf_detector_t { - /** Mutex to guard the buffer */ - struct apr_thread_mutex_t *mutex; - /** Recognizer band */ - enum mpf_dtmf_detector_band_e band; - /** Detected digits buffer */ - char buf[MPF_DTMFDET_BUFFER_LEN+1]; - /** Number of digits in the buffer */ - apr_size_t digits; - /** Number of lost digits due to full buffer */ - apr_size_t lost_digits; - /** Frequency analyzators */ - struct goertzel_state_t energies[DTMF_FREQUENCIES]; - /** Total energy of signal */ - double totenergy; - /** Number of samples in a window */ - apr_size_t wsamples; - /** Number of samples processed */ - apr_size_t nsamples; - /** Previously detected and last reported digits */ - char last1, last2, curr; -}; - - -MPF_DECLARE(struct mpf_dtmf_detector_t *) mpf_dtmf_detector_create_ex( - const struct mpf_audio_stream_t *stream, - enum mpf_dtmf_detector_band_e band, - struct apr_pool_t *pool) -{ - apr_status_t status; - struct mpf_dtmf_detector_t *det; - int flg_band = band; - - if (!stream->tx_descriptor) flg_band &= ~MPF_DTMF_DETECTOR_INBAND; -/* - Event descriptor is not important actually - if (!stream->tx_event_descriptor) flg_band &= ~MPF_DTMF_DETECTOR_OUTBAND; -*/ - if (!flg_band) return NULL; - - det = apr_palloc(pool, sizeof(mpf_dtmf_detector_t)); - if (!det) return NULL; - status = apr_thread_mutex_create(&det->mutex, APR_THREAD_MUTEX_DEFAULT, pool); - if (status != APR_SUCCESS) return NULL; - - det->band = (enum mpf_dtmf_detector_band_e) flg_band; - det->buf[0] = 0; - det->digits = 0; - det->lost_digits = 0; - - if (det->band & MPF_DTMF_DETECTOR_INBAND) { - apr_size_t i; - for (i = 0; i < DTMF_FREQUENCIES; i++) { - det->energies[i].coef = 2 * cos(2 * M_PI * dtmf_freqs[i] / - stream->tx_descriptor->sampling_rate); - det->energies[i].s1 = 0; - det->energies[i].s2 = 0; - } - det->nsamples = 0; - det->wsamples = GOERTZEL_SAMPLES_8K * (stream->tx_descriptor->sampling_rate / 8000); - det->last1 = det->last2 = det->curr = 0; - det->totenergy = 0; - } - - return det; -} - -MPF_DECLARE(char) mpf_dtmf_detector_digit_get(struct mpf_dtmf_detector_t *detector) -{ - char digit; - apr_thread_mutex_lock(detector->mutex); - digit = detector->buf[0]; - if (digit) { - memmove(detector->buf, detector->buf + 1, strlen(detector->buf)); - detector->digits--; - } - apr_thread_mutex_unlock(detector->mutex); - return digit; -} - -MPF_DECLARE(apr_size_t) mpf_dtmf_detector_digits_lost(const struct mpf_dtmf_detector_t *detector) -{ - return detector->lost_digits; -} - -MPF_DECLARE(void) mpf_dtmf_detector_reset(struct mpf_dtmf_detector_t *detector) -{ - apr_thread_mutex_lock(detector->mutex); - detector->buf[0] = 0; - detector->lost_digits = 0; - detector->digits = 0; - detector->curr = detector->last1 = detector->last2 = 0; - detector->nsamples = 0; - detector->totenergy = 0; - apr_thread_mutex_unlock(detector->mutex); -} - -static APR_INLINE void mpf_dtmf_detector_add_digit( - struct mpf_dtmf_detector_t *detector, - char digit) -{ - if (!digit) return; - apr_thread_mutex_lock(detector->mutex); - if (detector->digits < MPF_DTMFDET_BUFFER_LEN) { - detector->buf[detector->digits++] = digit; - detector->buf[detector->digits] = 0; - } else - detector->lost_digits++; - apr_thread_mutex_unlock(detector->mutex); -} - -static APR_INLINE void goertzel_sample( - struct mpf_dtmf_detector_t *detector, - apr_int16_t sample) -{ - apr_size_t i; - double s; - for (i = 0; i < DTMF_FREQUENCIES; i++) { - s = detector->energies[i].s1; - detector->energies[i].s1 = detector->energies[i].s2; - detector->energies[i].s2 = sample + - detector->energies[i].coef * detector->energies[i].s1 - s; - } - detector->totenergy += sample * sample; -} - -static void goertzel_energies_digit(struct mpf_dtmf_detector_t *detector) -{ - apr_size_t i, rmax = 0, cmax = 0; - double reng = 0, ceng = 0; - char digit = 0; - - /* Calculate energies and maxims */ - for (i = 0; i < DTMF_FREQUENCIES; i++) { - double eng = detector->energies[i].s1 * detector->energies[i].s1 + - detector->energies[i].s2 * detector->energies[i].s2 - - detector->energies[i].coef * detector->energies[i].s1 * detector->energies[i].s2; - if (i < DTMF_FREQUENCIES/2) { - if (eng > reng) { - rmax = i; - reng = eng; - } - } else { - if (eng > ceng) { - cmax = i; - ceng = eng; - } - } - } - - if ((reng < 8.0e10 * detector->wsamples / GOERTZEL_SAMPLES_8K) || - (ceng < 8.0e10 * detector->wsamples / GOERTZEL_SAMPLES_8K)) - { - /* energy not high enough */ - } else if ((ceng > reng) && (reng < ceng * 0.398)) { /* twist > 4dB, error */ - /* Twist check - * CEPT => twist < 6dB - * AT&T => forward twist < 4dB and reverse twist < 8dB - * -ndB < 10 log10( v1 / v2 ), where v1 < v2 - * -4dB < 10 log10( v1 / v2 ) - * -0.4 < log10( v1 / v2 ) - * 0.398 < v1 / v2 - * 0.398 * v2 < v1 - */ - } else if ((ceng < reng) && (ceng < reng * 0.158)) { /* twist > 8db, error */ - /* Reverse twist check failed */ - } else if (0.25 * detector->totenergy > (reng + ceng)) { /* 16db */ - /* Signal energy to total energy ratio test failed */ - } else { - if (cmax >= DTMF_FREQUENCIES/2 && cmax < DTMF_FREQUENCIES) - digit = freq2digits[rmax][cmax - DTMF_FREQUENCIES/2]; - } - - /* Three successive detections will trigger the detection */ - if (digit != detector->curr) { - if (digit && ((detector->last1 == digit) && (detector->last2 == digit))) { - detector->curr = digit; - mpf_dtmf_detector_add_digit(detector, digit); - } else if ((detector->last1 != detector->curr) && (detector->last2 != detector->curr)) { - detector->curr = 0; - } - } - detector->last1 = detector->last2; - detector->last2 = digit; - - /* Reset Goertzel's detectors */ - for (i = 0; i < DTMF_FREQUENCIES; i++) { - detector->energies[i].s1 = 0; - detector->energies[i].s2 = 0; - } - detector->totenergy = 0; -} - -MPF_DECLARE(void) mpf_dtmf_detector_get_frame( - struct mpf_dtmf_detector_t *detector, - const struct mpf_frame_t *frame) -{ - if ((detector->band & MPF_DTMF_DETECTOR_OUTBAND) && - (frame->type & MEDIA_FRAME_TYPE_EVENT) && - (frame->event_frame.event_id <= DTMF_EVENT_ID_MAX) && - (frame->marker == MPF_MARKER_START_OF_EVENT)) - { - if (detector->band & MPF_DTMF_DETECTOR_INBAND) { - detector->band &= ~MPF_DTMF_DETECTOR_INBAND; - apt_log(APT_LOG_MARK, APT_PRIO_INFO, "Out-of-band digit arrived, turning " - "in-band DTMF detector off"); - } - mpf_dtmf_detector_add_digit(detector, mpf_event_id_to_dtmf_char( - frame->event_frame.event_id)); - return; - } - - if ((detector->band & MPF_DTMF_DETECTOR_INBAND) && (frame->type & MEDIA_FRAME_TYPE_AUDIO)) { - apr_int16_t *samples = frame->codec_frame.buffer; - apr_size_t i; - - for (i = 0; i < frame->codec_frame.size / 2; i++) { - goertzel_sample(detector, samples[i]); - if (++detector->nsamples >= detector->wsamples) { - goertzel_energies_digit(detector); - detector->nsamples = 0; - } - } - } -} - -MPF_DECLARE(void) mpf_dtmf_detector_destroy(struct mpf_dtmf_detector_t *detector) -{ - apr_thread_mutex_destroy(detector->mutex); - detector->mutex = NULL; -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_dtmf_generator.c b/libs/unimrcp/libs/mpf/src/mpf_dtmf_generator.c deleted file mode 100644 index b4671adaf1..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_dtmf_generator.c +++ /dev/null @@ -1,349 +0,0 @@ -/* - * Copyright 2009-2010 Tomas Valenta, Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_dtmf_generator.c 2227 2014-11-12 01:10:18Z achaloyan@gmail.com $ - */ - -#include "mpf_dtmf_generator.h" -#include "apr.h" -#include "apr_thread_mutex.h" -#include "apt_log.h" -#include "mpf_named_event.h" -#include - -#ifndef M_PI -# define M_PI 3.141592653589793238462643 -#endif - -/** Max DTMF digits waiting to be sent */ -#define MPF_DTMFGEN_QUEUE_LEN 32 - -/** See RFC4733 */ -#define DTMF_EVENT_ID_MAX 15 /* 0123456789*#ABCD */ - -/** See RFC4733 */ -#define DTMF_EVENT_VOLUME 10 - -/** Amplitude of single sine wave from tone generator */ -#define DTMF_SINE_AMPLITUDE 12288 - -/** State of the DTMF generator */ -typedef enum mpf_dtmf_generator_state_e { - /** Ready to generate next digit in queue */ - DTMF_GEN_STATE_IDLE, - /** Generating tone */ - DTMF_GEN_STATE_TONE, - /** Retransmitting final RTP packet */ - DTMF_GEN_STATE_ENDING, - /** Generating silence between tones */ - DTMF_GEN_STATE_SILENCE -} mpf_dtmf_generator_state_e; - -/** - * Sine wave generator (second-order IIR filter) state: - * - * s(t) = Amp*sin(2*pi*f_tone/f_sampling*t) - * - * s(t) = coef * s(t-1) - s(t-2); s(0)=0; s(1)=Amp*sin(2*pi*f_tone/f_sampling) - */ -typedef struct sine_state_t { - /** coef = cos(2*pi*f_tone/f_sampling) */ - double coef; - /** s(t-2) @see sine_state_t */ - double s1; - /** s(t-1) @see sine_state_t */ - double s2; -} sine_state_t; - -/** Mapping event_id to frequency pair */ -static const double dtmf_freq[DTMF_EVENT_ID_MAX+1][2] = { - {941, 1336}, /* 0 */ - {697, 1209}, /* 1 */ - {697, 1336}, /* 2 */ - {697, 1477}, /* 3 */ - {770, 1209}, /* 4 */ - {770, 1336}, /* 5 */ - {770, 1477}, /* 6 */ - {852, 1209}, /* 7 */ - {852, 1336}, /* 8 */ - {852, 1477}, /* 9 */ - {941, 1209}, /* * */ - {941, 1477}, /* # */ - {697, 1633}, /* A */ - {770, 1633}, /* B */ - {852, 1633}, /* C */ - {941, 1633} /* D */ -}; - -/** Media Processing Framework's Dual Tone Multiple Frequncy generator */ -struct mpf_dtmf_generator_t { - /** Generator state */ - enum mpf_dtmf_generator_state_e state; - /** In-band or out-of-band */ - enum mpf_dtmf_generator_band_e band; - /** Mutex to guard the queue */ - struct apr_thread_mutex_t *mutex; - /** Queue of digits to generate */ - char queue[MPF_DTMFGEN_QUEUE_LEN+1]; - /** DTMF event_id according to RFC4733 */ - apr_byte_t event_id; - /** Duration in RTP units: (sample_rate / 1000) * milliseconds */ - apr_uint32_t tone_duration; - /** Duration of inter-digit silence @see tone_duration */ - apr_uint32_t silence_duration; - /** Multipurpose counter; mostly in RTP time units */ - apr_uint32_t counter; - /** Frame duration in RTP units */ - apr_uint32_t frame_duration; - /** RTP named event duration (0..0xFFFF) */ - apr_uint32_t event_duration; - /** Set MPF_MARKER_NEW_SEGMENT in the next event frame */ - apt_bool_t new_segment; - /** Lower frequency generator */ - struct sine_state_t sine1; - /** Higher frequency generator */ - struct sine_state_t sine2; - /** Sampling rate of audio in Hz; used in tone generator */ - apr_uint32_t sample_rate_audio; - /** Sampling rate of telephone-events in Hz; used for timing */ - apr_uint32_t sample_rate_events; - /** How often to issue event packet */ - apr_uint32_t events_ptime; - /** Milliseconds elapsed since last event packet */ - apr_uint32_t since_last_event; -}; - - -MPF_DECLARE(struct mpf_dtmf_generator_t *) mpf_dtmf_generator_create_ex( - const struct mpf_audio_stream_t *stream, - enum mpf_dtmf_generator_band_e band, - apr_uint32_t tone_ms, - apr_uint32_t silence_ms, - struct apr_pool_t *pool) -{ - struct mpf_dtmf_generator_t *gen; - apr_status_t status; - int flg_band = band; - - if (!stream->rx_descriptor) flg_band &= ~MPF_DTMF_GENERATOR_INBAND; - if (!stream->rx_event_descriptor) flg_band &= ~MPF_DTMF_GENERATOR_OUTBAND; - if (!flg_band) return NULL; - - gen = apr_palloc(pool, sizeof(struct mpf_dtmf_generator_t)); - if (!gen) return NULL; - status = apr_thread_mutex_create(&gen->mutex, APR_THREAD_MUTEX_DEFAULT, pool); - if (status != APR_SUCCESS) return NULL; - gen->band = (enum mpf_dtmf_generator_band_e) flg_band; - gen->queue[0] = 0; - gen->state = DTMF_GEN_STATE_IDLE; - if (stream->rx_descriptor) - gen->sample_rate_audio = stream->rx_descriptor->sampling_rate; - gen->sample_rate_events = stream->rx_event_descriptor ? - stream->rx_event_descriptor->sampling_rate : gen->sample_rate_audio; - gen->frame_duration = gen->sample_rate_events / 1000 * CODEC_FRAME_TIME_BASE; - gen->tone_duration = gen->sample_rate_events / 1000 * tone_ms; - gen->silence_duration = gen->sample_rate_events / 1000 * silence_ms; - gen->events_ptime = CODEC_FRAME_TIME_BASE; /* Should be got from event_descriptor */ - return gen; -} - - -MPF_DECLARE(apt_bool_t) mpf_dtmf_generator_enqueue( - struct mpf_dtmf_generator_t *generator, - const char *digits) -{ - apr_size_t qlen, dlen; - apt_bool_t ret; - - dlen = strlen(digits); - apr_thread_mutex_lock(generator->mutex); - qlen = strlen(generator->queue); - if (qlen + dlen > MPF_DTMFGEN_QUEUE_LEN) { - ret = FALSE; - apt_log(APT_LOG_MARK, APT_PRIO_WARNING, "DTMF queue too short (%d), " - "cannot add %"APR_SIZE_T_FMT" digit%s, already has %"APR_SIZE_T_FMT, - MPF_DTMFGEN_QUEUE_LEN, dlen, dlen > 1 ? "s" : "", qlen); - } else { - strcpy(generator->queue + qlen, digits); - ret = TRUE; - } - apr_thread_mutex_unlock(generator->mutex); - return ret; -} - - -MPF_DECLARE(void) mpf_dtmf_generator_reset(struct mpf_dtmf_generator_t *generator) -{ - apr_thread_mutex_lock(generator->mutex); - generator->state = DTMF_GEN_STATE_IDLE; - generator->queue[0] = 0; - apr_thread_mutex_unlock(generator->mutex); -} - - -MPF_DECLARE(apt_bool_t) mpf_dtmf_generator_sending(const struct mpf_dtmf_generator_t *generator) -{ - return *generator->queue || ((generator->state != DTMF_GEN_STATE_IDLE) && - (generator->state != DTMF_GEN_STATE_SILENCE)); -} - - -MPF_DECLARE(apt_bool_t) mpf_dtmf_generator_put_frame( - struct mpf_dtmf_generator_t *generator, - struct mpf_frame_t *frame) -{ - apr_thread_mutex_lock(generator->mutex); - if ((generator->state == DTMF_GEN_STATE_IDLE) && *generator->queue) { - /* Get next valid digit from queue */ - do { - generator->event_id = (apr_byte_t) mpf_dtmf_char_to_event_id(*generator->queue); - memmove(generator->queue, generator->queue + 1, strlen(generator->queue)); - } while (*generator->queue && (generator->event_id > DTMF_EVENT_ID_MAX)); - /* Reset state */ - if (generator->event_id <= DTMF_EVENT_ID_MAX) { - generator->state = DTMF_GEN_STATE_TONE; - generator->counter = 0; - generator->event_duration = 0; - generator->since_last_event = generator->events_ptime; - generator->new_segment = FALSE; - /* Initialize tone generator */ - if (generator->band & MPF_DTMF_GENERATOR_INBAND) { - double omega; - - omega = 2 * M_PI * dtmf_freq[generator->event_id][0] / generator->sample_rate_audio; - generator->sine1.s1 = 0; - generator->sine1.s2 = DTMF_SINE_AMPLITUDE * sin(omega); - generator->sine1.coef = 2 * cos(omega); - - omega = 2 * M_PI * dtmf_freq[generator->event_id][1] / generator->sample_rate_audio; - generator->sine2.s1 = 0; - generator->sine2.s2 = DTMF_SINE_AMPLITUDE * sin(omega); - generator->sine2.coef = 2 * cos(omega); - } - } - } - apr_thread_mutex_unlock(generator->mutex); - if (generator->state == DTMF_GEN_STATE_IDLE) return FALSE; - - if (generator->state == DTMF_GEN_STATE_TONE) { - generator->counter += generator->frame_duration; - generator->event_duration += generator->frame_duration; - if (generator->band & MPF_DTMF_GENERATOR_INBAND) { - apr_size_t i; - apr_int16_t *samples = (apr_int16_t *) frame->codec_frame.buffer; - double s; - - frame->type |= MEDIA_FRAME_TYPE_AUDIO; - /* Tone generator */ - for (i = 0; i < frame->codec_frame.size / 2; i++) { - s = generator->sine1.s1; - generator->sine1.s1 = generator->sine1.s2; - generator->sine1.s2 = generator->sine1.coef * generator->sine1.s1 - s; - samples[i] = (apr_int16_t) (s + generator->sine2.s1); - s = generator->sine2.s1; - generator->sine2.s1 = generator->sine2.s2; - generator->sine2.s2 = generator->sine2.coef * generator->sine2.s1 - s; - } - } - if (generator->band & MPF_DTMF_GENERATOR_OUTBAND) { - generator->since_last_event += CODEC_FRAME_TIME_BASE; - if (generator->since_last_event >= generator->events_ptime) - generator->since_last_event = 0; - else - return TRUE; - frame->type |= MEDIA_FRAME_TYPE_EVENT; - frame->event_frame.reserved = 0; - frame->event_frame.event_id = generator->event_id; - frame->event_frame.volume = DTMF_EVENT_VOLUME; - if (generator->counter >= generator->tone_duration) { - generator->state = DTMF_GEN_STATE_ENDING; - generator->counter = 0; - frame->event_frame.edge = 1; - frame->marker = MPF_MARKER_END_OF_EVENT; - if (generator->event_duration > 0xFFFF) { - /* Shorten the tone a bit instead of lenghtening */ - generator->new_segment = TRUE; - frame->event_frame.duration = 0xFFFF; - generator->event_duration = 0; - } else - frame->event_frame.duration = generator->event_duration; - } else { - frame->event_frame.edge = 0; - if (generator->counter == generator->frame_duration) /* First chunk of event */ - frame->marker = MPF_MARKER_START_OF_EVENT; - else if (generator->new_segment) { - frame->marker = MPF_MARKER_NEW_SEGMENT; - generator->new_segment = FALSE; - } else - frame->marker = MPF_MARKER_NONE; - if (generator->event_duration > 0xFFFF) { - frame->event_frame.duration = 0xFFFF; - generator->event_duration = 0; - generator->new_segment = TRUE; - } else - frame->event_frame.duration = generator->event_duration; - } - return TRUE; - } /* MPF_DTMF_GENERATOR_OUTBAND */ - if (generator->counter >= generator->tone_duration) { - generator->state = DTMF_GEN_STATE_SILENCE; - generator->counter = 0; - } - return TRUE; - } - else if (generator->state == DTMF_GEN_STATE_ENDING) { - generator->since_last_event += CODEC_FRAME_TIME_BASE; - if (generator->since_last_event >= generator->events_ptime) - generator->since_last_event = 0; - else - return TRUE; - generator->counter++; - frame->type |= MEDIA_FRAME_TYPE_EVENT; - frame->marker = MPF_MARKER_END_OF_EVENT; - frame->event_frame.event_id = generator->event_id; - frame->event_frame.volume = DTMF_EVENT_VOLUME; - frame->event_frame.reserved = 0; - frame->event_frame.edge = 1; - if (generator->new_segment) - /* Tone was shortened a little bit */ - frame->event_frame.duration = 0xFFFF; - else - frame->event_frame.duration = generator->event_duration; - if (generator->counter >= 2) { - generator->state = DTMF_GEN_STATE_SILENCE; - generator->counter *= generator->frame_duration; - } - if (generator->band & MPF_DTMF_GENERATOR_INBAND) { - frame->type |= MEDIA_FRAME_TYPE_AUDIO; - memset(frame->codec_frame.buffer, 0, frame->codec_frame.size); - } - return TRUE; - } - else if (generator->state == DTMF_GEN_STATE_SILENCE) { - generator->counter += generator->frame_duration; - if (generator->counter >= generator->silence_duration) - generator->state = DTMF_GEN_STATE_IDLE; - } - - return FALSE; -} - - -MPF_DECLARE(void) mpf_dtmf_generator_destroy(struct mpf_dtmf_generator_t *generator) -{ - mpf_dtmf_generator_reset(generator); - apr_thread_mutex_destroy(generator->mutex); - generator->mutex = NULL; -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_encoder.c b/libs/unimrcp/libs/mpf/src/mpf_encoder.c deleted file mode 100644 index cd5837725e..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_encoder.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_encoder.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mpf_encoder.h" -#include "apt_log.h" - -typedef struct mpf_encoder_t mpf_encoder_t; - -struct mpf_encoder_t { - mpf_audio_stream_t *base; - mpf_audio_stream_t *sink; - mpf_codec_t *codec; - mpf_frame_t frame_out; -}; - - -static apt_bool_t mpf_encoder_destroy(mpf_audio_stream_t *stream) -{ - mpf_encoder_t *encoder = stream->obj; - return mpf_audio_stream_destroy(encoder->sink); -} - -static apt_bool_t mpf_encoder_open(mpf_audio_stream_t *stream, mpf_codec_t *codec) -{ - mpf_encoder_t *encoder = stream->obj; - mpf_codec_open(encoder->codec); - return mpf_audio_stream_tx_open(encoder->sink,encoder->codec); -} - -static apt_bool_t mpf_encoder_close(mpf_audio_stream_t *stream) -{ - mpf_encoder_t *encoder = stream->obj; - mpf_codec_close(encoder->codec); - return mpf_audio_stream_tx_close(encoder->sink); -} - -static apt_bool_t mpf_encoder_process(mpf_audio_stream_t *stream, const mpf_frame_t *frame) -{ - mpf_encoder_t *encoder = stream->obj; - - encoder->frame_out.type = frame->type; - encoder->frame_out.marker = frame->marker; - if((frame->type & MEDIA_FRAME_TYPE_EVENT) == MEDIA_FRAME_TYPE_EVENT) { - encoder->frame_out.event_frame = frame->event_frame; - } - if((frame->type & MEDIA_FRAME_TYPE_AUDIO) == MEDIA_FRAME_TYPE_AUDIO) { - mpf_codec_encode(encoder->codec,&frame->codec_frame,&encoder->frame_out.codec_frame); - } - return mpf_audio_stream_frame_write(encoder->sink,&encoder->frame_out); -} - -static void mpf_encoder_trace(mpf_audio_stream_t *stream, mpf_stream_direction_e direction, apt_text_stream_t *output) -{ - apr_size_t offset; - mpf_codec_descriptor_t *descriptor; - mpf_encoder_t *encoder = stream->obj; - - descriptor = encoder->base->tx_descriptor; - if(descriptor) { - offset = output->pos - output->text.buf; - output->pos += apr_snprintf(output->pos, output->text.length - offset, - "[%s/%d/%d]->Encoder->", - descriptor->name.buf, - descriptor->sampling_rate, - descriptor->channel_count); - } - - mpf_audio_stream_trace(encoder->sink,direction,output); -} - - -static const mpf_audio_stream_vtable_t vtable = { - mpf_encoder_destroy, - NULL, - NULL, - NULL, - mpf_encoder_open, - mpf_encoder_close, - mpf_encoder_process, - mpf_encoder_trace -}; - -MPF_DECLARE(mpf_audio_stream_t*) mpf_encoder_create(mpf_audio_stream_t *sink, mpf_codec_t *codec, apr_pool_t *pool) -{ - apr_size_t frame_size; - mpf_encoder_t *encoder; - mpf_stream_capabilities_t *capabilities; - if(!sink || !codec) { - return NULL; - } - encoder = apr_palloc(pool,sizeof(mpf_encoder_t)); - capabilities = mpf_stream_capabilities_create(STREAM_DIRECTION_SEND,pool); - encoder->base = mpf_audio_stream_create(encoder,&vtable,capabilities,pool); - if(!encoder->base) { - return NULL; - } - encoder->base->tx_descriptor = mpf_codec_lpcm_descriptor_create( - sink->tx_descriptor->sampling_rate, - sink->tx_descriptor->channel_count, - pool); - encoder->base->tx_event_descriptor = sink->tx_event_descriptor; - - encoder->sink = sink; - encoder->codec = codec; - - frame_size = mpf_codec_frame_size_calculate(sink->tx_descriptor,codec->attribs); - encoder->frame_out.codec_frame.size = frame_size; - encoder->frame_out.codec_frame.buffer = apr_palloc(pool,frame_size); - return encoder->base; -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_engine.c b/libs/unimrcp/libs/mpf/src/mpf_engine.c deleted file mode 100644 index 60240cb9bb..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_engine.c +++ /dev/null @@ -1,453 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_engine.c 2226 2014-11-12 00:47:40Z achaloyan@gmail.com $ - */ - -#include "mpf_engine.h" -#include "mpf_context.h" -#include "mpf_termination.h" -#include "mpf_stream.h" -#include "mpf_scheduler.h" -#include "mpf_codec_descriptor.h" -#include "mpf_codec_manager.h" -#include "apt_obj_list.h" -#include "apt_cyclic_queue.h" -#include "apt_log.h" - -#define MPF_TIMER_RESOLUTION 100 /* 100 ms */ - -struct mpf_engine_t { - apr_pool_t *pool; - apt_task_t *task; - apt_task_msg_type_e task_msg_type; - apr_thread_mutex_t *request_queue_guard; - apt_cyclic_queue_t *request_queue; - mpf_context_factory_t *context_factory; - mpf_scheduler_t *scheduler; - apt_timer_queue_t *timer_queue; - const mpf_codec_manager_t *codec_manager; -}; - -static void mpf_engine_main(mpf_scheduler_t *scheduler, void *obj); -static void mpf_engine_timer_proc(mpf_scheduler_t *scheduler, void *obj); -static apt_bool_t mpf_engine_destroy(apt_task_t *task); -static apt_bool_t mpf_engine_start(apt_task_t *task); -static apt_bool_t mpf_engine_terminate(apt_task_t *task); -static apt_bool_t mpf_engine_msg_signal(apt_task_t *task, apt_task_msg_t *msg); -static apt_bool_t mpf_engine_msg_process(apt_task_t *task, apt_task_msg_t *msg); - - -mpf_codec_t* mpf_codec_l16_create(apr_pool_t *pool); -mpf_codec_t* mpf_codec_g711u_create(apr_pool_t *pool); -mpf_codec_t* mpf_codec_g711a_create(apr_pool_t *pool); - -MPF_DECLARE(mpf_engine_t*) mpf_engine_create(const char *id, apr_pool_t *pool) -{ - apt_task_vtable_t *vtable; - apt_task_msg_pool_t *msg_pool; - mpf_engine_t *engine = apr_palloc(pool,sizeof(mpf_engine_t)); - engine->pool = pool; - engine->request_queue = NULL; - engine->context_factory = NULL; - engine->codec_manager = NULL; - - msg_pool = apt_task_msg_pool_create_dynamic(sizeof(mpf_message_container_t),pool); - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create Media Engine [%s]",id); - engine->task = apt_task_create(engine,msg_pool,pool); - if(!engine->task) { - return NULL; - } - - apt_task_name_set(engine->task,id); - - vtable = apt_task_vtable_get(engine->task); - if(vtable) { - vtable->destroy = mpf_engine_destroy; - vtable->start = mpf_engine_start; - vtable->terminate = mpf_engine_terminate; - vtable->signal_msg = mpf_engine_msg_signal; - vtable->process_msg = mpf_engine_msg_process; - } - - engine->task_msg_type = TASK_MSG_USER; - - engine->context_factory = mpf_context_factory_create(engine->pool); - engine->request_queue = apt_cyclic_queue_create(CYCLIC_QUEUE_DEFAULT_SIZE); - apr_thread_mutex_create(&engine->request_queue_guard,APR_THREAD_MUTEX_UNNESTED,engine->pool); - - engine->scheduler = mpf_scheduler_create(engine->pool); - mpf_scheduler_media_clock_set(engine->scheduler,CODEC_FRAME_TIME_BASE,mpf_engine_main,engine); - - engine->timer_queue = apt_timer_queue_create(engine->pool); - mpf_scheduler_timer_clock_set(engine->scheduler,MPF_TIMER_RESOLUTION,mpf_engine_timer_proc,engine); - return engine; -} - -MPF_DECLARE(mpf_context_t*) mpf_engine_context_create( - mpf_engine_t *engine, - const char *name, - void *obj, - apr_size_t max_termination_count, - apr_pool_t *pool) -{ - return mpf_context_create(engine->context_factory,name,obj,max_termination_count,pool); -} - -MPF_DECLARE(apt_bool_t) mpf_engine_context_destroy(mpf_context_t *context) -{ - return mpf_context_destroy(context); -} - -MPF_DECLARE(void*) mpf_engine_context_object_get(const mpf_context_t *context) -{ - return mpf_context_object_get(context); -} - -MPF_DECLARE(apt_task_t*) mpf_task_get(const mpf_engine_t *engine) -{ - return engine->task; -} - -MPF_DECLARE(void) mpf_engine_task_msg_type_set(mpf_engine_t *engine, apt_task_msg_type_e type) -{ - engine->task_msg_type = type; -} - -static mpf_message_t* mpf_engine_message_get(mpf_engine_t *engine, mpf_task_msg_t **task_msg) -{ - mpf_message_container_t *container; - mpf_message_t *mpf_message; - if(*task_msg) { - container = (mpf_message_container_t*) (*task_msg)->data; - if(container->count >= MAX_MPF_MESSAGE_COUNT) { - /* container has been already filled, - implicitly send the requests and get new task message */ - mpf_engine_message_send(engine,task_msg); - return mpf_engine_message_get(engine,task_msg); - } - } - else { - *task_msg = apt_task_msg_get(engine->task); - container = (mpf_message_container_t*) (*task_msg)->data; - container->count = 0; - } - - mpf_message = &container->messages[container->count]; - container->count++; - return mpf_message; -} - - -MPF_DECLARE(apt_bool_t) mpf_engine_termination_message_add( - mpf_engine_t *engine, - mpf_command_type_e command_id, - mpf_context_t *context, - mpf_termination_t *termination, - void *descriptor, - mpf_task_msg_t **task_msg) -{ - mpf_message_t *mpf_message = mpf_engine_message_get(engine,task_msg); - if(!mpf_message) { - return FALSE; - } - mpf_message->message_type = MPF_MESSAGE_TYPE_REQUEST; - mpf_message->command_id = command_id; - mpf_message->context = context; - mpf_message->termination = termination; - mpf_message->assoc_termination = NULL; - mpf_message->descriptor = descriptor; - return TRUE; -} - -MPF_DECLARE(apt_bool_t) mpf_engine_assoc_message_add( - mpf_engine_t *engine, - mpf_command_type_e command_id, - mpf_context_t *context, - mpf_termination_t *termination, - mpf_termination_t *assoc_termination, - mpf_task_msg_t **task_msg) -{ - mpf_message_t *mpf_message = mpf_engine_message_get(engine,task_msg); - if(!mpf_message) { - return FALSE; - } - mpf_message->message_type = MPF_MESSAGE_TYPE_REQUEST; - mpf_message->command_id = command_id; - mpf_message->context = context; - mpf_message->termination = termination; - mpf_message->assoc_termination = assoc_termination; - mpf_message->descriptor = NULL; - return TRUE; -} - -MPF_DECLARE(apt_bool_t) mpf_engine_topology_message_add( - mpf_engine_t *engine, - mpf_command_type_e command_id, - mpf_context_t *context, - mpf_task_msg_t **task_msg) -{ - mpf_message_t *mpf_message = mpf_engine_message_get(engine,task_msg); - if(!mpf_message) { - return FALSE; - } - mpf_message->message_type = MPF_MESSAGE_TYPE_REQUEST; - mpf_message->command_id = command_id; - mpf_message->context = context; - mpf_message->termination = NULL; - mpf_message->assoc_termination = NULL; - mpf_message->descriptor = NULL; - return TRUE; -} - -MPF_DECLARE(apt_bool_t) mpf_engine_message_send(mpf_engine_t *engine, mpf_task_msg_t **task_msg) -{ - apt_bool_t status = FALSE; - if(*task_msg) { - status = apt_task_msg_signal(engine->task,*task_msg); - *task_msg = NULL; - } - return status; -} - -static apt_bool_t mpf_engine_destroy(apt_task_t *task) -{ - mpf_engine_t *engine = apt_task_object_get(task); - - apt_timer_queue_destroy(engine->timer_queue); - mpf_scheduler_destroy(engine->scheduler); - mpf_context_factory_destroy(engine->context_factory); - apt_cyclic_queue_destroy(engine->request_queue); - apr_thread_mutex_destroy(engine->request_queue_guard); - return TRUE; -} - -static apt_bool_t mpf_engine_start(apt_task_t *task) -{ - mpf_engine_t *engine = apt_task_object_get(task); - - mpf_scheduler_start(engine->scheduler); - apt_task_start_request_process(task); - return TRUE; -} - -static apt_bool_t mpf_engine_terminate(apt_task_t *task) -{ - mpf_engine_t *engine = apt_task_object_get(task); - - mpf_scheduler_stop(engine->scheduler); - apt_task_terminate_request_process(task); - return TRUE; -} - -static apt_bool_t mpf_engine_event_raise(mpf_termination_t *termination, int event_id, void *descriptor) -{ - apt_task_msg_t *task_msg; - mpf_message_container_t *event_msg; - mpf_message_t *mpf_message; - mpf_engine_t *engine; - engine = termination->media_engine; - if(!engine) { - return FALSE; - } - - task_msg = apt_task_msg_get(engine->task); - if(!task_msg) { - return FALSE; - } - task_msg->type = engine->task_msg_type; - event_msg = (mpf_message_container_t*) task_msg->data; - mpf_message = event_msg->messages; - event_msg->count = 1; - - mpf_message->command_id = event_id; - mpf_message->message_type = MPF_MESSAGE_TYPE_EVENT; - mpf_message->status_code = MPF_STATUS_CODE_SUCCESS; - mpf_message->context = NULL; - mpf_message->termination = termination; - mpf_message->descriptor = descriptor; - - return apt_task_msg_parent_signal(engine->task,task_msg); -} - -static apt_bool_t mpf_engine_msg_signal(apt_task_t *task, apt_task_msg_t *msg) -{ - mpf_engine_t *engine = apt_task_object_get(task); - - apr_thread_mutex_lock(engine->request_queue_guard); - if(apt_cyclic_queue_push(engine->request_queue,msg) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_ERROR,"MPF Request Queue is Full [%s]",apt_task_name_get(task)); - } - apr_thread_mutex_unlock(engine->request_queue_guard); - return TRUE; -} - -static apt_bool_t mpf_engine_msg_process(apt_task_t *task, apt_task_msg_t *msg) -{ - apr_size_t i; - mpf_engine_t *engine = apt_task_object_get(task); - apt_task_msg_t *response_msg; - mpf_message_container_t *response; - mpf_message_t *mpf_response; - mpf_context_t *context; - mpf_termination_t *termination; - const mpf_message_t *mpf_request; - const mpf_message_container_t *request = (const mpf_message_container_t*) msg->data; - - response_msg = apt_task_msg_get(engine->task); - if(!response_msg) { - return FALSE; - } - response_msg->type = engine->task_msg_type; - response = (mpf_message_container_t*) response_msg->data; - *response = *request; - for(i=0; icount; i++) { - mpf_request = &request->messages[i]; - mpf_response = &response->messages[i]; - - if(mpf_request->message_type != MPF_MESSAGE_TYPE_REQUEST) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid MPF Message Type [%d]",mpf_request->message_type); - continue; - } - - mpf_response->message_type = MPF_MESSAGE_TYPE_RESPONSE; - mpf_response->status_code = MPF_STATUS_CODE_SUCCESS; - context = mpf_request->context; - termination = mpf_request->termination; - switch(mpf_request->command_id) { - case MPF_ADD_TERMINATION: - { - termination->media_engine = engine; - termination->event_handler = mpf_engine_event_raise; - termination->codec_manager = engine->codec_manager; - termination->timer_queue = engine->timer_queue; - - mpf_termination_add(termination,mpf_request->descriptor); - if(mpf_context_termination_add(context,termination) == FALSE) { - mpf_termination_subtract(termination); - mpf_response->status_code = MPF_STATUS_CODE_FAILURE; - break; - } - break; - } - case MPF_MODIFY_TERMINATION: - { - mpf_termination_modify(termination,mpf_request->descriptor); - break; - } - case MPF_SUBTRACT_TERMINATION: - { - if(mpf_context_termination_subtract(context,termination) == FALSE) { - mpf_response->status_code = MPF_STATUS_CODE_FAILURE; - break; - } - mpf_termination_subtract(termination); - break; - } - case MPF_ADD_ASSOCIATION: - { - mpf_context_association_add(context,termination,mpf_request->assoc_termination); - break; - } - case MPF_REMOVE_ASSOCIATION: - { - mpf_context_association_remove(context,termination,mpf_request->assoc_termination); - break; - } - case MPF_RESET_ASSOCIATIONS: - { - mpf_context_associations_reset(context); - break; - } - case MPF_APPLY_TOPOLOGY: - { - mpf_context_topology_apply(context); - break; - } - case MPF_DESTROY_TOPOLOGY: - { - mpf_context_topology_destroy(context); - break; - } - default: - { - mpf_response->status_code = MPF_STATUS_CODE_FAILURE; - } - } - } - - return apt_task_msg_parent_signal(engine->task,response_msg); -} - -static void mpf_engine_main(mpf_scheduler_t *scheduler, void *obj) -{ - mpf_engine_t *engine = obj; - apt_task_msg_t *msg; - - /* process request queue */ - apr_thread_mutex_lock(engine->request_queue_guard); - msg = apt_cyclic_queue_pop(engine->request_queue); - while(msg) { - apr_thread_mutex_unlock(engine->request_queue_guard); - apt_task_msg_process(engine->task,msg); - apr_thread_mutex_lock(engine->request_queue_guard); - msg = apt_cyclic_queue_pop(engine->request_queue); - } - apr_thread_mutex_unlock(engine->request_queue_guard); - - /* process factory of media contexts */ - mpf_context_factory_process(engine->context_factory); -} - -static void mpf_engine_timer_proc(mpf_scheduler_t *scheduler, void *obj) -{ - mpf_engine_t *engine = obj; - apt_timer_queue_advance(engine->timer_queue,MPF_TIMER_RESOLUTION); -} - -MPF_DECLARE(mpf_codec_manager_t*) mpf_engine_codec_manager_create(apr_pool_t *pool) -{ - mpf_codec_manager_t *codec_manager = mpf_codec_manager_create(4,pool); - if(codec_manager) { - mpf_codec_t *codec; - - codec = mpf_codec_g711u_create(pool); - mpf_codec_manager_codec_register(codec_manager,codec); - - codec = mpf_codec_g711a_create(pool); - mpf_codec_manager_codec_register(codec_manager,codec); - - codec = mpf_codec_l16_create(pool); - mpf_codec_manager_codec_register(codec_manager,codec); - } - return codec_manager; -} - -MPF_DECLARE(apt_bool_t) mpf_engine_codec_manager_register(mpf_engine_t *engine, const mpf_codec_manager_t *codec_manager) -{ - engine->codec_manager = codec_manager; - return TRUE; -} - -MPF_DECLARE(apt_bool_t) mpf_engine_scheduler_rate_set(mpf_engine_t *engine, unsigned long rate) -{ - return mpf_scheduler_rate_set(engine->scheduler,rate); -} - -MPF_DECLARE(const char*) mpf_engine_id_get(const mpf_engine_t *engine) -{ - return apt_task_name_get(engine->task); -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_engine_factory.c b/libs/unimrcp/libs/mpf/src/mpf_engine_factory.c deleted file mode 100644 index 91174dce94..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_engine_factory.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_engine_factory.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include "mpf_engine_factory.h" -#include "mpf_termination_factory.h" - -/** Factory of media engines */ -struct mpf_engine_factory_t { - /** Array of pointers to media engines */ - apr_array_header_t *engines_arr; - /** Index of the current engine */ - int index; -}; - -/** Create factory of media engines. */ -MPF_DECLARE(mpf_engine_factory_t*) mpf_engine_factory_create(apr_pool_t *pool) -{ - mpf_engine_factory_t *mpf_factory = apr_palloc(pool,sizeof(mpf_engine_factory_t)); - mpf_factory->engines_arr = apr_array_make(pool,1,sizeof(mpf_engine_t*)); - mpf_factory->index = 0; - return mpf_factory; -} - -/** Add media engine to factory. */ -MPF_DECLARE(apt_bool_t) mpf_engine_factory_engine_add(mpf_engine_factory_t *mpf_factory, mpf_engine_t *media_engine) -{ - mpf_engine_t **slot; - if(!media_engine) - return FALSE; - - slot = apr_array_push(mpf_factory->engines_arr); - *slot = media_engine; - return TRUE; -} - -/** Determine whether factory is empty. */ -MPF_DECLARE(apt_bool_t) mpf_engine_factory_is_empty(const mpf_engine_factory_t *mpf_factory) -{ - return apr_is_empty_array(mpf_factory->engines_arr); -} - -/** Select next available media engine. */ -MPF_DECLARE(mpf_engine_t*) mpf_engine_factory_engine_select(mpf_engine_factory_t *mpf_factory) -{ - mpf_engine_t *media_engine = APR_ARRAY_IDX(mpf_factory->engines_arr, mpf_factory->index, mpf_engine_t*); - if(++mpf_factory->index == mpf_factory->engines_arr->nelts) { - mpf_factory->index = 0; - } - return media_engine; -} - -/** Associate media engines with RTP termination factory. */ -MPF_DECLARE(apt_bool_t) mpf_engine_factory_rtp_factory_assign(mpf_engine_factory_t *mpf_factory, mpf_termination_factory_t *rtp_factory) -{ - int i; - mpf_engine_t *media_engine; - for(i=0; iengines_arr->nelts; i++) { - media_engine = APR_ARRAY_IDX(mpf_factory->engines_arr, i, mpf_engine_t*); - mpf_termination_factory_engine_assign(rtp_factory,media_engine); - } - return TRUE; -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_file_termination_factory.c b/libs/unimrcp/libs/mpf/src/mpf_file_termination_factory.c deleted file mode 100644 index e6170a6aa8..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_file_termination_factory.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_file_termination_factory.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mpf_termination.h" -#include "mpf_file_termination_factory.h" -#include "mpf_audio_file_stream.h" - -static apt_bool_t mpf_file_termination_destroy(mpf_termination_t *termination) -{ - return TRUE; -} - -static apt_bool_t mpf_file_termination_add(mpf_termination_t *termination, void *descriptor) -{ - apt_bool_t status = TRUE; - mpf_audio_stream_t *audio_stream = termination->audio_stream; - if(!audio_stream) { - audio_stream = mpf_file_stream_create(termination,termination->pool); - if(!audio_stream) { - return FALSE; - } - termination->audio_stream = audio_stream; - } - - if(descriptor) { - status = mpf_file_stream_modify(audio_stream,descriptor); - } - return status; -} - -static apt_bool_t mpf_file_termination_modify(mpf_termination_t *termination, void *descriptor) -{ - apt_bool_t status = TRUE; - mpf_audio_stream_t *audio_stream = termination->audio_stream; - if(!audio_stream) { - return FALSE; - } - - if(descriptor) { - status = mpf_file_stream_modify(audio_stream,descriptor); - } - return status; -} - -static apt_bool_t mpf_file_termination_subtract(mpf_termination_t *termination) -{ - return TRUE; -} - -static const mpf_termination_vtable_t file_vtable = { - mpf_file_termination_destroy, - mpf_file_termination_add, - mpf_file_termination_modify, - mpf_file_termination_subtract -}; - -static mpf_termination_t* mpf_file_termination_create( - mpf_termination_factory_t *termination_factory, - void *obj, - apr_pool_t *pool) -{ - return mpf_termination_base_create(termination_factory,obj,&file_vtable,NULL,NULL,pool); -} - -MPF_DECLARE(mpf_termination_factory_t*) mpf_file_termination_factory_create(apr_pool_t *pool) -{ - mpf_termination_factory_t *file_termination_factory = apr_palloc(pool,sizeof(mpf_termination_factory_t)); - file_termination_factory->create_termination = mpf_file_termination_create; - file_termination_factory->assign_engine = NULL; - return file_termination_factory; -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_frame_buffer.c b/libs/unimrcp/libs/mpf/src/mpf_frame_buffer.c deleted file mode 100644 index 3669db37c2..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_frame_buffer.c +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_frame_buffer.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mpf_frame_buffer.h" - -struct mpf_frame_buffer_t { - apr_byte_t *raw_data; - mpf_frame_t *frames; - apr_size_t frame_count; - apr_size_t frame_size; - - apr_size_t write_pos; - apr_size_t read_pos; - - apr_thread_mutex_t *guard; - apr_pool_t *pool; - -#ifdef MPF_FRAME_BUFFER_DEBUG - FILE *utt_in; - FILE *utt_out; -#endif -}; - - -mpf_frame_buffer_t* mpf_frame_buffer_create(apr_size_t frame_size, apr_size_t frame_count, apr_pool_t *pool) -{ - apr_size_t i; - mpf_frame_t *frame; - mpf_frame_buffer_t *buffer = apr_palloc(pool,sizeof(mpf_frame_buffer_t)); - buffer->pool = pool; - - buffer->frame_size = frame_size; - buffer->frame_count = frame_count; - buffer->raw_data = apr_palloc(pool,buffer->frame_size*buffer->frame_count); - buffer->frames = apr_palloc(pool,sizeof(mpf_frame_t)*buffer->frame_count); - for(i=0; iframe_count; i++) { - frame = &buffer->frames[i]; - frame->type = MEDIA_FRAME_TYPE_NONE; - frame->marker = MPF_MARKER_NONE; - frame->codec_frame.buffer = buffer->raw_data + i*buffer->frame_size; - } - - buffer->write_pos = buffer->read_pos = 0; - apr_thread_mutex_create(&buffer->guard,APR_THREAD_MUTEX_UNNESTED,pool); - -#ifdef MPF_FRAME_BUFFER_DEBUG - buffer->utt_in = NULL; - buffer->utt_out = NULL; -#endif - return buffer; -} - -#ifdef MPF_FRAME_BUFFER_DEBUG -static apr_status_t mpf_frame_buffer_file_close(void *obj) -{ - mpf_frame_buffer_t *buffer = obj; - if(buffer->utt_out) { - fclose(buffer->utt_out); - buffer->utt_out = NULL; - } - if(buffer->utt_in) { - fclose(buffer->utt_in); - buffer->utt_in = NULL; - } - return APR_SUCCESS; -} - -apt_bool_t mpf_frame_buffer_file_open(mpf_frame_buffer_t *buffer, const char *utt_file_in, const char *utt_file_out) -{ - buffer->utt_in = fopen(utt_file_in,"wb"); - if(!buffer->utt_in) - return FALSE; - - buffer->utt_out = fopen(utt_file_out,"wb"); - if(!buffer->utt_out) - return FALSE; - - apr_pool_cleanup_register(buffer->pool,buffer,mpf_frame_buffer_file_close,NULL); - return TRUE; -} -#endif - -void mpf_frame_buffer_destroy(mpf_frame_buffer_t *buffer) -{ - if(buffer->guard) { - apr_thread_mutex_destroy(buffer->guard); - buffer->guard = NULL; - } -} - -apt_bool_t mpf_frame_buffer_restart(mpf_frame_buffer_t *buffer) -{ - buffer->write_pos = buffer->read_pos; - return TRUE; -} - -static APR_INLINE mpf_frame_t* mpf_frame_buffer_frame_get(mpf_frame_buffer_t *buffer, apr_size_t pos) -{ - apr_size_t index = pos % buffer->frame_count; - return &buffer->frames[index]; -} - -apt_bool_t mpf_frame_buffer_write(mpf_frame_buffer_t *buffer, const mpf_frame_t *frame) -{ - mpf_frame_t *write_frame; - void *data = frame->codec_frame.buffer; - apr_size_t size = frame->codec_frame.size; - -#ifdef MPF_FRAME_BUFFER_DEBUG - if(buffer->utt_in) { - fwrite(data,1,size,buffer->utt_in); - } -#endif - - apr_thread_mutex_lock(buffer->guard); - while(buffer->write_pos - buffer->read_pos < buffer->frame_count && size >= buffer->frame_size) { - write_frame = mpf_frame_buffer_frame_get(buffer,buffer->write_pos); - write_frame->type = frame->type; - write_frame->codec_frame.size = buffer->frame_size; - memcpy( - write_frame->codec_frame.buffer, - data, - write_frame->codec_frame.size); - - data = (char*)data + buffer->frame_size; - size -= buffer->frame_size; - buffer->write_pos ++; - } - - apr_thread_mutex_unlock(buffer->guard); - /* if size != 0 => non frame alligned or buffer is full */ - return size == 0 ? TRUE : FALSE; -} - -apt_bool_t mpf_frame_buffer_read(mpf_frame_buffer_t *buffer, mpf_frame_t *media_frame) -{ - apr_thread_mutex_lock(buffer->guard); - if(buffer->write_pos > buffer->read_pos) { - /* normal read */ - mpf_frame_t *src_media_frame = mpf_frame_buffer_frame_get(buffer,buffer->read_pos); - media_frame->type = src_media_frame->type; - media_frame->marker = src_media_frame->marker; - if(media_frame->type & MEDIA_FRAME_TYPE_AUDIO) { - media_frame->codec_frame.size = src_media_frame->codec_frame.size; - memcpy( - media_frame->codec_frame.buffer, - src_media_frame->codec_frame.buffer, - media_frame->codec_frame.size); -#ifdef MPF_FRAME_BUFFER_DEBUG - if(buffer->utt_out) { - fwrite(media_frame->codec_frame.buffer,1,media_frame->codec_frame.size,buffer->utt_out); - } -#endif - } - if(media_frame->type & MEDIA_FRAME_TYPE_EVENT) { - media_frame->event_frame = src_media_frame->event_frame; - } - src_media_frame->type = MEDIA_FRAME_TYPE_NONE; - src_media_frame->marker = MPF_MARKER_NONE; - buffer->read_pos ++; - } - else { - /* underflow */ - media_frame->type = MEDIA_FRAME_TYPE_NONE; - media_frame->marker = MPF_MARKER_NONE; - } - apr_thread_mutex_unlock(buffer->guard); - return TRUE; -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_jitter_buffer.c b/libs/unimrcp/libs/mpf/src/mpf_jitter_buffer.c deleted file mode 100644 index f84521a336..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_jitter_buffer.c +++ /dev/null @@ -1,510 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_jitter_buffer.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mpf_jitter_buffer.h" -#include "mpf_trace.h" - -#if ENABLE_JB_TRACE == 1 -#define JB_TRACE printf -#elif ENABLE_JB_TRACE == 2 -#define JB_TRACE mpf_debug_output_trace -#else -#define JB_TRACE mpf_null_trace -#endif - -struct mpf_jitter_buffer_t { - /* jitter buffer config */ - mpf_jb_config_t *config; - /* codec to be used to dissect payload */ - mpf_codec_t *codec; - - /* cyclic raw data */ - apr_byte_t *raw_data; - /* frames (out of raw data) */ - mpf_frame_t *frames; - /* number of frames */ - apr_size_t frame_count; - /* frame timestamp units (samples) */ - apr_uint32_t frame_ts; - /* frame size in bytes */ - apr_size_t frame_size; - - /* playout delay in timetsamp units */ - apr_uint32_t playout_delay_ts; - /* max playout delay in timetsamp units */ - apr_uint32_t max_playout_delay_ts; - - /* write should be synchronized (offset calculated) */ - apr_byte_t write_sync; - /* write timestamp offset */ - apr_int32_t write_ts_offset; - - /* write pointer in timestamp units */ - apr_uint32_t write_ts; - /* read pointer in timestamp units */ - apr_uint32_t read_ts; - - /* min length of the buffer in timestamp units */ - apr_int32_t min_length_ts; - /* max length of the buffer in timestamp units */ - apr_int32_t max_length_ts; - /* number of statistical measurements made */ - apr_uint32_t measurment_count; - - /* timestamp event starts at */ - apr_uint32_t event_write_base_ts; - /* the first (base) frame of the event */ - mpf_named_event_frame_t event_write_base; - /* the last received update for the event */ - const mpf_named_event_frame_t *event_write_update; -}; - - -mpf_jitter_buffer_t* mpf_jitter_buffer_create(mpf_jb_config_t *jb_config, mpf_codec_descriptor_t *descriptor, mpf_codec_t *codec, apr_pool_t *pool) -{ - size_t i; - mpf_frame_t *frame; - mpf_jitter_buffer_t *jb = apr_palloc(pool,sizeof(mpf_jitter_buffer_t)); - if(!jb_config) { - /* create default jb config */ - jb_config = apr_palloc(pool,sizeof(mpf_jb_config_t)); - mpf_jb_config_init(jb_config); - } - /* validate jb config */ - if(jb_config->min_playout_delay > jb_config->initial_playout_delay) { - jb_config->min_playout_delay = jb_config->initial_playout_delay; - } - if(jb_config->max_playout_delay < jb_config->initial_playout_delay) { - jb_config->max_playout_delay = 2 * jb_config->initial_playout_delay; - } - if(jb_config->max_playout_delay == 0) { - jb_config->max_playout_delay = 600; /* ms */ - } - - jb->config = jb_config; - jb->codec = codec; - - /* calculate and allocate frame related data */ - jb->frame_ts = (apr_uint32_t)mpf_codec_frame_samples_calculate(descriptor); - jb->frame_size = mpf_codec_frame_size_calculate(descriptor,codec->attribs); - jb->frame_count = jb->config->max_playout_delay / CODEC_FRAME_TIME_BASE; - jb->raw_data = apr_palloc(pool,jb->frame_size*jb->frame_count); - jb->frames = apr_palloc(pool,sizeof(mpf_frame_t)*jb->frame_count); - for(i=0; iframe_count; i++) { - frame = &jb->frames[i]; - frame->type = MEDIA_FRAME_TYPE_NONE; - frame->marker = MPF_MARKER_NONE; - frame->codec_frame.buffer = jb->raw_data + i*jb->frame_size; - } - - if(jb->config->initial_playout_delay % CODEC_FRAME_TIME_BASE != 0) { - jb->config->initial_playout_delay += CODEC_FRAME_TIME_BASE - jb->config->initial_playout_delay % CODEC_FRAME_TIME_BASE; - } - - /* calculate playout delay in timestamp units */ - jb->playout_delay_ts = jb->frame_ts * jb->config->initial_playout_delay / CODEC_FRAME_TIME_BASE; - jb->max_playout_delay_ts = jb->frame_ts * jb->config->max_playout_delay / CODEC_FRAME_TIME_BASE; - - jb->write_sync = 1; - jb->write_ts_offset = 0; - jb->write_ts = jb->read_ts = 0; - - jb->min_length_ts = jb->max_length_ts = 0; - jb->measurment_count = 0; - - jb->event_write_base_ts = 0; - memset(&jb->event_write_base,0,sizeof(mpf_named_event_frame_t)); - jb->event_write_update = NULL; - - return jb; -} - -void mpf_jitter_buffer_destroy(mpf_jitter_buffer_t *jb) -{ -} - -apt_bool_t mpf_jitter_buffer_restart(mpf_jitter_buffer_t *jb) -{ - jb->write_sync = 1; - jb->write_ts_offset = 0; - jb->write_ts = jb->read_ts; - - jb->event_write_base_ts = 0; - memset(&jb->event_write_base,0,sizeof(mpf_named_event_frame_t)); - jb->event_write_update = NULL; - - if(jb->config->adaptive && jb->playout_delay_ts == jb->max_playout_delay_ts) { - jb->playout_delay_ts = jb->frame_ts * jb->config->initial_playout_delay / CODEC_FRAME_TIME_BASE; - } - - JB_TRACE("JB restart\n"); - return TRUE; -} - -static APR_INLINE mpf_frame_t* mpf_jitter_buffer_frame_get(mpf_jitter_buffer_t *jb, apr_size_t ts) -{ - apr_size_t index = (ts / jb->frame_ts) % jb->frame_count; - return &jb->frames[index]; -} - -static APR_INLINE void mpf_jitter_buffer_stat_update(mpf_jitter_buffer_t *jb) -{ - apr_int32_t length_ts; - - if(jb->measurment_count == 50) { - /* start over after every N measurements */ - apr_int32_t mean_length_ts = jb->min_length_ts + (jb->max_length_ts - jb->min_length_ts) / 2; - JB_TRACE("JB stat length [%d : %d] playout delay=%u\n", - jb->min_length_ts,jb->max_length_ts,jb->playout_delay_ts); - jb->min_length_ts = jb->max_length_ts = mean_length_ts; - jb->measurment_count = 0; - } - - /* calculate current length of the buffer */ - length_ts = jb->write_ts - jb->read_ts; - if(length_ts > jb->max_length_ts) { - /* update max length */ - jb->max_length_ts = length_ts; - } - else if(length_ts < jb->min_length_ts) { - /* update min length */ - jb->min_length_ts = length_ts; - } - /* increment the counter after every stat update */ - jb->measurment_count++; -} - -static APR_INLINE void mpf_jitter_buffer_frame_allign(mpf_jitter_buffer_t *jb, apr_uint32_t *ts) -{ - if(*ts % jb->frame_ts != 0) - *ts -= *ts % jb->frame_ts; -} - -static APR_INLINE jb_result_t mpf_jitter_buffer_write_prepare(mpf_jitter_buffer_t *jb, apr_uint32_t ts, apr_uint32_t *write_ts) -{ - if(jb->write_sync) { - JB_TRACE("JB write sync playout delay=%u\n",jb->playout_delay_ts); - /* calculate the offset */ - jb->write_ts_offset = ts - jb->read_ts; - jb->write_sync = 0; - - if(jb->config->time_skew_detection) { - /* reset the statistics */ - jb->min_length_ts = jb->max_length_ts = jb->playout_delay_ts; - jb->measurment_count = 0; - } - } - - /* calculate the write pos taking into account current offset and playout delay */ - *write_ts = ts - jb->write_ts_offset + jb->playout_delay_ts; - if(*write_ts % jb->frame_ts != 0) { - /* allign with frame_ts */ - apr_uint32_t delta_ts = *write_ts % jb->frame_ts; - JB_TRACE("JB write allign ts=%u delta_ts=-%u\n",*write_ts,delta_ts); - *write_ts -= delta_ts; - } - return JB_OK; -} - -jb_result_t mpf_jitter_buffer_write(mpf_jitter_buffer_t *jb, void *buffer, apr_size_t size, apr_uint32_t ts, apr_byte_t marker) -{ - mpf_frame_t *media_frame; - apr_uint32_t write_ts; - apr_size_t available_frame_count; - jb_result_t result; - - if(marker) { - JB_TRACE("JB marker\n"); - /* new talkspurt detected => test whether the buffer is empty */ - if(jb->write_ts <= jb->read_ts) { - /* resync */ - jb->write_sync = 1; - } - } - - /* calculate write_ts */ - result = mpf_jitter_buffer_write_prepare(jb,ts,&write_ts); - if(result != JB_OK) { - return result; - } - - if(write_ts >= jb->read_ts) { - if(write_ts >= jb->write_ts) { - /* normal order */ - } - else { - /* out of order */ - } - } - else { - apr_uint32_t delta_ts; - /* packet arrived too late */ - if(write_ts < jb->write_ts) { - /* out of order => discard */ - JB_TRACE("JB write ts=%u out of order, too late => discard\n",write_ts); - return JB_DISCARD_TOO_LATE; - } - - /* calculate a minimal adjustment needed in order to place the packet into the buffer */ - delta_ts = jb->read_ts - write_ts; - - if(jb->config->time_skew_detection) { - JB_TRACE("JB stat length [%d : %d] playout delay=%u delta=%u\n", - jb->min_length_ts,jb->max_length_ts,jb->playout_delay_ts,delta_ts); - - if((apr_uint32_t)(jb->max_length_ts - jb->min_length_ts) > jb->playout_delay_ts + delta_ts) { - /* update the adjustment based on the collected statistics */ - delta_ts = (apr_uint32_t)(jb->max_length_ts - jb->min_length_ts) - jb->playout_delay_ts; - mpf_jitter_buffer_frame_allign(jb,&delta_ts); - } - - /* determine if there might be a time skew or not */ - if(jb->max_length_ts > 0 && (apr_uint32_t)jb->max_length_ts < jb->playout_delay_ts) { - /* calculate the time skew */ - apr_uint32_t skew_ts = jb->playout_delay_ts - jb->max_length_ts; - mpf_jitter_buffer_frame_allign(jb,&skew_ts); - JB_TRACE("JB time skew detected offset=%u\n",skew_ts); - - /* adjust the offset and write pos */ - jb->write_ts_offset -= skew_ts; - write_ts = ts - jb->write_ts_offset + jb->playout_delay_ts; - - /* adjust the statistics */ - jb->min_length_ts += skew_ts; - jb->max_length_ts += skew_ts; - - if(skew_ts < delta_ts) { - delta_ts -= skew_ts; - } - else { - delta_ts = 0; - } - } - } - - if(delta_ts) { - if(jb->config->adaptive == 0) { - /* jitter buffer is not adaptive => discard the packet */ - JB_TRACE("JB write ts=%u too late => discard\n",write_ts); - return JB_DISCARD_TOO_LATE; - } - - if(jb->playout_delay_ts + delta_ts > jb->max_playout_delay_ts) { - /* max playout delay will be reached => discard the packet */ - JB_TRACE("JB write ts=%u max playout delay reached => discard\n",write_ts); - return JB_DISCARD_TOO_LATE; - } - - /* adjust the playout delay */ - jb->playout_delay_ts += delta_ts; - write_ts += delta_ts; - JB_TRACE("JB adjust playout delay=%u delta=%u\n",jb->playout_delay_ts,delta_ts); - - if(jb->config->time_skew_detection) { - /* adjust the statistics */ - jb->min_length_ts += delta_ts; - jb->max_length_ts += delta_ts; - } - } - } - - /* get number of frames available to write */ - available_frame_count = jb->frame_count - (write_ts - jb->read_ts)/jb->frame_ts; - if(available_frame_count <= 0) { - /* too early */ - JB_TRACE("JB write ts=%u too early => discard\n",write_ts); - return JB_DISCARD_TOO_EARLY; - } - - JB_TRACE("JB write ts=%u size=%"APR_SIZE_T_FMT"\n",write_ts,size); - while(available_frame_count && size) { - media_frame = mpf_jitter_buffer_frame_get(jb,write_ts); - media_frame->codec_frame.size = jb->frame_size; - if(mpf_codec_dissect(jb->codec,&buffer,&size,&media_frame->codec_frame) == FALSE) { - break; - } - - media_frame->type |= MEDIA_FRAME_TYPE_AUDIO; - write_ts += jb->frame_ts; - available_frame_count--; - } - - if(size) { - /* no frame available to write, but some data remains in buffer (partialy too early) */ - } - - if(write_ts > jb->write_ts) { - /* advance write pos */ - jb->write_ts = write_ts; - } - return result; -} - -jb_result_t mpf_jitter_buffer_event_write(mpf_jitter_buffer_t *jb, const mpf_named_event_frame_t *named_event, apr_uint32_t ts, apr_byte_t marker) -{ - mpf_frame_t *media_frame; - apr_uint32_t write_ts; - jb_result_t result = mpf_jitter_buffer_write_prepare(jb,ts,&write_ts); - if(result != JB_OK) { - return result; - } - - /* new event detection */ - if(!marker) { - if(jb->event_write_base.event_id != named_event->event_id || !jb->event_write_update) { - /* new event detected, marker is missing though */ - marker = 1; - } - else if(jb->event_write_base_ts != write_ts) { - /* detect whether this is a new segment of the same event or new event with missing marker - assuming a threshold which equals to 4 frames */ - if(write_ts > jb->event_write_base_ts + jb->event_write_update->duration + 4*jb->frame_ts) { - /* new event detected, marker is missing though */ - marker = 1; - } - else { - /* new segment of the same long-lasting event detected */ - jb->event_write_base = *named_event; - jb->event_write_update = &jb->event_write_base; - jb->event_write_base_ts = write_ts; - } - } - } - if(marker) { - /* new event */ - jb->event_write_base = *named_event; - jb->event_write_update = &jb->event_write_base; - jb->event_write_base_ts = write_ts; - } - else { - /* an update */ - if(named_event->duration < jb->event_write_update->duration) { - /* ignore this update, it's something from the past, which makes no sense now */ - return JB_OK; - } - else if(named_event->duration == jb->event_write_update->duration) { - /* this should be a retransmission, let it go through only if it contains new data */ - if(jb->event_write_update->edge == 1 || jb->event_write_update->edge == named_event->edge) { - /* ignore this update since either the end of event marker has already been set, - or the current event provides no updates */ - return JB_OK; - } - } - - /* calculate position in jitter buffer considering the last received event (update) */ - write_ts += jb->event_write_update->duration; - } - - if(write_ts < jb->read_ts) { - /* too late */ - apr_uint32_t delta_ts; - if(jb->config->adaptive == 0) { - /* jitter buffer is not adaptive => discard the packet */ - JB_TRACE("JB write ts=%u event=%d duration=%d too late => discard\n", - write_ts,named_event->event_id,named_event->duration); - return JB_DISCARD_TOO_LATE; - } - - /* calculate a minimal adjustment needed in order to place the packet into the buffer */ - delta_ts = jb->read_ts - write_ts; - - if(jb->playout_delay_ts + delta_ts > jb->max_playout_delay_ts) { - /* max playout delay will be reached => discard the packet */ - JB_TRACE("JB write ts=%u event=%d duration=%d max playout delay reached => discard\n", - write_ts,named_event->event_id,named_event->duration); - return JB_DISCARD_TOO_LATE; - } - - /* adjust the playout delay */ - jb->playout_delay_ts += delta_ts; - write_ts += delta_ts; - if(marker) { - jb->event_write_base_ts = write_ts; - } - JB_TRACE("JB adjust playout delay=%u delta=%u\n",jb->playout_delay_ts,delta_ts); - } - else if( (write_ts - jb->read_ts)/jb->frame_ts >= jb->frame_count) { - /* too early */ - JB_TRACE("JB write ts=%u event=%d duration=%d too early => discard\n", - write_ts,named_event->event_id,named_event->duration); - return JB_DISCARD_TOO_EARLY; - } - - media_frame = mpf_jitter_buffer_frame_get(jb,write_ts); - media_frame->event_frame = *named_event; - media_frame->type |= MEDIA_FRAME_TYPE_EVENT; - if(marker) { - media_frame->marker = MPF_MARKER_START_OF_EVENT; - } - else if(named_event->edge == 1) { - media_frame->marker = MPF_MARKER_END_OF_EVENT; - } - JB_TRACE("JB write ts=%u event=%d duration=%d marker=%d\n", - write_ts,named_event->event_id,named_event->duration,media_frame->marker); - jb->event_write_update = &media_frame->event_frame; - - write_ts += jb->frame_ts; - if(write_ts > jb->write_ts) { - /* advance write pos */ - jb->write_ts = write_ts; - } - return result; -} - -apt_bool_t mpf_jitter_buffer_read(mpf_jitter_buffer_t *jb, mpf_frame_t *media_frame) -{ - mpf_frame_t *src_media_frame = mpf_jitter_buffer_frame_get(jb,jb->read_ts); - if(jb->write_ts > jb->read_ts) { - /* normal read */ - JB_TRACE("JB read ts=%u\n", jb->read_ts); - media_frame->type = src_media_frame->type; - media_frame->marker = src_media_frame->marker; - if(media_frame->type & MEDIA_FRAME_TYPE_AUDIO) { - media_frame->codec_frame.size = src_media_frame->codec_frame.size; - memcpy(media_frame->codec_frame.buffer,src_media_frame->codec_frame.buffer,media_frame->codec_frame.size); - } - if(media_frame->type & MEDIA_FRAME_TYPE_EVENT) { - media_frame->event_frame = src_media_frame->event_frame; - } - } - else { - /* underflow */ - JB_TRACE("JB read ts=%u underflow\n", jb->read_ts); - media_frame->type = MEDIA_FRAME_TYPE_NONE; - media_frame->marker = MPF_MARKER_NONE; - } - src_media_frame->type = MEDIA_FRAME_TYPE_NONE; - src_media_frame->marker = MPF_MARKER_NONE; - /* advance read pos */ - jb->read_ts += jb->frame_ts; - - if(jb->config->time_skew_detection) { - /* update statistics after every read */ - mpf_jitter_buffer_stat_update(jb); - } - return TRUE; -} - -apr_uint32_t mpf_jitter_buffer_playout_delay_get(const mpf_jitter_buffer_t *jb) -{ - if(jb->config->adaptive == 0) { - return jb->config->initial_playout_delay; - } - - return jb->playout_delay_ts * CODEC_FRAME_TIME_BASE / jb->frame_ts; -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_mixer.c b/libs/unimrcp/libs/mpf/src/mpf_mixer.c deleted file mode 100644 index d4c5b3029d..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_mixer.c +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_mixer.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mpf_mixer.h" -#include "mpf_encoder.h" -#include "mpf_decoder.h" -#include "mpf_resampler.h" -#include "mpf_codec_manager.h" -#include "apt_log.h" - -typedef struct mpf_mixer_t mpf_mixer_t; - -/** MPF mixer derived from MPF object */ -struct mpf_mixer_t { - /** MPF mixer base */ - mpf_object_t base; - /** Array of audio sources */ - mpf_audio_stream_t **source_arr; - /** Number of audio sources */ - apr_size_t source_count; - /** Audio sink */ - mpf_audio_stream_t *sink; - - /** Frame to read from audio source */ - mpf_frame_t frame; - /** Mixed frame to write to audio sink */ - mpf_frame_t mix_frame; -}; - -static apt_bool_t mpf_frames_mix(mpf_frame_t *mix_frame, const mpf_frame_t *frame) -{ - apr_size_t i; - apr_int16_t *mix_buf = mix_frame->codec_frame.buffer; - const apr_int16_t *buf = frame->codec_frame.buffer; - apr_size_t samples = frame->codec_frame.size / sizeof(apr_int16_t); - - if(mix_frame->codec_frame.size != frame->codec_frame.size) { - return FALSE; - } - - if((frame->type & MEDIA_FRAME_TYPE_AUDIO) == MEDIA_FRAME_TYPE_AUDIO) { - for(i=0; itype |= MEDIA_FRAME_TYPE_AUDIO; - } - - return TRUE; -} - -static apt_bool_t mpf_mixer_process(mpf_object_t *object) -{ - apr_size_t i; - mpf_audio_stream_t *source; - mpf_mixer_t *mixer = (mpf_mixer_t*) object; - - mixer->mix_frame.type = MEDIA_FRAME_TYPE_NONE; - mixer->mix_frame.marker = MPF_MARKER_NONE; - memset(mixer->mix_frame.codec_frame.buffer,0,mixer->mix_frame.codec_frame.size); - for(i=0; isource_count; i++) { - source = mixer->source_arr[i]; - if(source) { - mixer->frame.type = MEDIA_FRAME_TYPE_NONE; - mixer->frame.marker = MPF_MARKER_NONE; - source->vtable->read_frame(source,&mixer->frame); - mpf_frames_mix(&mixer->mix_frame,&mixer->frame); - } - } - mixer->sink->vtable->write_frame(mixer->sink,&mixer->mix_frame); - return TRUE; -} - -static apt_bool_t mpf_mixer_destroy(mpf_object_t *object) -{ - apr_size_t i; - mpf_audio_stream_t *source; - mpf_mixer_t *mixer = (mpf_mixer_t*) object; - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Destroy Mixer %s",object->name); - for(i=0; isource_count; i++) { - source = mixer->source_arr[i]; - if(source) { - mpf_audio_stream_rx_close(source); - } - } - mpf_audio_stream_tx_close(mixer->sink); - return TRUE; -} - -static void mpf_mixer_trace(mpf_object_t *object) -{ - mpf_mixer_t *mixer = (mpf_mixer_t*) object; - apr_size_t i; - mpf_audio_stream_t *source; - char buf[2048]; - apr_size_t offset; - - apt_text_stream_t output; - apt_text_stream_init(&output,buf,sizeof(buf)-1); - - for(i=0; isource_count; i++) { - source = mixer->source_arr[i]; - if(source) { - mpf_audio_stream_trace(source,STREAM_DIRECTION_RECEIVE,&output); - apt_text_char_insert(&output,';'); - } - } - - offset = output.pos - output.text.buf; - output.pos += apr_snprintf(output.pos, output.text.length - offset, - "->Mixer->"); - - mpf_audio_stream_trace(mixer->sink,STREAM_DIRECTION_SEND,&output); - - *output.pos = '\0'; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Media Path %s %s", - object->name, - output.text.buf); -} - -MPF_DECLARE(mpf_object_t*) mpf_mixer_create( - mpf_audio_stream_t **source_arr, - apr_size_t source_count, - mpf_audio_stream_t *sink, - const mpf_codec_manager_t *codec_manager, - const char *name, - apr_pool_t *pool) -{ - apr_size_t i; - apr_size_t frame_size; - mpf_codec_descriptor_t *descriptor; - mpf_audio_stream_t *source; - mpf_mixer_t *mixer; - if(!source_arr || !source_count || !sink) { - return NULL; - } - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Create Mixer %s",name); - mixer = apr_palloc(pool,sizeof(mpf_mixer_t)); - mixer->source_arr = NULL; - mixer->source_count = 0; - mixer->sink = NULL; - mpf_object_init(&mixer->base,name); - mixer->base.process = mpf_mixer_process; - mixer->base.destroy = mpf_mixer_destroy; - mixer->base.trace = mpf_mixer_trace; - - if(mpf_audio_stream_tx_validate(sink,NULL,NULL,pool) == FALSE) { - return NULL; - } - - descriptor = sink->tx_descriptor; - if(descriptor && mpf_codec_lpcm_descriptor_match(descriptor) == FALSE) { - mpf_codec_t *codec = mpf_codec_manager_codec_get(codec_manager,descriptor,pool); - if(codec) { - /* set encoder after mixer */ - mpf_audio_stream_t *encoder = mpf_encoder_create(sink,codec,pool); - sink = encoder; - } - } - mixer->sink = sink; - mpf_audio_stream_tx_open(sink,NULL); - - for(i=0; irx_descriptor; - if(descriptor && mpf_codec_lpcm_descriptor_match(descriptor) == FALSE) { - mpf_codec_t *codec = mpf_codec_manager_codec_get(codec_manager,descriptor,pool); - if(codec) { - /* set decoder before mixer */ - mpf_audio_stream_t *decoder = mpf_decoder_create(source,codec,pool); - source = decoder; - } - } - source_arr[i] = source; - mpf_audio_stream_rx_open(source,NULL); - } - mixer->source_arr = source_arr; - mixer->source_count = source_count; - - descriptor = sink->tx_descriptor; - frame_size = mpf_codec_linear_frame_size_calculate(descriptor->sampling_rate,descriptor->channel_count); - mixer->frame.codec_frame.size = frame_size; - mixer->frame.codec_frame.buffer = apr_palloc(pool,frame_size); - mixer->mix_frame.codec_frame.size = frame_size; - mixer->mix_frame.codec_frame.buffer = apr_palloc(pool,frame_size); - return &mixer->base; -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_multiplier.c b/libs/unimrcp/libs/mpf/src/mpf_multiplier.c deleted file mode 100644 index 153c6cda9b..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_multiplier.c +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_multiplier.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mpf_multiplier.h" -#include "mpf_encoder.h" -#include "mpf_decoder.h" -#include "mpf_resampler.h" -#include "mpf_codec_manager.h" -#include "apt_log.h" - -typedef struct mpf_multiplier_t mpf_multiplier_t; - -/** MPF multiplier derived from MPF object */ -struct mpf_multiplier_t { - /** MPF multiplier base */ - mpf_object_t base; - /** Audio source */ - mpf_audio_stream_t *source; - /** Array of audio sinks */ - mpf_audio_stream_t **sink_arr; - /** Number of audio sinks */ - apr_size_t sink_count; - - /** Media frame used to read data from source and write it to sinks */ - mpf_frame_t frame; -}; - -static apt_bool_t mpf_multiplier_process(mpf_object_t *object) -{ - apr_size_t i; - mpf_audio_stream_t *sink; - mpf_multiplier_t *multiplier = (mpf_multiplier_t*) object; - - multiplier->frame.type = MEDIA_FRAME_TYPE_NONE; - multiplier->frame.marker = MPF_MARKER_NONE; - multiplier->source->vtable->read_frame(multiplier->source,&multiplier->frame); - - if((multiplier->frame.type & MEDIA_FRAME_TYPE_AUDIO) == 0) { - memset( multiplier->frame.codec_frame.buffer, - 0, - multiplier->frame.codec_frame.size); - } - - for(i=0; isink_count; i++) { - sink = multiplier->sink_arr[i]; - if(sink) { - sink->vtable->write_frame(sink,&multiplier->frame); - } - } - return TRUE; -} - -static apt_bool_t mpf_multiplier_destroy(mpf_object_t *object) -{ - apr_size_t i; - mpf_audio_stream_t *sink; - mpf_multiplier_t *multiplier = (mpf_multiplier_t*) object; - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Destroy Multiplier %s",object->name); - mpf_audio_stream_rx_close(multiplier->source); - for(i=0; isink_count; i++) { - sink = multiplier->sink_arr[i]; - if(sink) { - mpf_audio_stream_tx_close(sink); - } - } - return TRUE; -} - -static void mpf_multiplier_trace(mpf_object_t *object) -{ - mpf_multiplier_t *multiplier = (mpf_multiplier_t*) object; - apr_size_t i; - mpf_audio_stream_t *sink; - char buf[2048]; - apr_size_t offset; - - apt_text_stream_t output; - apt_text_stream_init(&output,buf,sizeof(buf)-1); - - mpf_audio_stream_trace(multiplier->source,STREAM_DIRECTION_RECEIVE,&output); - - offset = output.pos - output.text.buf; - output.pos += apr_snprintf(output.pos, output.text.length - offset, - "->Multiplier->"); - - for(i=0; isink_count; i++) { - sink = multiplier->sink_arr[i]; - if(sink) { - mpf_audio_stream_trace(sink,STREAM_DIRECTION_SEND,&output); - apt_text_char_insert(&output,';'); - } - } - - *output.pos = '\0'; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Media Path %s %s", - object->name, - output.text.buf); -} - -MPF_DECLARE(mpf_object_t*) mpf_multiplier_create( - mpf_audio_stream_t *source, - mpf_audio_stream_t **sink_arr, - apr_size_t sink_count, - const mpf_codec_manager_t *codec_manager, - const char *name, - apr_pool_t *pool) -{ - apr_size_t i; - apr_size_t frame_size; - mpf_codec_descriptor_t *descriptor; - mpf_audio_stream_t *sink; - mpf_multiplier_t *multiplier; - if(!source || !sink_arr || !sink_count) { - return NULL; - } - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Create Multiplier %s",name); - multiplier = apr_palloc(pool,sizeof(mpf_multiplier_t)); - multiplier->source = NULL; - multiplier->sink_arr = NULL; - multiplier->sink_count = 0; - mpf_object_init(&multiplier->base,name); - multiplier->base.process = mpf_multiplier_process; - multiplier->base.destroy = mpf_multiplier_destroy; - multiplier->base.trace = mpf_multiplier_trace; - - if(mpf_audio_stream_rx_validate(source,NULL,NULL,pool) == FALSE) { - return NULL; - } - - descriptor = source->rx_descriptor; - if(descriptor && mpf_codec_lpcm_descriptor_match(descriptor) == FALSE) { - mpf_codec_t *codec = mpf_codec_manager_codec_get(codec_manager,descriptor,pool); - if(codec) { - /* set decoder before bridge */ - mpf_audio_stream_t *decoder = mpf_decoder_create(source,codec,pool); - source = decoder; - } - } - multiplier->source = source; - mpf_audio_stream_rx_open(source,NULL); - - for(i=0; itx_descriptor; - if(descriptor && mpf_codec_lpcm_descriptor_match(descriptor) == FALSE) { - mpf_codec_t *codec = mpf_codec_manager_codec_get(codec_manager,descriptor,pool); - if(codec) { - /* set encoder after bridge */ - mpf_audio_stream_t *encoder = mpf_encoder_create(sink,codec,pool); - sink = encoder; - } - } - sink_arr[i] = sink; - mpf_audio_stream_tx_open(sink,NULL); - } - multiplier->sink_arr = sink_arr; - multiplier->sink_count = sink_count; - - descriptor = source->rx_descriptor; - frame_size = mpf_codec_linear_frame_size_calculate(descriptor->sampling_rate,descriptor->channel_count); - multiplier->frame.codec_frame.size = frame_size; - multiplier->frame.codec_frame.buffer = apr_palloc(pool,frame_size); - return &multiplier->base; -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_named_event.c b/libs/unimrcp/libs/mpf/src/mpf_named_event.c deleted file mode 100644 index 22df9b07c2..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_named_event.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_named_event.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mpf_named_event.h" - -#define TEL_EVENT_NAME "telephone-event" -#define TEL_EVENT_NAME_LENGTH (sizeof(TEL_EVENT_NAME)-1) - -#define TEL_EVENT_FMTP "0-15" -#define TEL_EVENT_FMTP_LENGTH (sizeof(TEL_EVENT_FMTP)-1) - - -MPF_DECLARE(mpf_codec_descriptor_t*) mpf_event_descriptor_create(apr_uint16_t sampling_rate, apr_pool_t *pool) -{ - mpf_codec_descriptor_t *descriptor = apr_palloc(pool,sizeof(mpf_codec_descriptor_t)); - mpf_codec_descriptor_init(descriptor); - descriptor->payload_type = 101; - descriptor->name.buf = TEL_EVENT_NAME; - descriptor->name.length = TEL_EVENT_NAME_LENGTH; - descriptor->sampling_rate = sampling_rate; - descriptor->channel_count = 1; - descriptor->format.buf = TEL_EVENT_FMTP; - descriptor->format.length = TEL_EVENT_FMTP_LENGTH; - return descriptor; -} - -MPF_DECLARE(apt_bool_t) mpf_event_descriptor_check(const mpf_codec_descriptor_t *descriptor) -{ - apt_str_t name; - name.buf = TEL_EVENT_NAME; - name.length = TEL_EVENT_NAME_LENGTH; - return apt_string_compare(&descriptor->name,&name); -} - -MPF_DECLARE(apr_uint32_t) mpf_dtmf_char_to_event_id(const char dtmf_char) -{ - if ((dtmf_char >= '0') && (dtmf_char <= '9')) - return dtmf_char - '0'; - else if (dtmf_char == '*') - return 10; - else if (dtmf_char == '#') - return 11; - else if ((dtmf_char >= 'A') && (dtmf_char <= 'D')) - return 12 + dtmf_char - 'A'; - - return 255; /* Invalid DTMF event */ -} - -MPF_DECLARE(char) mpf_event_id_to_dtmf_char(const apr_uint32_t event_id) -{ - if (event_id <= 9) - return '0' + (char)event_id; - else if (event_id == 10) - return '*'; - else if (event_id == 11) - return '#'; - else if (event_id <= 15) - return 'A' + (char)event_id - 12; - - return 0; /* Not a DTMF event */ -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_resampler.c b/libs/unimrcp/libs/mpf/src/mpf_resampler.c deleted file mode 100644 index bcd802245f..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_resampler.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_resampler.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mpf_resampler.h" -#include "apt_log.h" - -MPF_DECLARE(mpf_audio_stream_t*) mpf_resampler_create(mpf_audio_stream_t *source, mpf_audio_stream_t *sink, apr_pool_t *pool) -{ - apt_log(APT_LOG_MARK,APT_PRIO_WARNING, - "Currently resampling is not supported. " - "Try to configure and use the same sampling rate on both ends"); - return NULL; -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_rtp_attribs.c b/libs/unimrcp/libs/mpf/src/mpf_rtp_attribs.c deleted file mode 100644 index f6f84174e2..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_rtp_attribs.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_rtp_attribs.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "apt_string_table.h" -#include "mpf_rtp_attribs.h" - -/** String table of RTP attributes (mpf_rtp_attrib_e) */ -static const apt_str_table_item_t mpf_rtp_attrib_table[] = { - {{"rtpmap", 6},1}, - {{"sendonly", 8},8}, - {{"recvonly", 8},2}, - {{"sendrecv", 8},4}, - {{"mid", 3},0}, - {{"ptime", 5},0} -}; - - -MPF_DECLARE(const apt_str_t*) mpf_rtp_attrib_str_get(mpf_rtp_attrib_e attrib_id) -{ - return apt_string_table_str_get(mpf_rtp_attrib_table,RTP_ATTRIB_COUNT,attrib_id); -} - -MPF_DECLARE(mpf_rtp_attrib_e) mpf_rtp_attrib_id_find(const apt_str_t *attrib) -{ - return apt_string_table_id_find(mpf_rtp_attrib_table,RTP_ATTRIB_COUNT,attrib); -} - -MPF_DECLARE(const apt_str_t*) mpf_rtp_direction_str_get(mpf_stream_direction_e direction) -{ - mpf_rtp_attrib_e attrib_id = RTP_ATTRIB_UNKNOWN; - switch(direction) { - case STREAM_DIRECTION_SEND: - attrib_id = RTP_ATTRIB_SENDONLY; - break; - case STREAM_DIRECTION_RECEIVE: - attrib_id = RTP_ATTRIB_RECVONLY; - break; - case STREAM_DIRECTION_DUPLEX: - attrib_id = RTP_ATTRIB_SENDRECV; - break; - default: - break; - } - return apt_string_table_str_get(mpf_rtp_attrib_table,RTP_ATTRIB_COUNT,attrib_id); -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_rtp_stream.c b/libs/unimrcp/libs/mpf/src/mpf_rtp_stream.c deleted file mode 100644 index 9f47521489..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_rtp_stream.c +++ /dev/null @@ -1,1507 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_rtp_stream.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include "apt_net.h" -#include "apt_timer_queue.h" -#include "mpf_rtp_stream.h" -#include "mpf_termination.h" -#include "mpf_codec_manager.h" -#include "mpf_rtp_header.h" -#include "mpf_rtcp_packet.h" -#include "mpf_rtp_defs.h" -#include "mpf_rtp_pt.h" -#include "mpf_trace.h" -#include "apt_log.h" - -/** Max size of RTP packet */ -#define MAX_RTP_PACKET_SIZE 1500 -/** Max size of RTCP packet */ -#define MAX_RTCP_PACKET_SIZE 1500 - -/* Reason strings used in RTCP BYE messages (informative only) */ -#define RTCP_BYE_SESSION_ENDED "Session ended" -#define RTCP_BYE_TALKSPURT_ENDED "Talskpurt ended" - -#if ENABLE_RTP_PACKET_TRACE == 1 -#define RTP_TRACE printf -#elif ENABLE_RTP_PACKET_TRACE == 2 -#define RTP_TRACE mpf_debug_output_trace -#else -#define RTP_TRACE mpf_null_trace -#endif - -/** RTP stream */ -typedef struct mpf_rtp_stream_t mpf_rtp_stream_t; -struct mpf_rtp_stream_t { - mpf_audio_stream_t *base; - - mpf_rtp_media_descriptor_t *local_media; - mpf_rtp_media_descriptor_t *remote_media; - mpf_media_state_e state; - - rtp_transmitter_t transmitter; - rtp_receiver_t receiver; - - mpf_rtp_config_t *config; - mpf_rtp_settings_t *settings; - - apr_socket_t *rtp_socket; - apr_socket_t *rtcp_socket; - apr_sockaddr_t *rtp_l_sockaddr; - apr_sockaddr_t *rtp_r_sockaddr; - apr_sockaddr_t *rtcp_l_sockaddr; - apr_sockaddr_t *rtcp_r_sockaddr; - - apt_timer_t *rtcp_tx_timer; - apt_timer_t *rtcp_rx_timer; - - apr_pool_t *pool; -}; - -static apt_bool_t mpf_rtp_stream_destroy(mpf_audio_stream_t *stream); -static apt_bool_t mpf_rtp_rx_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec); -static apt_bool_t mpf_rtp_rx_stream_close(mpf_audio_stream_t *stream); -static apt_bool_t mpf_rtp_stream_receive(mpf_audio_stream_t *stream, mpf_frame_t *frame); -static apt_bool_t mpf_rtp_tx_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec); -static apt_bool_t mpf_rtp_tx_stream_close(mpf_audio_stream_t *stream); -static apt_bool_t mpf_rtp_stream_transmit(mpf_audio_stream_t *stream, const mpf_frame_t *frame); - -static const mpf_audio_stream_vtable_t vtable = { - mpf_rtp_stream_destroy, - mpf_rtp_rx_stream_open, - mpf_rtp_rx_stream_close, - mpf_rtp_stream_receive, - mpf_rtp_tx_stream_open, - mpf_rtp_tx_stream_close, - mpf_rtp_stream_transmit, - NULL /* mpf_rtp_stream_trace */ -}; - -static apt_bool_t mpf_rtp_socket_pair_create(mpf_rtp_stream_t *stream, mpf_rtp_media_descriptor_t *local_media, apt_bool_t bind); -static apt_bool_t mpf_rtp_socket_pair_bind(mpf_rtp_stream_t *stream, mpf_rtp_media_descriptor_t *local_media); -static void mpf_rtp_socket_pair_close(mpf_rtp_stream_t *stream); - -static apt_bool_t mpf_rtcp_report_send(mpf_rtp_stream_t *stream); -static apt_bool_t mpf_rtcp_bye_send(mpf_rtp_stream_t *stream, apt_str_t *reason); -static void mpf_rtcp_tx_timer_proc(apt_timer_t *timer, void *obj); -static void mpf_rtcp_rx_timer_proc(apt_timer_t *timer, void *obj); - - -MPF_DECLARE(mpf_audio_stream_t*) mpf_rtp_stream_create(mpf_termination_t *termination, mpf_rtp_config_t *config, mpf_rtp_settings_t *settings, apr_pool_t *pool) -{ - mpf_rtp_stream_t *rtp_stream = apr_palloc(pool,sizeof(mpf_rtp_stream_t)); - mpf_stream_capabilities_t *capabilities = mpf_stream_capabilities_create(STREAM_DIRECTION_DUPLEX,pool); - mpf_audio_stream_t *audio_stream = mpf_audio_stream_create(rtp_stream,&vtable,capabilities,pool); - if(!audio_stream) { - return NULL; - } - - audio_stream->direction = STREAM_DIRECTION_NONE; - audio_stream->termination = termination; - - rtp_stream->base = audio_stream; - rtp_stream->pool = pool; - rtp_stream->config = config; - rtp_stream->settings = settings; - rtp_stream->local_media = NULL; - rtp_stream->remote_media = NULL; - rtp_stream->rtp_socket = NULL; - rtp_stream->rtcp_socket = NULL; - rtp_stream->rtp_l_sockaddr = NULL; - rtp_stream->rtp_r_sockaddr = NULL; - rtp_stream->rtcp_l_sockaddr = NULL; - rtp_stream->rtcp_r_sockaddr = NULL; - rtp_stream->rtcp_tx_timer = NULL; - rtp_stream->rtcp_rx_timer = NULL; - rtp_stream->state = MPF_MEDIA_DISABLED; - rtp_receiver_init(&rtp_stream->receiver); - rtp_transmitter_init(&rtp_stream->transmitter); - rtp_stream->transmitter.sr_stat.ssrc = (apr_uint32_t)apr_time_now(); - - if(settings->rtcp == TRUE) { - if(settings->rtcp_tx_interval) { - rtp_stream->rtcp_tx_timer = apt_timer_create( - termination->timer_queue, - mpf_rtcp_tx_timer_proc, - rtp_stream, pool); - } - if(settings->rtcp_rx_resolution) { - rtp_stream->rtcp_rx_timer = apt_timer_create( - termination->timer_queue, - mpf_rtcp_rx_timer_proc, - rtp_stream, pool); - } - } - - return audio_stream; -} - -static apt_bool_t mpf_rtp_stream_local_media_create(mpf_rtp_stream_t *rtp_stream, mpf_rtp_media_descriptor_t *local_media, mpf_rtp_media_descriptor_t *remote_media, mpf_stream_capabilities_t *capabilities) -{ - apt_bool_t status = TRUE; - if(!local_media) { - /* local media is not specified, create the default one */ - local_media = apr_palloc(rtp_stream->pool,sizeof(mpf_rtp_media_descriptor_t)); - mpf_rtp_media_descriptor_init(local_media); - local_media->state = MPF_MEDIA_ENABLED; - local_media->direction = STREAM_DIRECTION_DUPLEX; - } - if(remote_media) { - local_media->id = remote_media->id; - } - if(local_media->ip.length == 0) { - local_media->ip = rtp_stream->config->ip; - local_media->ext_ip = rtp_stream->config->ext_ip; - } - if(local_media->port == 0) { - if(mpf_rtp_socket_pair_create(rtp_stream,local_media,FALSE) == TRUE) { - /* RTP port management */ - mpf_rtp_config_t *rtp_config = rtp_stream->config; - apr_port_t first_port_in_search = rtp_config->rtp_port_cur; - apt_bool_t is_port_ok = FALSE; - do { - local_media->port = rtp_config->rtp_port_cur; - rtp_config->rtp_port_cur += 2; - if(rtp_config->rtp_port_cur == rtp_config->rtp_port_max) { - rtp_config->rtp_port_cur = rtp_config->rtp_port_min; - } - - if(mpf_rtp_socket_pair_bind(rtp_stream,local_media) == TRUE) { - is_port_ok = TRUE; - break; - } - } while(first_port_in_search != rtp_config->rtp_port_cur); - - if(is_port_ok == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Find Free RTP Port %s:[%hu,%hu]", - rtp_config->ip.buf, - rtp_config->rtp_port_min, - rtp_config->rtp_port_max); - mpf_rtp_socket_pair_close(rtp_stream); - status = FALSE; - } - } - else { - status = FALSE; - } - } - else if(mpf_rtp_socket_pair_create(rtp_stream,local_media,TRUE) == FALSE) { - status = FALSE; - } - - if(status == FALSE) { - local_media->state = MPF_MEDIA_DISABLED; - } - - if(rtp_stream->settings->ptime) { - local_media->ptime = rtp_stream->settings->ptime; - } - - if(mpf_codec_list_is_empty(&local_media->codec_list) == TRUE) { - if(mpf_codec_list_is_empty(&rtp_stream->settings->codec_list) == TRUE) { - mpf_codec_manager_codec_list_get( - rtp_stream->base->termination->codec_manager, - &local_media->codec_list, - rtp_stream->pool); - } - else { - mpf_codec_list_copy(&local_media->codec_list, - &rtp_stream->settings->codec_list, - rtp_stream->pool); - } - } - - if(capabilities) { - if(mpf_codec_list_match(&local_media->codec_list,&capabilities->codecs) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Match Codec List %s:%hu", - local_media->ip.buf, - local_media->port); - local_media->state = MPF_MEDIA_DISABLED; - status = FALSE; - } - } - - rtp_stream->local_media = local_media; - return status; -} - -static apt_bool_t mpf_rtp_stream_local_media_update(mpf_rtp_stream_t *rtp_stream, mpf_rtp_media_descriptor_t *media, mpf_stream_capabilities_t *capabilities) -{ - apt_bool_t status = TRUE; - if(apt_string_compare(&rtp_stream->local_media->ip,&media->ip) == FALSE || - rtp_stream->local_media->port != media->port) { - - mpf_rtp_socket_pair_close(rtp_stream); - - if(mpf_rtp_socket_pair_create(rtp_stream,media,TRUE) == FALSE) { - media->state = MPF_MEDIA_DISABLED; - status = FALSE; - } - } - if(mpf_codec_list_is_empty(&media->codec_list) == TRUE) { - mpf_codec_manager_codec_list_get( - rtp_stream->base->termination->codec_manager, - &media->codec_list, - rtp_stream->pool); - } - - if(capabilities) { - if(mpf_codec_list_match(&media->codec_list,&capabilities->codecs) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Match Codec List %s:%hu", - media->ip.buf, - media->port); - media->state = MPF_MEDIA_DISABLED; - status = FALSE; - } - } - - rtp_stream->local_media = media; - return status; -} - -static apt_bool_t mpf_rtp_stream_remote_media_update(mpf_rtp_stream_t *rtp_stream, mpf_rtp_media_descriptor_t *media) -{ - apt_bool_t status = TRUE; - if(media->state == MPF_MEDIA_ENABLED) { - if(!rtp_stream->remote_media || - apt_string_compare(&rtp_stream->remote_media->ip,&media->ip) == FALSE || - rtp_stream->remote_media->port != media->port) { - - /* update RTP port */ - rtp_stream->rtp_r_sockaddr = NULL; - apr_sockaddr_info_get( - &rtp_stream->rtp_r_sockaddr, - media->ip.buf, - APR_INET, - media->port, - 0, - rtp_stream->pool); - if(!rtp_stream->rtp_r_sockaddr) { - status = FALSE; - } - - /* update RTCP port */ - rtp_stream->rtcp_r_sockaddr = NULL; - apr_sockaddr_info_get( - &rtp_stream->rtcp_r_sockaddr, - media->ip.buf, - APR_INET, - media->port+1, - 0, - rtp_stream->pool); - } - } - - rtp_stream->remote_media = media; - return status; -} - -static apt_bool_t mpf_rtp_stream_media_negotiate(mpf_rtp_stream_t *rtp_stream) -{ - mpf_rtp_media_descriptor_t *local_media = rtp_stream->local_media; - mpf_rtp_media_descriptor_t *remote_media = rtp_stream->remote_media; - if(!local_media || !remote_media) { - return FALSE; - } - - local_media->id = remote_media->id; - local_media->mid = remote_media->mid; - local_media->ptime = remote_media->ptime; - - if(rtp_stream->state == MPF_MEDIA_DISABLED && remote_media->state == MPF_MEDIA_ENABLED) { - /* enable RTP/RTCP session */ - rtp_stream->state = MPF_MEDIA_ENABLED; - if(rtp_stream->rtp_l_sockaddr) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Enable RTP Session %s:%hu", - rtp_stream->rtp_l_sockaddr->hostname, - rtp_stream->rtp_l_sockaddr->port); - } - - if(rtp_stream->rtcp_tx_timer) { - apt_timer_set(rtp_stream->rtcp_tx_timer,rtp_stream->settings->rtcp_tx_interval); - } - if(rtp_stream->rtcp_rx_timer) { - apt_timer_set(rtp_stream->rtcp_rx_timer,rtp_stream->settings->rtcp_rx_resolution); - } - } - else if(rtp_stream->state == MPF_MEDIA_ENABLED && remote_media->state == MPF_MEDIA_DISABLED) { - /* disable RTP/RTCP session */ - rtp_stream->state = MPF_MEDIA_DISABLED; - if(rtp_stream->rtp_l_sockaddr) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Disable RTP Session %s:%hu", - rtp_stream->rtp_l_sockaddr->hostname, - rtp_stream->rtp_l_sockaddr->port); - } - - if(rtp_stream->rtcp_tx_timer) { - apt_timer_kill(rtp_stream->rtcp_tx_timer); - } - if(rtp_stream->rtcp_rx_timer) { - apt_timer_kill(rtp_stream->rtcp_rx_timer); - } - if(rtp_stream->settings->rtcp == TRUE && rtp_stream->settings->rtcp_bye_policy != RTCP_BYE_DISABLE) { - apt_str_t reason = {RTCP_BYE_SESSION_ENDED, sizeof(RTCP_BYE_SESSION_ENDED)-1}; - mpf_rtcp_bye_send(rtp_stream,&reason); - } - } - - local_media->state = remote_media->state; - local_media->direction = mpf_stream_reverse_direction_get(remote_media->direction); - - if(remote_media->state == MPF_MEDIA_ENABLED) { - mpf_codec_list_t *codec_list1 = NULL; - mpf_codec_list_t *codec_list2 = NULL; - - /* intersect local and remote codecs */ - if(rtp_stream->settings->own_preferrence == TRUE) { - codec_list1 = &local_media->codec_list; - codec_list2 = &remote_media->codec_list; - } - else { - codec_list2 = &local_media->codec_list; - codec_list1 = &remote_media->codec_list; - } - - if(mpf_codec_lists_intersect(codec_list1,codec_list2) == FALSE) { - /* reject RTP/RTCP session */ - rtp_stream->state = MPF_MEDIA_DISABLED; - local_media->direction = STREAM_DIRECTION_NONE; - local_media->state = MPF_MEDIA_DISABLED; - if(rtp_stream->rtp_l_sockaddr) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Reject RTP Session %s:%hu no codecs matched", - rtp_stream->rtp_l_sockaddr->hostname, - rtp_stream->rtp_l_sockaddr->port); - } - - if(rtp_stream->rtcp_tx_timer) { - apt_timer_kill(rtp_stream->rtcp_tx_timer); - } - if(rtp_stream->rtcp_rx_timer) { - apt_timer_kill(rtp_stream->rtcp_rx_timer); - } - } - } - - rtp_stream->base->direction = local_media->direction; - return TRUE; -} - -MPF_DECLARE(apt_bool_t) mpf_rtp_stream_add(mpf_audio_stream_t *stream) -{ - return TRUE; -} - -MPF_DECLARE(apt_bool_t) mpf_rtp_stream_remove(mpf_audio_stream_t *stream) -{ - mpf_rtp_stream_t *rtp_stream = stream->obj; - - if(rtp_stream->state == MPF_MEDIA_ENABLED) { - /* disable RTP/RTCP session */ - rtp_stream->state = MPF_MEDIA_DISABLED; - if(rtp_stream->rtp_l_sockaddr) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove RTP Session %s:%hu", - rtp_stream->rtp_l_sockaddr->hostname, - rtp_stream->rtp_l_sockaddr->port); - } - - if(rtp_stream->rtcp_tx_timer) { - apt_timer_kill(rtp_stream->rtcp_tx_timer); - } - if(rtp_stream->rtcp_rx_timer) { - apt_timer_kill(rtp_stream->rtcp_rx_timer); - } - if(rtp_stream->settings->rtcp == TRUE && rtp_stream->settings->rtcp_bye_policy != RTCP_BYE_DISABLE) { - apt_str_t reason = {RTCP_BYE_SESSION_ENDED, sizeof(RTCP_BYE_SESSION_ENDED)-1}; - mpf_rtcp_bye_send(rtp_stream,&reason); - } - } - - mpf_rtp_socket_pair_close(rtp_stream); - return TRUE; -} - -MPF_DECLARE(apt_bool_t) mpf_rtp_stream_modify(mpf_audio_stream_t *stream, mpf_rtp_stream_descriptor_t *descriptor) -{ - apt_bool_t status = TRUE; - mpf_rtp_stream_t *rtp_stream = stream->obj; - if(!rtp_stream) { - return FALSE; - } - - if(!rtp_stream->local_media) { - /* create local media */ - status = mpf_rtp_stream_local_media_create(rtp_stream,descriptor->local,descriptor->remote,descriptor->capabilities); - } - else if(descriptor->local) { - /* update local media */ - status = mpf_rtp_stream_local_media_update(rtp_stream,descriptor->local,descriptor->capabilities); - } - - if(descriptor->remote && status == TRUE) { - /* update remote media */ - mpf_rtp_stream_remote_media_update(rtp_stream,descriptor->remote); - - /* negotiate local and remote media */ - mpf_rtp_stream_media_negotiate(rtp_stream); - } - - if((rtp_stream->base->direction & STREAM_DIRECTION_SEND) == STREAM_DIRECTION_SEND) { - mpf_codec_list_t *codec_list = &rtp_stream->remote_media->codec_list; - rtp_stream->base->tx_descriptor = codec_list->primary_descriptor; - if(rtp_stream->base->tx_descriptor) { - rtp_stream->transmitter.samples_per_frame = - (apr_uint32_t)mpf_codec_frame_samples_calculate(rtp_stream->base->tx_descriptor); - } - if(codec_list->event_descriptor) { - rtp_stream->base->tx_event_descriptor = codec_list->event_descriptor; - } - } - if((rtp_stream->base->direction & STREAM_DIRECTION_RECEIVE) == STREAM_DIRECTION_RECEIVE) { - mpf_codec_list_t *codec_list = &rtp_stream->local_media->codec_list; - rtp_stream->base->rx_descriptor = codec_list->primary_descriptor; - if(codec_list->event_descriptor) { - rtp_stream->base->rx_event_descriptor = codec_list->event_descriptor; - } - } - - if(!descriptor->local) { - descriptor->local = rtp_stream->local_media; - } - return status; -} - -static apt_bool_t mpf_rtp_stream_destroy(mpf_audio_stream_t *stream) -{ - return TRUE; -} - -static apt_bool_t mpf_rtp_rx_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec) -{ - mpf_rtp_stream_t *rtp_stream = stream->obj; - rtp_receiver_t *receiver = &rtp_stream->receiver; - mpf_jb_config_t *jb_config = &rtp_stream->settings->jb_config; - if(!rtp_stream->rtp_socket || !rtp_stream->rtp_l_sockaddr || !rtp_stream->rtp_r_sockaddr) { - return FALSE; - } - - receiver->jb = mpf_jitter_buffer_create( - jb_config, - stream->rx_descriptor, - codec, - rtp_stream->pool); - - apt_log(APT_LOG_MARK,APT_PRIO_INFO, - "Open RTP Receiver %s:%hu <- %s:%hu playout [%u ms] bounds [%u - %u ms] adaptive [%d] skew detection [%d]", - rtp_stream->rtp_l_sockaddr->hostname, - rtp_stream->rtp_l_sockaddr->port, - rtp_stream->rtp_r_sockaddr->hostname, - rtp_stream->rtp_r_sockaddr->port, - jb_config->initial_playout_delay, - jb_config->min_playout_delay, - jb_config->max_playout_delay, - jb_config->adaptive, - jb_config->time_skew_detection); - return TRUE; -} - -static apt_bool_t mpf_rtp_rx_stream_close(mpf_audio_stream_t *stream) -{ - mpf_rtp_stream_t *rtp_stream = stream->obj; - rtp_receiver_t *receiver = &rtp_stream->receiver; - - if(!rtp_stream->rtp_l_sockaddr || !rtp_stream->rtp_r_sockaddr) { - return FALSE; - } - - receiver->stat.lost_packets = 0; - if(receiver->stat.received_packets) { - apr_uint32_t expected_packets = receiver->history.seq_cycles + - receiver->history.seq_num_max - receiver->history.seq_num_base + 1; - if(expected_packets > receiver->stat.received_packets) { - receiver->stat.lost_packets = expected_packets - receiver->stat.received_packets; - } - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Close RTP Receiver %s:%hu <- %s:%hu [r:%u l:%u j:%u p:%u d:%u i:%u]", - rtp_stream->rtp_l_sockaddr->hostname, - rtp_stream->rtp_l_sockaddr->port, - rtp_stream->rtp_r_sockaddr->hostname, - rtp_stream->rtp_r_sockaddr->port, - receiver->stat.received_packets, - receiver->stat.lost_packets, - receiver->rr_stat.jitter, - mpf_jitter_buffer_playout_delay_get(receiver->jb), - receiver->stat.discarded_packets, - receiver->stat.ignored_packets); - mpf_jitter_buffer_destroy(receiver->jb); - return TRUE; -} - - -static APR_INLINE void rtp_rx_overall_stat_reset(rtp_receiver_t *receiver) -{ - memset(&receiver->stat,0,sizeof(receiver->stat)); - memset(&receiver->history,0,sizeof(receiver->history)); - memset(&receiver->periodic_history,0,sizeof(receiver->periodic_history)); -} - -static APR_INLINE void rtp_rx_stat_init(rtp_receiver_t *receiver, rtp_header_t *header, apr_time_t *time) -{ - receiver->rr_stat.ssrc = header->ssrc; - receiver->history.seq_num_base = receiver->history.seq_num_max = (apr_uint16_t)header->sequence; - receiver->history.ts_last = header->timestamp; - receiver->history.time_last = *time; -} - -static APR_INLINE void rtp_rx_restart(rtp_receiver_t *receiver) -{ - apr_byte_t restarts = ++receiver->stat.restarts; - rtp_rx_overall_stat_reset(receiver); - mpf_jitter_buffer_restart(receiver->jb); - receiver->stat.restarts = restarts; -} - -static rtp_header_t* rtp_rx_header_skip(void **buffer, apr_size_t *size) -{ - apr_size_t offset = 0; - rtp_header_t *header = (rtp_header_t*)*buffer; - - /* RTP header validity check */ - if(header->version != RTP_VERSION) { - return NULL; - } - - /* calculate payload offset */ - offset = sizeof(rtp_header_t) + (header->count * sizeof(apr_uint32_t)); - - /* additional offset in case of RTP extension */ - if(header->extension) { - rtp_extension_header_t *ext_header = (rtp_extension_header_t*)(((apr_byte_t*)*buffer)+offset); - offset += (ntohs(ext_header->length) * sizeof(apr_uint32_t)); - } - - if (offset >= *size) { - return NULL; - } - - /* skip to payload */ - *buffer = (apr_byte_t*)*buffer + offset; - *size = *size - offset; - - return header; -} - -static APR_INLINE void rtp_periodic_history_update(rtp_receiver_t *receiver) -{ - apr_uint32_t expected_packets; - apr_uint32_t expected_interval; - apr_uint32_t received_interval; - apr_uint32_t lost_interval; - - /* calculate expected packets */ - if(receiver->stat.received_packets) { - expected_packets = receiver->history.seq_cycles + - receiver->history.seq_num_max - receiver->history.seq_num_base + 1; - } - else { - expected_packets = 0; - } - - /* calculate expected interval */ - expected_interval = expected_packets - receiver->periodic_history.expected_prior; - /* update expected prior */ - receiver->periodic_history.expected_prior = expected_packets; - - /* calculate received interval */ - received_interval = receiver->stat.received_packets - receiver->periodic_history.received_prior; - /* update received prior */ - receiver->periodic_history.received_prior = receiver->stat.received_packets; - /* calculate lost interval */ - if(expected_interval > received_interval) { - lost_interval = expected_interval - received_interval; - } - else { - lost_interval = 0; - } - - /* update lost fraction */ - if(expected_interval == 0 || lost_interval == 0) { - receiver->rr_stat.fraction = 0; - } - else { - receiver->rr_stat.fraction = (lost_interval << 8) / expected_interval; - } - - if(expected_packets > receiver->stat.received_packets) { - receiver->rr_stat.lost = expected_packets - receiver->stat.received_packets; - } - else { - receiver->rr_stat.lost = 0; - } - - receiver->periodic_history.discarded_prior = receiver->stat.discarded_packets; - receiver->periodic_history.jitter_min = receiver->rr_stat.jitter; - receiver->periodic_history.jitter_max = receiver->rr_stat.jitter; -} - -typedef enum { - RTP_SSRC_UPDATE, - RTP_SSRC_PROBATION, - RTP_SSRC_RESTART -} rtp_ssrc_result_e; - -static APR_INLINE rtp_ssrc_result_e rtp_rx_ssrc_update(rtp_receiver_t *receiver, apr_uint32_t ssrc) -{ - if(receiver->rr_stat.ssrc == ssrc) { - /* known ssrc */ - if(receiver->history.ssrc_probation) { - /* reset the probation for new ssrc */ - receiver->history.ssrc_probation = 0; - receiver->history.ssrc_new = 0; - } - } - else { - if(receiver->history.ssrc_new == ssrc) { - if(--receiver->history.ssrc_probation == 0) { - /* restart with new ssrc */ - receiver->rr_stat.ssrc = ssrc; - return RTP_SSRC_RESTART; - } - else { - return RTP_SSRC_PROBATION; - } - } - else { - /* start probation for new ssrc */ - receiver->history.ssrc_new = ssrc; - receiver->history.ssrc_probation = 5; - return RTP_SSRC_PROBATION; - } - } - return RTP_SSRC_UPDATE; -} - -typedef enum { - RTP_SEQ_UPDATE, - RTP_SEQ_MISORDER, - RTP_SEQ_DRIFT -} rtp_seq_result_e; - -static APR_INLINE rtp_seq_result_e rtp_rx_seq_update(rtp_receiver_t *receiver, apr_uint16_t seq_num) -{ - rtp_seq_result_e result = RTP_SEQ_UPDATE; - apr_uint16_t seq_delta = seq_num - receiver->history.seq_num_max; - if(seq_delta < MAX_DROPOUT) { - if(seq_num < receiver->history.seq_num_max) { - /* sequence number wrapped */ - receiver->history.seq_cycles += RTP_SEQ_MOD; - } - receiver->history.seq_num_max = seq_num; - } - else if(seq_delta <= RTP_SEQ_MOD - MAX_MISORDER) { - /* sequence number made a very large jump */ - result = RTP_SEQ_DRIFT; - } - else { - /* duplicate or misordered packet */ - result = RTP_SEQ_MISORDER; - } - receiver->stat.received_packets++; - - return result; -} - -typedef enum { - RTP_TS_UPDATE, - RTP_TS_DRIFT -} rtp_ts_result_e; - -static APR_INLINE rtp_ts_result_e rtp_rx_ts_update(rtp_receiver_t *receiver, mpf_codec_descriptor_t *descriptor, apr_time_t *time, apr_uint32_t ts, apr_byte_t *marker) -{ - apr_int32_t deviation; - apr_int32_t time_diff; - - /* arrival time diff in msec */ - time_diff = (apr_int32_t)apr_time_as_msec(*time - receiver->history.time_last); - - /* if the time difference is more than the threshold (INTER_TALKSPURT_GAP), - and the marker is not set, then this might be a beginning of a - new malformed talkspurt */ - if(!*marker && time_diff > INTER_TALKSPURT_GAP) { - /* set the missing marker */ - *marker = 1; - } - - /* arrival time diff in samples */ - deviation = time_diff * descriptor->channel_count * descriptor->sampling_rate / 1000; - /* arrival timestamp diff */ - deviation -= ts - receiver->history.ts_last; - - if(deviation < 0) { - deviation = -deviation; - } - - if(deviation > DEVIATION_THRESHOLD) { - return RTP_TS_DRIFT; - } - - receiver->rr_stat.jitter += deviation - ((receiver->rr_stat.jitter + 8) >> 4); - RTP_TRACE("jitter=%u deviation=%d\n",receiver->rr_stat.jitter,deviation); - receiver->history.time_last = *time; - receiver->history.ts_last = ts; - - if(receiver->rr_stat.jitter < receiver->periodic_history.jitter_min) { - receiver->periodic_history.jitter_min = receiver->rr_stat.jitter; - } - if(receiver->rr_stat.jitter > receiver->periodic_history.jitter_max) { - receiver->periodic_history.jitter_max = receiver->rr_stat.jitter; - } - return RTP_TS_UPDATE; -} - -static APR_INLINE void rtp_rx_failure_threshold_check(rtp_receiver_t *receiver) -{ - apr_uint32_t received; - apr_uint32_t discarded; - received = receiver->stat.received_packets - receiver->periodic_history.received_prior; - discarded = receiver->stat.discarded_packets - receiver->periodic_history.discarded_prior; - - if(discarded * 100 > received * DISCARDED_TO_RECEIVED_RATIO_THRESHOLD) { - /* failure threshold reached -> restart */ - rtp_rx_restart(receiver); - } -} - -static apt_bool_t rtp_rx_packet_receive(mpf_rtp_stream_t *rtp_stream, void *buffer, apr_size_t size) -{ - rtp_receiver_t *receiver = &rtp_stream->receiver; - mpf_codec_descriptor_t *descriptor = rtp_stream->base->rx_descriptor; - apr_time_t time; - rtp_ssrc_result_e ssrc_result; - rtp_header_t *header = rtp_rx_header_skip(&buffer,&size); - if(!header) { - /* invalid RTP packet */ - receiver->stat.invalid_packets++; - return FALSE; - } - - header->sequence = ntohs((apr_uint16_t)header->sequence); - header->timestamp = ntohl(header->timestamp); - header->ssrc = ntohl(header->ssrc); - - time = apr_time_now(); - - RTP_TRACE("RTP time=%6u ssrc=%8x pt=%3u %cts=%9u seq=%5u size=%"APR_SIZE_T_FMT"\n", - (apr_uint32_t)apr_time_usec(time), - header->ssrc, header->type, (header->marker == 1) ? '*' : ' ', - header->timestamp, header->sequence, size); - if(!receiver->stat.received_packets) { - /* initialization */ - rtp_rx_stat_init(receiver,header,&time); - } - - ssrc_result = rtp_rx_ssrc_update(receiver,header->ssrc); - if(ssrc_result == RTP_SSRC_PROBATION) { - receiver->stat.invalid_packets++; - return FALSE; - } - else if(ssrc_result == RTP_SSRC_RESTART) { - rtp_rx_restart(receiver); - rtp_rx_stat_init(receiver,header,&time); - } - - rtp_rx_seq_update(receiver,(apr_uint16_t)header->sequence); - - if(header->type == descriptor->payload_type) { - /* codec */ - apr_byte_t marker = (apr_byte_t)header->marker; - if(rtp_rx_ts_update(receiver,descriptor,&time,header->timestamp,&marker) == RTP_TS_DRIFT) { - rtp_rx_restart(receiver); - return FALSE; - } - - if(mpf_jitter_buffer_write(receiver->jb,buffer,size,header->timestamp,marker) != JB_OK) { - receiver->stat.discarded_packets++; - rtp_rx_failure_threshold_check(receiver); - } - } - else if(rtp_stream->base->rx_event_descriptor && - header->type == rtp_stream->base->rx_event_descriptor->payload_type) { - /* named event */ - mpf_named_event_frame_t *named_event = (mpf_named_event_frame_t *)buffer; - named_event->duration = ntohs((apr_uint16_t)named_event->duration); - if(mpf_jitter_buffer_event_write(receiver->jb,named_event,header->timestamp,(apr_byte_t)header->marker) != JB_OK) { - receiver->stat.discarded_packets++; - } - } - else if(header->type == RTP_PT_CN) { - /* CN packet */ - receiver->stat.ignored_packets++; - } - else { - /* invalid payload type */ - receiver->stat.ignored_packets++; - } - - return TRUE; -} - -static apt_bool_t rtp_rx_process(mpf_rtp_stream_t *rtp_stream) -{ - char buffer[MAX_RTP_PACKET_SIZE]; - apr_size_t size = sizeof(buffer); - apr_size_t max_count = 5; - while(max_count && apr_socket_recv(rtp_stream->rtp_socket,buffer,&size) == APR_SUCCESS) { - rtp_rx_packet_receive(rtp_stream,buffer,size); - - size = sizeof(buffer); - max_count--; - } - return TRUE; -} - -static apt_bool_t mpf_rtp_stream_receive(mpf_audio_stream_t *stream, mpf_frame_t *frame) -{ - mpf_rtp_stream_t *rtp_stream = stream->obj; - rtp_rx_process(rtp_stream); - - return mpf_jitter_buffer_read(rtp_stream->receiver.jb,frame); -} - - -static apt_bool_t mpf_rtp_tx_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec) -{ - apr_size_t frame_size; - mpf_rtp_stream_t *rtp_stream = stream->obj; - rtp_transmitter_t *transmitter = &rtp_stream->transmitter; - - if(!rtp_stream->rtp_socket || !rtp_stream->rtp_l_sockaddr || !rtp_stream->rtp_r_sockaddr) { - return FALSE; - } - - if(!codec) { - return FALSE; - } - - if(!transmitter->ptime) { - if(rtp_stream->settings && rtp_stream->settings->ptime) { - transmitter->ptime = rtp_stream->settings->ptime; - } - else { - transmitter->ptime = 20; - } - } - transmitter->packet_frames = transmitter->ptime / CODEC_FRAME_TIME_BASE; - transmitter->current_frames = 0; - - frame_size = mpf_codec_frame_size_calculate( - stream->tx_descriptor, - codec->attribs); - transmitter->packet_data = apr_palloc( - rtp_stream->pool, - sizeof(rtp_header_t) + transmitter->packet_frames * frame_size); - - transmitter->inactivity = 1; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Open RTP Transmitter %s:%hu -> %s:%hu", - rtp_stream->rtp_l_sockaddr->hostname, - rtp_stream->rtp_l_sockaddr->port, - rtp_stream->rtp_r_sockaddr->hostname, - rtp_stream->rtp_r_sockaddr->port); - return TRUE; -} - -static apt_bool_t mpf_rtp_tx_stream_close(mpf_audio_stream_t *stream) -{ - mpf_rtp_stream_t *rtp_stream = stream->obj; - if(!rtp_stream->rtp_l_sockaddr || !rtp_stream->rtp_r_sockaddr) { - return FALSE; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Close RTP Transmitter %s:%hu -> %s:%hu [s:%u o:%u]", - rtp_stream->rtp_l_sockaddr->hostname, - rtp_stream->rtp_l_sockaddr->port, - rtp_stream->rtp_r_sockaddr->hostname, - rtp_stream->rtp_r_sockaddr->port, - rtp_stream->transmitter.sr_stat.sent_packets, - rtp_stream->transmitter.sr_stat.sent_octets); - return TRUE; -} - - -static APR_INLINE void rtp_header_prepare( - rtp_transmitter_t *transmitter, - rtp_header_t *header, - apr_byte_t payload_type, - apr_byte_t marker, - apr_uint32_t timestamp) -{ - header->version = RTP_VERSION; - header->padding = 0; - header->extension = 0; - header->count = 0; - header->marker = marker; - header->type = payload_type; - header->timestamp = timestamp; - header->ssrc = htonl(transmitter->sr_stat.ssrc); -} - -static APR_INLINE apt_bool_t mpf_rtp_data_send(mpf_rtp_stream_t *rtp_stream, rtp_transmitter_t *transmitter, const mpf_frame_t *frame) -{ - apt_bool_t status = TRUE; - memcpy( - transmitter->packet_data + transmitter->packet_size, - frame->codec_frame.buffer, - frame->codec_frame.size); - transmitter->packet_size += frame->codec_frame.size; - - if(++transmitter->current_frames == transmitter->packet_frames) { - rtp_header_t *header = (rtp_header_t*)transmitter->packet_data; - header->sequence = htons(++transmitter->last_seq_num); - RTP_TRACE("> RTP time=%6u ssrc=%8x pt=%3u %cts=%9u seq=%5hu\n", - (apr_uint32_t)apr_time_usec(apr_time_now()), - transmitter->sr_stat.ssrc, header->type, - (header->marker == 1) ? '*' : ' ', - header->timestamp, transmitter->last_seq_num); - header->timestamp = htonl(header->timestamp); - if(apr_socket_sendto( - rtp_stream->rtp_socket, - rtp_stream->rtp_r_sockaddr, - 0, - transmitter->packet_data, - &transmitter->packet_size) == APR_SUCCESS) { - transmitter->sr_stat.sent_packets++; - transmitter->sr_stat.sent_octets += (apr_uint32_t)transmitter->packet_size - sizeof(rtp_header_t); - } - else { - status = FALSE; - } - transmitter->current_frames = 0; - } - return status; -} - -static APR_INLINE apt_bool_t mpf_rtp_event_send(mpf_rtp_stream_t *rtp_stream, rtp_transmitter_t *transmitter, const mpf_frame_t *frame) -{ - char packet_data[20]; - apr_size_t packet_size = sizeof(rtp_header_t) + sizeof(mpf_named_event_frame_t); - rtp_header_t *header = (rtp_header_t*) packet_data; - mpf_named_event_frame_t *named_event = (mpf_named_event_frame_t*)(header+1); - rtp_header_prepare( - transmitter, - header, - rtp_stream->base->tx_event_descriptor->payload_type, - (frame->marker == MPF_MARKER_START_OF_EVENT) ? 1 : 0, - transmitter->timestamp_base); - - *named_event = frame->event_frame; - named_event->edge = (frame->marker == MPF_MARKER_END_OF_EVENT) ? 1 : 0; - - header->sequence = htons(++transmitter->last_seq_num); - RTP_TRACE("> RTP time=%6u ssrc=%8x pt=%3u %cts=%9u seq=%hu event=%2u dur=%3u %c\n", - (apr_uint32_t)apr_time_usec(apr_time_now()), - transmitter->sr_stat.ssrc, - header->type, (header->marker == 1) ? '*' : ' ', - header->timestamp, transmitter->last_seq_num, - named_event->event_id, named_event->duration, - (named_event->edge == 1) ? '*' : ' '); - header->timestamp = htonl(header->timestamp); - named_event->duration = htons((apr_uint16_t)named_event->duration); - if(apr_socket_sendto( - rtp_stream->rtp_socket, - rtp_stream->rtp_r_sockaddr, - 0, - packet_data, - &packet_size) != APR_SUCCESS) { - return FALSE; - } - transmitter->sr_stat.sent_packets++; - transmitter->sr_stat.sent_octets += sizeof(mpf_named_event_frame_t); - return TRUE; -} - -static apt_bool_t mpf_rtp_stream_transmit(mpf_audio_stream_t *stream, const mpf_frame_t *frame) -{ - apt_bool_t status = TRUE; - mpf_rtp_stream_t *rtp_stream = stream->obj; - rtp_transmitter_t *transmitter = &rtp_stream->transmitter; - - transmitter->timestamp += transmitter->samples_per_frame; - - if(frame->type == MEDIA_FRAME_TYPE_NONE) { - if(!transmitter->inactivity) { - if(transmitter->current_frames == 0) { - /* set inactivity (ptime alligned) */ - transmitter->inactivity = 1; - if(rtp_stream->settings->rtcp == TRUE && rtp_stream->settings->rtcp_bye_policy == RTCP_BYE_PER_TALKSPURT) { - apt_str_t reason = {RTCP_BYE_TALKSPURT_ENDED, sizeof(RTCP_BYE_TALKSPURT_ENDED)-1}; - mpf_rtcp_bye_send(rtp_stream,&reason); - } - } - else { - /* ptime allignment */ - status = mpf_rtp_data_send(rtp_stream,transmitter,frame); - } - } - return status; - } - - if((frame->type & MEDIA_FRAME_TYPE_EVENT) == MEDIA_FRAME_TYPE_EVENT){ - /* transmit event as soon as received */ - if(stream->tx_event_descriptor) { - if(frame->marker == MPF_MARKER_START_OF_EVENT) { - /* store start time (base) of the event */ - transmitter->timestamp_base = transmitter->timestamp; - } - else if(frame->marker == MPF_MARKER_NEW_SEGMENT) { - /* update base in case of long-lasting events */ - transmitter->timestamp_base = transmitter->timestamp; - } - - status = mpf_rtp_event_send(rtp_stream,transmitter,frame); - } - } - - if((frame->type & MEDIA_FRAME_TYPE_AUDIO) == MEDIA_FRAME_TYPE_AUDIO){ - if(transmitter->current_frames == 0) { - rtp_header_t *header = (rtp_header_t*)transmitter->packet_data; - rtp_header_prepare( - transmitter, - header, - stream->tx_descriptor->payload_type, - transmitter->inactivity, - transmitter->timestamp); - transmitter->packet_size = sizeof(rtp_header_t); - if(transmitter->inactivity) { - transmitter->inactivity = 0; - } - } - status = mpf_rtp_data_send(rtp_stream,transmitter,frame); - } - - return status; -} - -static apt_bool_t mpf_socket_create(apr_pool_t *pool, apr_socket_t **socket) -{ - if(!socket) - return FALSE; - - if(apr_socket_create(socket,APR_INET,SOCK_DGRAM,0,pool) != APR_SUCCESS) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Socket"); - *socket = NULL; - return FALSE; - } - - apr_socket_opt_set(*socket,APR_SO_NONBLOCK,1); - apr_socket_timeout_set(*socket,0); - return TRUE; -} - -static apt_bool_t mpf_socket_bind(apr_socket_t *socket, const char *ip, apr_port_t port, apr_pool_t *pool, apr_sockaddr_t **l_sockaddr) -{ - if(!socket || !l_sockaddr) - return FALSE; - - *l_sockaddr = NULL; - apr_sockaddr_info_get( - l_sockaddr, - ip, - APR_INET, - port, - 0, - pool); - if(!*l_sockaddr) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get Sockaddr %s:%hu",ip,port); - return FALSE; - } - - if(apr_socket_bind(socket,*l_sockaddr) != APR_SUCCESS) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Failed to Bind Socket to %s:%hu", ip,port); - return FALSE; - } - return TRUE; -} - -/* Create RTP/RTCP sockets */ -static apt_bool_t mpf_rtp_socket_pair_create(mpf_rtp_stream_t *stream, mpf_rtp_media_descriptor_t *local_media, apt_bool_t bind) -{ - /* Create and optionally bind RTP socket. Return FALSE in case of an error. */ - if(mpf_socket_create(stream->pool,&stream->rtp_socket) == FALSE) { - return FALSE; - } - if(bind == TRUE) { - if(mpf_socket_bind(stream->rtp_socket,local_media->ip.buf,local_media->port,stream->pool,&stream->rtp_l_sockaddr) == FALSE) { - apr_socket_close(stream->rtp_socket); - stream->rtp_socket = NULL; - return FALSE; - } - } - - /* Create and optionally bind RCTP socket. Continue in either way. */ - if(mpf_socket_create(stream->pool,&stream->rtcp_socket) == TRUE && bind == TRUE) { - if(mpf_socket_bind(stream->rtcp_socket,local_media->ip.buf,local_media->port+1,stream->pool,&stream->rtcp_l_sockaddr) == FALSE) { - apr_socket_close(stream->rtcp_socket); - stream->rtcp_socket = NULL; - } - } - return TRUE; -} - -/* Bind RTP/RTCP sockets */ -static apt_bool_t mpf_rtp_socket_pair_bind(mpf_rtp_stream_t *stream, mpf_rtp_media_descriptor_t *local_media) -{ - /* Bind RTP socket. Return FALSE in case of an error. */ - if(mpf_socket_bind(stream->rtp_socket,local_media->ip.buf,local_media->port,stream->pool,&stream->rtp_l_sockaddr) == FALSE) { - return FALSE; - } - - /* Try to bind RTCP socket. Continue in either way. */ - mpf_socket_bind(stream->rtcp_socket,local_media->ip.buf,local_media->port+1,stream->pool,&stream->rtcp_l_sockaddr); - return TRUE; -} - -/* Close RTP/RTCP sockets */ -static void mpf_rtp_socket_pair_close(mpf_rtp_stream_t *stream) -{ - if(stream->rtp_socket) { - apr_socket_close(stream->rtp_socket); - stream->rtp_socket = NULL; - } - if(stream->rtcp_socket) { - apr_socket_close(stream->rtcp_socket); - stream->rtcp_socket = NULL; - } -} - - - -static APR_INLINE void rtcp_sr_generate(mpf_rtp_stream_t *rtp_stream, rtcp_sr_stat_t *sr_stat) -{ - *sr_stat = rtp_stream->transmitter.sr_stat; - apt_ntp_time_get(&sr_stat->ntp_sec, &sr_stat->ntp_frac); - sr_stat->rtp_ts = rtp_stream->transmitter.timestamp; - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Generate RTCP SR [ssrc:%u s:%u o:%u ts:%u]", - sr_stat->ssrc, - sr_stat->sent_packets, - sr_stat->sent_octets, - sr_stat->rtp_ts); - rtcp_sr_hton(sr_stat); -} - -static APR_INLINE void rtcp_rr_generate(mpf_rtp_stream_t *rtp_stream, rtcp_rr_stat_t *rr_stat) -{ - *rr_stat = rtp_stream->receiver.rr_stat; - rr_stat->last_seq = rtp_stream->receiver.history.seq_num_max; - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Generate RTCP RR [ssrc:%u last_seq:%u j:%u lost:%u frac:%d]", - rr_stat->ssrc, - rr_stat->last_seq, - rr_stat->jitter, - rr_stat->lost, - rr_stat->fraction); - rtcp_rr_hton(rr_stat); -} - -/* Generate either RTCP SR or RTCP RR packet */ -static APR_INLINE apr_size_t rtcp_report_generate(mpf_rtp_stream_t *rtp_stream, rtcp_packet_t *rtcp_packet, apr_size_t length) -{ - apr_size_t offset = 0; - rtcp_header_init(&rtcp_packet->header,RTCP_RR); - if(rtp_stream->base->direction & STREAM_DIRECTION_SEND) { - rtcp_packet->header.pt = RTCP_SR; - } - if(rtp_stream->base->direction & STREAM_DIRECTION_RECEIVE) { - rtcp_packet->header.count = 1; - } - offset += sizeof(rtcp_header_t); - - if(rtcp_packet->header.pt == RTCP_SR) { - rtcp_sr_generate(rtp_stream,&rtcp_packet->r.sr.sr_stat); - offset += sizeof(rtcp_sr_stat_t); - if(rtcp_packet->header.count) { - rtcp_rr_generate(rtp_stream,rtcp_packet->r.sr.rr_stat); - offset += sizeof(rtcp_rr_stat_t); - } - } - else if(rtcp_packet->header.pt == RTCP_RR) { - rtcp_packet->r.rr.ssrc = htonl(rtp_stream->transmitter.sr_stat.ssrc); - rtcp_rr_generate(rtp_stream,rtcp_packet->r.rr.rr_stat); - offset += sizeof(rtcp_packet->r.rr); - } - rtcp_header_length_set(&rtcp_packet->header,offset); - return offset; -} - -/* Generate RTCP SDES packet */ -static APR_INLINE apr_size_t rtcp_sdes_generate(mpf_rtp_stream_t *rtp_stream, rtcp_packet_t *rtcp_packet, apr_size_t length) -{ - rtcp_sdes_item_t *item; - apr_size_t offset = 0; - apr_size_t padding; - rtcp_header_init(&rtcp_packet->header,RTCP_SDES); - offset += sizeof(rtcp_header_t); - - rtcp_packet->header.count ++; - rtcp_packet->r.sdes.ssrc = htonl(rtp_stream->transmitter.sr_stat.ssrc); - offset += sizeof(apr_uint32_t); - - /* insert SDES CNAME item */ - item = &rtcp_packet->r.sdes.item[0]; - item->type = RTCP_SDES_CNAME; - item->length = (apr_byte_t)rtp_stream->local_media->ip.length; - memcpy(item->data,rtp_stream->local_media->ip.buf,item->length); - offset += sizeof(rtcp_sdes_item_t) - 1 + item->length; - - /* terminate with end marker and pad to next 4-octet boundary */ - padding = 4 - (offset & 0x3); - while(padding--) { - item = (rtcp_sdes_item_t*) ((char*)rtcp_packet + offset); - item->type = RTCP_SDES_END; - offset++; - } - - rtcp_header_length_set(&rtcp_packet->header,offset); - return offset; -} - -/* Generate RTCP BYE packet */ -static APR_INLINE apr_size_t rtcp_bye_generate(mpf_rtp_stream_t *rtp_stream, rtcp_packet_t *rtcp_packet, apr_size_t length, apt_str_t *reason) -{ - apr_size_t offset = 0; - rtcp_header_init(&rtcp_packet->header,RTCP_BYE); - offset += sizeof(rtcp_header_t); - - rtcp_packet->r.bye.ssrc[0] = htonl(rtp_stream->transmitter.sr_stat.ssrc); - rtcp_packet->header.count++; - offset += rtcp_packet->header.count * sizeof(apr_uint32_t); - - if(reason->length) { - apr_size_t padding; - - memcpy(rtcp_packet->r.bye.data,reason->buf,reason->length); - rtcp_packet->r.bye.length = (apr_byte_t)reason->length; - offset += rtcp_packet->r.bye.length; - - /* terminate with end marker and pad to next 4-octet boundary */ - padding = 4 - (reason->length & 0x3); - if(padding) { - char *end = rtcp_packet->r.bye.data + reason->length; - memset(end,0,padding); - offset += padding; - } - } - - rtcp_header_length_set(&rtcp_packet->header,offset); - return offset; -} - -/* Send compound RTCP packet (SR/RR + SDES) */ -static apt_bool_t mpf_rtcp_report_send(mpf_rtp_stream_t *rtp_stream) -{ - char buffer[MAX_RTCP_PACKET_SIZE]; - apr_size_t length = 0; - rtcp_packet_t *rtcp_packet; - - if(!rtp_stream->rtcp_socket || !rtp_stream->rtcp_l_sockaddr || !rtp_stream->rtcp_r_sockaddr) { - /* session is not initialized */ - return FALSE; - } - - if(rtp_stream->base->direction != STREAM_DIRECTION_NONE) { - /* update periodic (prior) history */ - rtp_periodic_history_update(&rtp_stream->receiver); - } - - rtcp_packet = (rtcp_packet_t*) (buffer + length); - length += rtcp_report_generate(rtp_stream,rtcp_packet,sizeof(buffer)-length); - - rtcp_packet = (rtcp_packet_t*) (buffer + length); - length += rtcp_sdes_generate(rtp_stream,rtcp_packet,sizeof(buffer)-length); - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Send Compound RTCP Packet [%"APR_SIZE_T_FMT" bytes] %s:%hu -> %s:%hu", - length, - rtp_stream->rtcp_l_sockaddr->hostname, - rtp_stream->rtcp_l_sockaddr->port, - rtp_stream->rtcp_r_sockaddr->hostname, - rtp_stream->rtcp_r_sockaddr->port); - if(apr_socket_sendto( - rtp_stream->rtcp_socket, - rtp_stream->rtcp_r_sockaddr, - 0, - buffer, - &length) != APR_SUCCESS) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Send Compound RTCP Packet [%"APR_SIZE_T_FMT" bytes] %s:%hu -> %s:%hu", - length, - rtp_stream->rtcp_l_sockaddr->hostname, - rtp_stream->rtcp_l_sockaddr->port, - rtp_stream->rtcp_r_sockaddr->hostname, - rtp_stream->rtcp_r_sockaddr->port); - return FALSE; - } - return TRUE; -} - -/* Send compound RTCP packet (SR/RR + SDES + BYE) */ -static apt_bool_t mpf_rtcp_bye_send(mpf_rtp_stream_t *rtp_stream, apt_str_t *reason) -{ - char buffer[MAX_RTCP_PACKET_SIZE]; - apr_size_t length = 0; - rtcp_packet_t *rtcp_packet; - - if(!rtp_stream->rtcp_socket || !rtp_stream->rtcp_l_sockaddr || !rtp_stream->rtcp_r_sockaddr) { - /* session is not initialized */ - return FALSE; - } - - if(rtp_stream->base->direction != STREAM_DIRECTION_NONE) { - /* update periodic (prior) history */ - rtp_periodic_history_update(&rtp_stream->receiver); - } - - rtcp_packet = (rtcp_packet_t*) (buffer + length); - length += rtcp_report_generate(rtp_stream,rtcp_packet,sizeof(buffer)-length); - - rtcp_packet = (rtcp_packet_t*) (buffer + length); - length += rtcp_sdes_generate(rtp_stream,rtcp_packet,sizeof(buffer)-length); - - rtcp_packet = (rtcp_packet_t*) (buffer + length); - length += rtcp_bye_generate(rtp_stream,rtcp_packet,sizeof(buffer)-length,reason); - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Send Compound RTCP Packet [BYE] [%"APR_SIZE_T_FMT" bytes] %s:%hu -> %s:%hu", - length, - rtp_stream->rtcp_l_sockaddr->hostname, - rtp_stream->rtcp_l_sockaddr->port, - rtp_stream->rtcp_r_sockaddr->hostname, - rtp_stream->rtcp_r_sockaddr->port); - if(apr_socket_sendto( - rtp_stream->rtcp_socket, - rtp_stream->rtcp_r_sockaddr, - 0, - buffer, - &length) != APR_SUCCESS) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Send Compound RTCP Packet [BYE] [%"APR_SIZE_T_FMT" bytes] %s:%hu -> %s:%hu", - length, - rtp_stream->rtcp_l_sockaddr->hostname, - rtp_stream->rtcp_l_sockaddr->port, - rtp_stream->rtcp_r_sockaddr->hostname, - rtp_stream->rtcp_r_sockaddr->port); - return FALSE; - } - return TRUE; -} - -static APR_INLINE void rtcp_sr_get(mpf_rtp_stream_t *rtp_stream, rtcp_sr_stat_t *sr_stat) -{ - rtcp_sr_ntoh(sr_stat); - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Get RTCP SR [ssrc:%u s:%u o:%u ts:%u]", - sr_stat->ssrc, - sr_stat->sent_packets, - sr_stat->sent_octets, - sr_stat->rtp_ts); -} - -static APR_INLINE void rtcp_rr_get(mpf_rtp_stream_t *rtp_stream, rtcp_rr_stat_t *rr_stat) -{ - rtcp_rr_ntoh(rr_stat); - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Get RTCP RR [ssrc:%u last_seq:%u j:%u lost:%u frac:%d]", - rr_stat->ssrc, - rr_stat->last_seq, - rr_stat->jitter, - rr_stat->lost, - rr_stat->fraction); -} - -static apt_bool_t mpf_rtcp_compound_packet_receive(mpf_rtp_stream_t *rtp_stream, char *buffer, apr_size_t length) -{ - rtcp_packet_t *rtcp_packet = (rtcp_packet_t*) buffer; - rtcp_packet_t *rtcp_packet_end; - - rtcp_packet_end = (rtcp_packet_t*)(buffer + length); - - while(rtcp_packet < rtcp_packet_end && rtcp_packet->header.version == RTP_VERSION) { - rtcp_packet->header.length = ntohs((apr_uint16_t)rtcp_packet->header.length); - - if(rtcp_packet->header.pt == RTCP_SR) { - /* RTCP SR */ - rtcp_sr_get(rtp_stream,&rtcp_packet->r.sr.sr_stat); - if(rtcp_packet->header.count) { - rtcp_rr_get(rtp_stream,rtcp_packet->r.sr.rr_stat); - } - } - else if(rtcp_packet->header.pt == RTCP_RR) { - /* RTCP RR */ - rtcp_packet->r.rr.ssrc = ntohl(rtcp_packet->r.rr.ssrc); - if(rtcp_packet->header.count) { - rtcp_rr_get(rtp_stream,rtcp_packet->r.rr.rr_stat); - } - } - else if(rtcp_packet->header.pt == RTCP_SDES) { - /* RTCP SDES */ - } - else if(rtcp_packet->header.pt == RTCP_BYE) { - /* RTCP BYE */ - } - else { - /* unknown RTCP packet */ - } - - /* get next RTCP packet */ - rtcp_packet = (rtcp_packet_t*)((apr_uint32_t*)rtcp_packet + rtcp_packet->header.length + 1); - } - - if(rtcp_packet != rtcp_packet_end) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Malformed Compound RTCP Packet"); - return FALSE; - } - - return TRUE; -} - -static void mpf_rtcp_tx_timer_proc(apt_timer_t *timer, void *obj) -{ - mpf_rtp_stream_t *rtp_stream = obj; - - /* generate and send RTCP compound report (SR/RR + SDES) */ - mpf_rtcp_report_send(rtp_stream); - - /* re-schedule timer */ - apt_timer_set(timer,rtp_stream->settings->rtcp_tx_interval); -} - -static void mpf_rtcp_rx_timer_proc(apt_timer_t *timer, void *obj) -{ - mpf_rtp_stream_t *rtp_stream = obj; - if(rtp_stream->rtcp_socket && rtp_stream->rtcp_l_sockaddr && rtp_stream->rtcp_r_sockaddr) { - char buffer[MAX_RTCP_PACKET_SIZE]; - apr_size_t length = sizeof(buffer); - - if(apr_socket_recv(rtp_stream->rtcp_socket,buffer,&length) == APR_SUCCESS) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive Compound RTCP Packet [%"APR_SIZE_T_FMT" bytes] %s:%hu <- %s:%hu", - length, - rtp_stream->rtcp_l_sockaddr->hostname, - rtp_stream->rtcp_l_sockaddr->port, - rtp_stream->rtcp_r_sockaddr->hostname, - rtp_stream->rtcp_r_sockaddr->port); - mpf_rtcp_compound_packet_receive(rtp_stream,buffer,length); - } - } - - /* re-schedule timer */ - apt_timer_set(timer,rtp_stream->settings->rtcp_rx_resolution); -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_rtp_termination_factory.c b/libs/unimrcp/libs/mpf/src/mpf_rtp_termination_factory.c deleted file mode 100644 index 497c33da41..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_rtp_termination_factory.c +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_rtp_termination_factory.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include "mpf_termination.h" -#include "mpf_rtp_termination_factory.h" -#include "mpf_rtp_stream.h" -#include "apt_log.h" - -typedef struct media_engine_slot_t media_engine_slot_t; -typedef struct rtp_termination_factory_t rtp_termination_factory_t; - -struct media_engine_slot_t { - mpf_engine_t *media_engine; - mpf_rtp_config_t *rtp_config; -}; - -struct rtp_termination_factory_t { - mpf_termination_factory_t base; - - mpf_rtp_config_t *config; - apr_array_header_t *media_engine_slots; - apr_pool_t *pool; -}; - -static apt_bool_t mpf_rtp_termination_destroy(mpf_termination_t *termination) -{ - return TRUE; -} - -static apt_bool_t mpf_rtp_termination_add(mpf_termination_t *termination, void *descriptor) -{ - apt_bool_t status = TRUE; - mpf_rtp_termination_descriptor_t *rtp_descriptor = descriptor; - mpf_audio_stream_t *audio_stream = termination->audio_stream; - if(!audio_stream) { - int i; - media_engine_slot_t *slot; - rtp_termination_factory_t *rtp_termination_factory = (rtp_termination_factory_t*)termination->termination_factory; - mpf_rtp_config_t *rtp_config = rtp_termination_factory->config; - for(i=0; imedia_engine_slots->nelts; i++) { - slot = &APR_ARRAY_IDX(rtp_termination_factory->media_engine_slots,i,media_engine_slot_t); - if(slot->media_engine == termination->media_engine) { - rtp_config = slot->rtp_config; - break; - } - } - audio_stream = mpf_rtp_stream_create( - termination, - rtp_config, - rtp_descriptor->audio.settings, - termination->pool); - if(!audio_stream) { - return FALSE; - } - termination->audio_stream = audio_stream; - } - - status = mpf_rtp_stream_add(audio_stream); - if(rtp_descriptor) { - status = mpf_rtp_stream_modify(audio_stream,&rtp_descriptor->audio); - } - return status; -} - -static apt_bool_t mpf_rtp_termination_modify(mpf_termination_t *termination, void *descriptor) -{ - apt_bool_t status = TRUE; - mpf_rtp_termination_descriptor_t *rtp_descriptor = descriptor; - mpf_audio_stream_t *audio_stream = termination->audio_stream; - if(!audio_stream) { - return FALSE; - } - - if(rtp_descriptor) { - status = mpf_rtp_stream_modify(audio_stream,&rtp_descriptor->audio); - } - return status; -} - -static apt_bool_t mpf_rtp_termination_subtract(mpf_termination_t *termination) -{ - mpf_audio_stream_t *audio_stream = termination->audio_stream; - if(!audio_stream) { - return FALSE; - } - - return mpf_rtp_stream_remove(audio_stream); -} - -static const mpf_termination_vtable_t rtp_vtable = { - mpf_rtp_termination_destroy, - mpf_rtp_termination_add, - mpf_rtp_termination_modify, - mpf_rtp_termination_subtract -}; - -static mpf_termination_t* mpf_rtp_termination_create(mpf_termination_factory_t *termination_factory, void *obj, apr_pool_t *pool) -{ - mpf_termination_t *termination = mpf_termination_base_create(termination_factory,obj,&rtp_vtable,NULL,NULL,pool); - if(termination) { - termination->name = "rtp-tm"; - } - return termination; -} - -static apt_bool_t mpf_rtp_factory_engine_assign(mpf_termination_factory_t *termination_factory, mpf_engine_t *media_engine) -{ - int i; - media_engine_slot_t *slot; - mpf_rtp_config_t *rtp_config; - rtp_termination_factory_t *rtp_termination_factory; - if(!termination_factory || !media_engine) { - return FALSE; - } - - rtp_termination_factory = (rtp_termination_factory_t *) termination_factory; - for(i=0; imedia_engine_slots->nelts; i++) { - slot = &APR_ARRAY_IDX(rtp_termination_factory->media_engine_slots,i,media_engine_slot_t); - if(slot->media_engine == media_engine) { - /* already exists, just return true */ - return TRUE; - } - } - - slot = apr_array_push(rtp_termination_factory->media_engine_slots); - slot->media_engine = media_engine; - rtp_config = mpf_rtp_config_alloc(rtp_termination_factory->pool); - *rtp_config = *rtp_termination_factory->config; - slot->rtp_config = rtp_config; - - if(rtp_termination_factory->media_engine_slots->nelts > 1) { - mpf_rtp_config_t *rtp_config_prev; - - /* split RTP port range evenly among assigned media engines */ - apr_uint16_t ports_per_engine = (apr_uint16_t)((rtp_termination_factory->config->rtp_port_max - rtp_termination_factory->config->rtp_port_min) / - rtp_termination_factory->media_engine_slots->nelts); - if(ports_per_engine % 2 != 0) { - /* number of ports per engine should be even (RTP/RTCP pair)*/ - ports_per_engine--; - } - /* rewrite max RTP port for the first slot */ - slot = &APR_ARRAY_IDX(rtp_termination_factory->media_engine_slots,0,media_engine_slot_t); - rtp_config_prev = slot->rtp_config; - rtp_config_prev->rtp_port_max = rtp_config_prev->rtp_port_min + ports_per_engine; - - /* rewrite cur, min and max RTP ports for the slots between first and last, if any */ - for(i=1; imedia_engine_slots->nelts-1; i++) { - slot = &APR_ARRAY_IDX(rtp_termination_factory->media_engine_slots,i,media_engine_slot_t); - rtp_config = slot->rtp_config; - rtp_config->rtp_port_min = rtp_config_prev->rtp_port_max; - rtp_config->rtp_port_max = rtp_config->rtp_port_min + ports_per_engine; - - rtp_config->rtp_port_cur = rtp_config->rtp_port_min; - - rtp_config_prev = rtp_config; - } - - /* rewrite cur and min but leave max RTP port for the last slot */ - slot = &APR_ARRAY_IDX(rtp_termination_factory->media_engine_slots, - rtp_termination_factory->media_engine_slots->nelts-1,media_engine_slot_t); - rtp_config = slot->rtp_config; - rtp_config->rtp_port_min = rtp_config_prev->rtp_port_max; - rtp_config->rtp_port_cur = rtp_config->rtp_port_min; - } - return TRUE; -} - -MPF_DECLARE(mpf_termination_factory_t*) mpf_rtp_termination_factory_create( - mpf_rtp_config_t *rtp_config, - apr_pool_t *pool) -{ - rtp_termination_factory_t *rtp_termination_factory; - if(!rtp_config) { - return NULL; - } - rtp_config->rtp_port_cur = rtp_config->rtp_port_min; - rtp_termination_factory = apr_palloc(pool,sizeof(rtp_termination_factory_t)); - rtp_termination_factory->base.create_termination = mpf_rtp_termination_create; - rtp_termination_factory->base.assign_engine = mpf_rtp_factory_engine_assign; - rtp_termination_factory->pool = pool; - rtp_termination_factory->config = rtp_config; - rtp_termination_factory->media_engine_slots = apr_array_make(pool,1,sizeof(media_engine_slot_t)); - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create RTP Termination Factory %s:[%hu,%hu]", - rtp_config->ip.buf, - rtp_config->rtp_port_min, - rtp_config->rtp_port_max); - return &rtp_termination_factory->base; -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_scheduler.c b/libs/unimrcp/libs/mpf/src/mpf_scheduler.c deleted file mode 100644 index dab8e6b067..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_scheduler.c +++ /dev/null @@ -1,267 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_scheduler.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mpf_scheduler.h" - -#ifdef WIN32 -#define ENABLE_MULTIMEDIA_TIMERS -#endif - -#ifdef ENABLE_MULTIMEDIA_TIMERS - -#pragma warning(disable:4201) -#include -#include - -#ifndef TIME_KILL_SYNCHRONOUS -#define TIME_KILL_SYNCHRONOUS 0x0100 -#endif - -#else -#include -#endif - - -struct mpf_scheduler_t { - apr_pool_t *pool; - unsigned long resolution; /* scheduler resolution */ - - unsigned long media_resolution; - mpf_scheduler_proc_f media_proc; - void *media_obj; - - unsigned long timer_resolution; - unsigned long timer_elapsed_time; - mpf_scheduler_proc_f timer_proc; - void *timer_obj; - -#ifdef ENABLE_MULTIMEDIA_TIMERS - unsigned int timer_id; -#else - apr_thread_t *thread; - apt_bool_t running; -#endif -}; - -static APR_INLINE void mpf_scheduler_init(mpf_scheduler_t *scheduler); - -/** Create scheduler */ -MPF_DECLARE(mpf_scheduler_t*) mpf_scheduler_create(apr_pool_t *pool) -{ - mpf_scheduler_t *scheduler = apr_palloc(pool,sizeof(mpf_scheduler_t)); - mpf_scheduler_init(scheduler); - scheduler->pool = pool; - scheduler->resolution = 0; - - scheduler->media_resolution = 0; - scheduler->media_obj = NULL; - scheduler->media_proc = NULL; - - scheduler->timer_resolution = 0; - scheduler->timer_elapsed_time = 0; - scheduler->timer_obj = NULL; - scheduler->timer_proc = NULL; - return scheduler; -} - -/** Destroy scheduler */ -MPF_DECLARE(void) mpf_scheduler_destroy(mpf_scheduler_t *scheduler) -{ - /* nothing to destroy */ -} - -/** Set media processing clock */ -MPF_DECLARE(apt_bool_t) mpf_scheduler_media_clock_set( - mpf_scheduler_t *scheduler, - unsigned long resolution, - mpf_scheduler_proc_f proc, - void *obj) -{ - scheduler->media_resolution = resolution; - scheduler->media_proc = proc; - scheduler->media_obj = obj; - return TRUE; -} - -/** Set timer clock */ -MPF_DECLARE(apt_bool_t) mpf_scheduler_timer_clock_set( - mpf_scheduler_t *scheduler, - unsigned long resolution, - mpf_scheduler_proc_f proc, - void *obj) -{ - scheduler->timer_resolution = resolution; - scheduler->timer_elapsed_time = 0; - scheduler->timer_proc = proc; - scheduler->timer_obj = obj; - return TRUE; -} - -/** Set scheduler rate (n times faster than real-time) */ -MPF_DECLARE(apt_bool_t) mpf_scheduler_rate_set( - mpf_scheduler_t *scheduler, - unsigned long rate) -{ - if(rate == 0 || rate > 10) { - /* rate shows how many times scheduler should be faster than real-time, - 1 is the defualt and probably the only reasonable value, - however, the rates up to 10 times faster should be acceptable */ - rate = 1; - } - - scheduler->media_resolution /= rate; - scheduler->timer_resolution /= rate; - return TRUE; -} - -static APR_INLINE void mpf_scheduler_resolution_set(mpf_scheduler_t *scheduler) -{ - if(scheduler->media_resolution) { - scheduler->resolution = scheduler->media_resolution; - } - else if(scheduler->timer_resolution) { - scheduler->resolution = scheduler->timer_resolution; - } -} - - - -#ifdef ENABLE_MULTIMEDIA_TIMERS - -static APR_INLINE void mpf_scheduler_init(mpf_scheduler_t *scheduler) -{ - scheduler->timer_id = 0; -} - -static void CALLBACK mm_timer_proc(UINT uID, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2) -{ - mpf_scheduler_t *scheduler = (mpf_scheduler_t*) dwUser; - if(scheduler->media_proc) { - scheduler->media_proc(scheduler,scheduler->media_obj); - } - - if(scheduler->timer_proc) { - scheduler->timer_elapsed_time += scheduler->resolution; - if(scheduler->timer_elapsed_time >= scheduler->timer_resolution) { - scheduler->timer_elapsed_time = 0; - scheduler->timer_proc(scheduler,scheduler->timer_obj); - } - } -} - -/** Start scheduler */ -MPF_DECLARE(apt_bool_t) mpf_scheduler_start(mpf_scheduler_t *scheduler) -{ - mpf_scheduler_resolution_set(scheduler); - scheduler->timer_id = timeSetEvent( - scheduler->resolution, 0, mm_timer_proc, (DWORD_PTR) scheduler, - TIME_PERIODIC | TIME_CALLBACK_FUNCTION | TIME_KILL_SYNCHRONOUS); - return scheduler->timer_id ? TRUE : FALSE; -} - -/** Stop scheduler */ -MPF_DECLARE(apt_bool_t) mpf_scheduler_stop(mpf_scheduler_t *scheduler) -{ - if(!scheduler) { - return FALSE; - } - - timeKillEvent(scheduler->timer_id); - scheduler->timer_id = 0; - return TRUE; -} - -#else - -#include "apt_task.h" - -static APR_INLINE void mpf_scheduler_init(mpf_scheduler_t *scheduler) -{ - scheduler->thread = NULL; - scheduler->running = FALSE; -} - -static void* APR_THREAD_FUNC timer_thread_proc(apr_thread_t *thread, void *data) -{ - mpf_scheduler_t *scheduler = data; - apr_interval_time_t timeout = scheduler->resolution * 1000; - apr_interval_time_t time_drift = 0; - apr_time_t time_now, time_last; - -#if APR_HAS_SETTHREADNAME - apr_thread_name_set("MPF Scheduler"); -#endif - time_now = apr_time_now(); - while(scheduler->running == TRUE) { - time_last = time_now; - - if(scheduler->media_proc) { - scheduler->media_proc(scheduler,scheduler->media_obj); - } - - if(scheduler->timer_proc) { - scheduler->timer_elapsed_time += scheduler->resolution; - if(scheduler->timer_elapsed_time >= scheduler->timer_resolution) { - scheduler->timer_elapsed_time = 0; - scheduler->timer_proc(scheduler,scheduler->timer_obj); - } - } - - if(timeout > time_drift) { - apr_sleep(timeout - time_drift); - } - - time_now = apr_time_now(); - time_drift += time_now - time_last - timeout; -#if 0 - printf("time_drift=%d\n",time_drift); -#endif - } - - apr_thread_exit(thread,APR_SUCCESS); - return NULL; -} - -MPF_DECLARE(apt_bool_t) mpf_scheduler_start(mpf_scheduler_t *scheduler) -{ - mpf_scheduler_resolution_set(scheduler); - - scheduler->running = TRUE; - if(apr_thread_create(&scheduler->thread,NULL,timer_thread_proc,scheduler,scheduler->pool) != APR_SUCCESS) { - scheduler->running = FALSE; - return FALSE; - } - return TRUE; -} - -MPF_DECLARE(apt_bool_t) mpf_scheduler_stop(mpf_scheduler_t *scheduler) -{ - if(!scheduler) { - return FALSE; - } - - scheduler->running = FALSE; - if(scheduler->thread) { - apr_status_t s; - apr_thread_join(&s,scheduler->thread); - scheduler->thread = NULL; - } - return TRUE; -} - -#endif diff --git a/libs/unimrcp/libs/mpf/src/mpf_stream.c b/libs/unimrcp/libs/mpf/src/mpf_stream.c deleted file mode 100644 index 2c0c890aa2..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_stream.c +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_stream.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mpf_stream.h" - -/** Create stream capabilities */ -MPF_DECLARE(mpf_stream_capabilities_t*) mpf_stream_capabilities_create(mpf_stream_direction_e direction, apr_pool_t *pool) -{ - mpf_stream_capabilities_t *capabilities = (mpf_stream_capabilities_t*)apr_palloc(pool,sizeof(mpf_stream_capabilities_t)); - capabilities->direction = direction; - mpf_codec_capabilities_init(&capabilities->codecs,1,pool); - return capabilities; -} - -/** Clone stream capabilities */ -MPF_DECLARE(mpf_stream_capabilities_t*) mpf_stream_capabilities_clone(const mpf_stream_capabilities_t *src_capabilities, apr_pool_t *pool) -{ - mpf_stream_capabilities_t *capabilities = (mpf_stream_capabilities_t*)apr_palloc(pool,sizeof(mpf_stream_capabilities_t)); - capabilities->direction = src_capabilities->direction; - mpf_codec_capabilities_clone(&capabilities->codecs,&src_capabilities->codecs,pool); - return capabilities; -} - -/** Merge stream capabilities */ -MPF_DECLARE(apt_bool_t) mpf_stream_capabilities_merge(mpf_stream_capabilities_t *capabilities, const mpf_stream_capabilities_t *src_capabilities, apr_pool_t *pool) -{ - capabilities->direction |= src_capabilities->direction; - return mpf_codec_capabilities_merge(&capabilities->codecs,&src_capabilities->codecs,pool); -} - - - -/** Create audio stream */ -MPF_DECLARE(mpf_audio_stream_t*) mpf_audio_stream_create(void *obj, const mpf_audio_stream_vtable_t *vtable, const mpf_stream_capabilities_t *capabilities, apr_pool_t *pool) -{ - mpf_audio_stream_t *stream; - if(!vtable || !capabilities) { - return NULL; - } - - /* validate required fields */ - if(capabilities->direction & STREAM_DIRECTION_SEND) { - /* validate sink */ - if(!vtable->write_frame) { - return NULL; - } - } - if(capabilities->direction & STREAM_DIRECTION_RECEIVE) { - /* validate source */ - if(!vtable->read_frame) { - return NULL; - } - } - - stream = (mpf_audio_stream_t*)apr_palloc(pool,sizeof(mpf_audio_stream_t)); - stream->obj = obj; - stream->vtable = vtable; - stream->termination = NULL; - stream->capabilities = capabilities; - stream->direction = capabilities->direction; - stream->rx_descriptor = NULL; - stream->rx_event_descriptor = NULL; - stream->tx_descriptor = NULL; - stream->tx_event_descriptor = NULL; - return stream; -} - -/** Validate audio stream receiver */ -MPF_DECLARE(apt_bool_t) mpf_audio_stream_rx_validate( - mpf_audio_stream_t *stream, - const mpf_codec_descriptor_t *descriptor, - const mpf_codec_descriptor_t *event_descriptor, - apr_pool_t *pool) -{ - if(!stream->capabilities) { - return FALSE; - } - - if(!stream->rx_descriptor) { - stream->rx_descriptor = mpf_codec_descriptor_create_by_capabilities(&stream->capabilities->codecs,descriptor,pool); - } - if(!stream->rx_event_descriptor) { - if(stream->capabilities->codecs.allow_named_events == TRUE && event_descriptor) { - stream->rx_event_descriptor = apr_palloc(pool,sizeof(mpf_codec_descriptor_t)); - *stream->rx_event_descriptor = *event_descriptor; - } - } - - return stream->rx_descriptor ? TRUE : FALSE; -} - -/** Validate audio stream transmitter */ -MPF_DECLARE(apt_bool_t) mpf_audio_stream_tx_validate( - mpf_audio_stream_t *stream, - const mpf_codec_descriptor_t *descriptor, - const mpf_codec_descriptor_t *event_descriptor, - apr_pool_t *pool) -{ - if(!stream->capabilities) { - return FALSE; - } - - if(!stream->tx_descriptor) { - stream->tx_descriptor = mpf_codec_descriptor_create_by_capabilities(&stream->capabilities->codecs,descriptor,pool); - } - if(!stream->tx_event_descriptor) { - if(stream->capabilities->codecs.allow_named_events == TRUE && event_descriptor) { - stream->tx_event_descriptor = apr_palloc(pool,sizeof(mpf_codec_descriptor_t)); - *stream->tx_event_descriptor = *event_descriptor; - } - } - return stream->tx_descriptor ? TRUE : FALSE; -} - -/** Trace media path */ -MPF_DECLARE(void) mpf_audio_stream_trace(mpf_audio_stream_t *stream, mpf_stream_direction_e direction, apt_text_stream_t *output) -{ - if(stream->vtable->trace) { - stream->vtable->trace(stream,direction,output); - return; - } - - if(direction & STREAM_DIRECTION_SEND) { - mpf_codec_descriptor_t *descriptor = stream->tx_descriptor; - if(descriptor) { - apr_size_t offset = output->pos - output->text.buf; - output->pos += apr_snprintf(output->pos, output->text.length - offset, - "[%s/%d/%d]->Sink", - descriptor->name.buf, - descriptor->sampling_rate, - descriptor->channel_count); - } - } - if(direction & STREAM_DIRECTION_RECEIVE) { - mpf_codec_descriptor_t *descriptor = stream->rx_descriptor; - if(descriptor) { - apr_size_t offset = output->pos - output->text.buf; - output->pos += apr_snprintf(output->pos, output->text.length - offset, - "Source->[%s/%d/%d]", - descriptor->name.buf, - descriptor->sampling_rate, - descriptor->channel_count); - } - } -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_termination.c b/libs/unimrcp/libs/mpf/src/mpf_termination.c deleted file mode 100644 index 23e7a3aaaa..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_termination.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_termination.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mpf_termination.h" -#include "mpf_stream.h" -#include "mpf_codec_manager.h" - -MPF_DECLARE(mpf_termination_t*) mpf_termination_base_create( - mpf_termination_factory_t *termination_factory, - void *obj, - const mpf_termination_vtable_t *vtable, - mpf_audio_stream_t *audio_stream, - mpf_video_stream_t *video_stream, - apr_pool_t *pool) -{ - mpf_termination_t *termination = apr_palloc(pool,sizeof(mpf_termination_t)); - termination->pool = pool; - termination->name = "media-tm"; - termination->obj = obj; - termination->media_engine = NULL; - termination->event_handler = NULL; - termination->codec_manager = NULL; - termination->timer_queue = NULL; - termination->termination_factory = termination_factory; - termination->vtable = vtable; - termination->slot = 0; - if(audio_stream) { - audio_stream->termination = termination; - } - if(video_stream) { - video_stream->termination = termination; - } - termination->audio_stream = audio_stream; - termination->video_stream = video_stream; - return termination; -} - -MPF_DECLARE(apt_bool_t) mpf_termination_add(mpf_termination_t *termination, void *descriptor) -{ - if(termination->vtable && termination->vtable->add) { - termination->vtable->add(termination,descriptor); - } - return TRUE; -} - -MPF_DECLARE(apt_bool_t) mpf_termination_modify(mpf_termination_t *termination, void *descriptor) -{ - if(termination->vtable && termination->vtable->modify) { - termination->vtable->modify(termination,descriptor); - } - return TRUE; -} - -MPF_DECLARE(apt_bool_t) mpf_termination_subtract(mpf_termination_t *termination) -{ - if(termination->vtable && termination->vtable->subtract) { - termination->vtable->subtract(termination); - } - return TRUE; -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_termination_factory.c b/libs/unimrcp/libs/mpf/src/mpf_termination_factory.c deleted file mode 100644 index f8d0034c8b..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_termination_factory.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_termination_factory.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mpf_termination_factory.h" -#include "mpf_termination.h" - -/** Assign media engine to termination factory */ -MPF_DECLARE(apt_bool_t) mpf_termination_factory_engine_assign( - mpf_termination_factory_t *termination_factory, - mpf_engine_t *media_engine) -{ - if(termination_factory && termination_factory->assign_engine && media_engine) { - return termination_factory->assign_engine(termination_factory,media_engine); - } - return FALSE; -} - -/** Create MPF termination from termination factory */ -MPF_DECLARE(mpf_termination_t*) mpf_termination_create( - mpf_termination_factory_t *termination_factory, - void *obj, - apr_pool_t *pool) -{ - if(termination_factory && termination_factory->create_termination) { - return termination_factory->create_termination(termination_factory,obj,pool); - } - return NULL; -} - -/** Create raw MPF termination. */ -MPF_DECLARE(mpf_termination_t*) mpf_raw_termination_create( - void *obj, - mpf_audio_stream_t *audio_stream, - mpf_video_stream_t *video_stream, - apr_pool_t *pool) -{ - return mpf_termination_base_create(NULL,obj,NULL,audio_stream,video_stream,pool); -} - -MPF_DECLARE(apt_bool_t) mpf_termination_destroy(mpf_termination_t *termination) -{ - if(termination->vtable && termination->vtable->destroy) { - termination->vtable->destroy(termination); - } - return TRUE; -} - -/** Get termination name */ -MPF_DECLARE(const char*) mpf_termination_name_get(const mpf_termination_t *termination) -{ - return termination->name; -} - -/** Get associated object. */ -MPF_DECLARE(void*) mpf_termination_object_get(const mpf_termination_t *termination) -{ - return termination->obj; -} - -/** Get audio stream. */ -MPF_DECLARE(mpf_audio_stream_t*) mpf_termination_audio_stream_get(const mpf_termination_t *termination) -{ - return termination->audio_stream; -} - -/** Get video stream. */ -MPF_DECLARE(mpf_video_stream_t*) mpf_termination_video_stream_get(const mpf_termination_t *termination) -{ - return termination->video_stream; -} diff --git a/libs/unimrcp/libs/mrcp-client/Makefile.am b/libs/unimrcp/libs/mrcp-client/Makefile.am deleted file mode 100644 index dfbacdcb77..0000000000 --- a/libs/unimrcp/libs/mrcp-client/Makefile.am +++ /dev/null @@ -1,23 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -AM_CPPFLAGS = -I$(top_srcdir)/libs/mrcp-client/include \ - -I$(top_srcdir)/libs/mrcp-signaling/include \ - -I$(top_srcdir)/libs/mrcpv2-transport/include \ - -I$(top_srcdir)/libs/mrcp/include \ - -I$(top_srcdir)/libs/mrcp/message/include \ - -I$(top_srcdir)/libs/mrcp/control/include \ - -I$(top_srcdir)/libs/mrcp/resources/include \ - -I$(top_srcdir)/libs/mpf/include \ - -I$(top_srcdir)/libs/apr-toolkit/include \ - $(UNIMRCP_APR_INCLUDES) - -noinst_LTLIBRARIES = libmrcpclient.la - -include_HEADERS = include/mrcp_client_types.h \ - include/mrcp_client.h \ - include/mrcp_client_session.h \ - include/mrcp_application.h - -libmrcpclient_la_SOURCES = src/mrcp_client.c \ - src/mrcp_client_session.c \ - src/mrcp_application.c diff --git a/libs/unimrcp/libs/mrcp-client/include/mrcp_application.h b/libs/unimrcp/libs/mrcp-client/include/mrcp_application.h deleted file mode 100644 index 3770e77ece..0000000000 --- a/libs/unimrcp/libs/mrcp-client/include/mrcp_application.h +++ /dev/null @@ -1,360 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_application.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_APPLICATION_H -#define MRCP_APPLICATION_H - -/** - * @file mrcp_application.h - * @brief MRCP User Level Application Interface - */ - -#include "mrcp_client_types.h" -#include "mpf_rtp_descriptor.h" -#include "mpf_stream.h" - -APT_BEGIN_EXTERN_C - -/** MRCP application message declaration */ -typedef struct mrcp_app_message_t mrcp_app_message_t; - -/** MRCP signaling message declaration */ -typedef struct mrcp_sig_message_t mrcp_sig_message_t; - -/** MRCP application message dispatcher declaration */ -typedef struct mrcp_app_message_dispatcher_t mrcp_app_message_dispatcher_t; - -/** MRCP application message handler */ -typedef apt_bool_t (*mrcp_app_message_handler_f)(const mrcp_app_message_t *app_message); - -/** Enumeration of MRCP signaling message types */ -typedef enum { - MRCP_SIG_MESSAGE_TYPE_REQUEST, /**< request message */ - MRCP_SIG_MESSAGE_TYPE_RESPONSE, /**< response message */ - MRCP_SIG_MESSAGE_TYPE_EVENT /**< event message */ -} mrcp_sig_message_type_e; - -/** Enumeration of MRCP signaling status codes */ -typedef enum { - MRCP_SIG_STATUS_CODE_SUCCESS, /**< indicates success */ - MRCP_SIG_STATUS_CODE_FAILURE, /**< request failed */ - MRCP_SIG_STATUS_CODE_TERMINATE, /**< request failed, session/channel/connection unexpectedly terminated */ - MRCP_SIG_STATUS_CODE_CANCEL /**< request cancelled */ -} mrcp_sig_status_code_e; - - -/** Enumeration of MRCP signaling commands (requests/responses) */ -typedef enum { - MRCP_SIG_COMMAND_SESSION_UPDATE, - MRCP_SIG_COMMAND_SESSION_TERMINATE, - MRCP_SIG_COMMAND_CHANNEL_ADD, - MRCP_SIG_COMMAND_CHANNEL_REMOVE, - MRCP_SIG_COMMAND_RESOURCE_DISCOVER -} mrcp_sig_command_e; - -/** Enumeration of MRCP signaling events */ -typedef enum { - MRCP_SIG_EVENT_TERMINATE -} mrcp_sig_event_e; - - -/** Enumeration of MRCP application message types */ -typedef enum { - MRCP_APP_MESSAGE_TYPE_SIGNALING, /**< signaling message type */ - MRCP_APP_MESSAGE_TYPE_CONTROL /**< control message type */ -} mrcp_app_message_type_e; - -/** MRCP signaling message definition */ -struct mrcp_sig_message_t { - /** Message type (request/response/event) */ - mrcp_sig_message_type_e message_type; - /** Command (request/response) identifier */ - mrcp_sig_command_e command_id; - /** Event identifier */ - mrcp_sig_event_e event_id; - /** Status code used in response */ - mrcp_sig_status_code_e status; -}; - - -/** MRCP application message definition */ -struct mrcp_app_message_t { - /** Message type (signaling/control) */ - mrcp_app_message_type_e message_type; - - /** Application */ - mrcp_application_t *application; - /** Session */ - mrcp_session_t *session; - /** Channel */ - mrcp_channel_t *channel; - /** Session/resource descriptor */ - mrcp_session_descriptor_t *descriptor; - - /** MRCP signaling message (used if message_type == MRCP_APP_MESSAGE_SIGNALING) */ - mrcp_sig_message_t sig_message; - /** MRCP control message (used if message_type == MRCP_APP_MESSAGE_CONTROL) */ - mrcp_message_t *control_message; -}; - -/** MRCP application message dispatcher interface */ -struct mrcp_app_message_dispatcher_t { - /** Response to mrcp_application_session_update()request */ - apt_bool_t (*on_session_update)(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status); - /** Response to mrcp_application_session_terminate()request */ - apt_bool_t (*on_session_terminate)(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status); - - /** Response to mrcp_application_channel_add() request */ - apt_bool_t (*on_channel_add)(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status); - /** Response to mrcp_application_channel_remove() request */ - apt_bool_t (*on_channel_remove)(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status); - - /** Response (event) to mrcp_application_message_send() request */ - apt_bool_t (*on_message_receive)(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message); - - /** Event indicating unexpected session/channel termination */ - apt_bool_t (*on_terminate_event)(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel); - - /** Response to mrcp_application_resource_discover() request */ - apt_bool_t (*on_resource_discover)(mrcp_application_t *application, mrcp_session_t *session, mrcp_session_descriptor_t *descriptor, mrcp_sig_status_code_e status); -}; - - - -/** - * Create application instance. - * @param handler the event handler - * @param obj the external object - * @param pool the pool to allocate memory from - */ -MRCP_DECLARE(mrcp_application_t*) mrcp_application_create(const mrcp_app_message_handler_f handler, void *obj, apr_pool_t *pool); - -/** - * Destroy application instance. - * @param application the application to destroy - */ -MRCP_DECLARE(apt_bool_t) mrcp_application_destroy(mrcp_application_t *application); - -/** - * Get external object associated with the application. - * @param application the application to get object from - */ -MRCP_DECLARE(void*) mrcp_application_object_get(const mrcp_application_t *application); - -/** - * Get dir layout structure. - * @param application the application to get dir layout from - */ -MRCP_DECLARE(const apt_dir_layout_t*) mrcp_application_dir_layout_get(const mrcp_application_t *application); - -/** - * Create session. - * @param application the entire application - * @param profile the name of the profile to use - * @param obj the external object - * @return the created session instance - */ -MRCP_DECLARE(mrcp_session_t*) mrcp_application_session_create(mrcp_application_t *application, const char *profile, void *obj); - -/** - * Get memory pool the session object is created out of. - * @param session the session to get pool from - */ -MRCP_DECLARE(apr_pool_t*) mrcp_application_session_pool_get(const mrcp_session_t *session); - -/** - * Get session identifier. - * @param session the session to get identifier of - */ -MRCP_DECLARE(const apt_str_t*) mrcp_application_session_id_get(const mrcp_session_t *session); - -/** - * Get SIP or RTSP response code. - * @param session the session to use - */ -MRCP_DECLARE(int) mrcp_application_session_response_code_get(const mrcp_session_t *session); - -/** - * Get external object associated with the session. - * @param session the session to get object from - */ -MRCP_DECLARE(void*) mrcp_application_session_object_get(const mrcp_session_t *session); - -/** - * Set (associate) external object to the session. - * @param session the session to set object for - * @param obj the object to set - */ -MRCP_DECLARE(void) mrcp_application_session_object_set(mrcp_session_t *session, void *obj); - -/** - * Set name of the session (informative only used for debugging). - * @param session the session to set name for - * @param name the name to set - */ -MRCP_DECLARE(void) mrcp_application_session_name_set(mrcp_session_t *session, const char *name); - -/** - * Send session update request. - * @param session the session to update - */ -MRCP_DECLARE(apt_bool_t) mrcp_application_session_update(mrcp_session_t *session); - -/** - * Send session termination request. - * @param session the session to terminate - */ -MRCP_DECLARE(apt_bool_t) mrcp_application_session_terminate(mrcp_session_t *session); - -/** - * Destroy client session (session must be terminated prior to destroy). - * @param session the session to destroy - */ -MRCP_DECLARE(apt_bool_t) mrcp_application_session_destroy(mrcp_session_t *session); - - -/** - * Create control channel. - * @param session the session to create channel for - * @param resource_id the resource identifier of the channel - * @param termination the media termination - * @param rtp_descriptor the RTP termination descriptor (NULL by default) - * @param obj the external object - */ -MRCP_DECLARE(mrcp_channel_t*) mrcp_application_channel_create( - mrcp_session_t *session, - mrcp_resource_id resource_id, - mpf_termination_t *termination, - mpf_rtp_termination_descriptor_t *rtp_descriptor, - void *obj); - -/** - * Get external object associated with the channel. - * @param channel the channel to get object from - */ -MRCP_DECLARE(void*) mrcp_application_channel_object_get(const mrcp_channel_t *channel); - -/** - * Get RTP termination descriptor. - * @param channel the channel to get descriptor from - */ -MRCP_DECLARE(mpf_rtp_termination_descriptor_t*) mrcp_application_rtp_descriptor_get(const mrcp_channel_t *channel); - -/** - * Get codec descriptor of source stream. - * @param channel the channel to get descriptor from - */ -MRCP_DECLARE(const mpf_codec_descriptor_t*) mrcp_application_source_descriptor_get(const mrcp_channel_t *channel); - -/** - * Get codec descriptor of sink stream. - * @param channel the channel to get descriptor from - */ -MRCP_DECLARE(const mpf_codec_descriptor_t*) mrcp_application_sink_descriptor_get(const mrcp_channel_t *channel); - -/** - * Get associated audio stream. - * @param channel the channel to get associated stream from - */ -MRCP_DECLARE(const mpf_audio_stream_t*) mrcp_application_audio_stream_get(const mrcp_channel_t *channel); - -/** - * Send channel add request. - * @param session the session to create channel for - * @param channel the control channel - */ -MRCP_DECLARE(apt_bool_t) mrcp_application_channel_add(mrcp_session_t *session, mrcp_channel_t *channel); - -/** - * Create MRCP message. - * @param session the session - * @param channel the control channel - * @param method_id the method identifier of MRCP message - */ -MRCP_DECLARE(mrcp_message_t*) mrcp_application_message_create(mrcp_session_t *session, mrcp_channel_t *channel, mrcp_method_id method_id); - -/** - * Send MRCP message. - * @param session the session - * @param channel the control channel - * @param message the MRCP message to send - */ -MRCP_DECLARE(apt_bool_t) mrcp_application_message_send(mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message); - -/** - * Remove channel. - * @param session the session to remove channel from - * @param channel the control channel to remove - */ -MRCP_DECLARE(apt_bool_t) mrcp_application_channel_remove(mrcp_session_t *session, mrcp_channel_t *channel); - -/** - * Discover resources. - * @param session the session to use as communication object - */ -MRCP_DECLARE(apt_bool_t) mrcp_application_resource_discover(mrcp_session_t *session); - -/** - * Dispatch application message. - * @param dispatcher the dispatcher inteface - * @param app_message the message to dispatch - */ -MRCP_DECLARE(apt_bool_t) mrcp_application_message_dispatch(const mrcp_app_message_dispatcher_t *dispatcher, const mrcp_app_message_t *app_message); - -/** - * Create audio termination - * @param session the session to create termination for - * @param stream_vtable the virtual table of audio stream - * @param capabilities the capabilities of the stream - * @param obj the external object - */ -MRCP_DECLARE(mpf_termination_t*) mrcp_application_audio_termination_create( - mrcp_session_t *session, - const mpf_audio_stream_vtable_t *stream_vtable, - mpf_stream_capabilities_t *capabilities, - void *obj); -/** - * Create source media termination - * @param session the session to create termination for - * @param stream_vtable the virtual table of audio stream - * @param codec_descriptor the descriptor of audio stream (NULL by default) - * @param obj the external object - * @deprecated @see mrcp_application_audio_termination_create() - */ -MRCP_DECLARE(mpf_termination_t*) mrcp_application_source_termination_create( - mrcp_session_t *session, - const mpf_audio_stream_vtable_t *stream_vtable, - mpf_codec_descriptor_t *codec_descriptor, - void *obj); -/** - * Create sink media termination - * @param session the session to create termination for - * @param stream_vtable the virtual table of audio stream - * @param codec_descriptor the descriptor of audio stream (NULL by default) - * @param obj the external object - * @deprecated @see mrcp_application_audio_termination_create() - */ -MRCP_DECLARE(mpf_termination_t*) mrcp_application_sink_termination_create( - mrcp_session_t *session, - const mpf_audio_stream_vtable_t *stream_vtable, - mpf_codec_descriptor_t *codec_descriptor, - void *obj); - -APT_END_EXTERN_C - -#endif /* MRCP_APPLICATION_H */ diff --git a/libs/unimrcp/libs/mrcp-client/include/mrcp_client.h b/libs/unimrcp/libs/mrcp-client/include/mrcp_client.h deleted file mode 100644 index 87d36e21fe..0000000000 --- a/libs/unimrcp/libs/mrcp-client/include/mrcp_client.h +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_client.h 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_CLIENT_H -#define MRCP_CLIENT_H - -/** - * @file mrcp_client.h - * @brief MRCP Client - */ - -#include "mrcp_client_types.h" -#include "mpf_rtp_descriptor.h" -#include "apt_task.h" - -APT_BEGIN_EXTERN_C - -/** Event handler used in case of asynchronous start */ -typedef void (*mrcp_client_handler_f)(apt_bool_t status); - -/** - * Create MRCP client instance. - * @return the created client instance - */ -MRCP_DECLARE(mrcp_client_t*) mrcp_client_create(apt_dir_layout_t *dir_layout); - -/** - * Set asynchronous start mode. - * @param client the MRCP client to set mode for - * @param handler the event handler to signal start completion - */ -MRCP_DECLARE(void) mrcp_client_async_start_set(mrcp_client_t *client, mrcp_client_handler_f handler); - - -/** - * Start message processing loop. - * @param client the MRCP client to start - * @return the created client instance - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_start(mrcp_client_t *client); - -/** - * Shutdown message processing loop. - * @param client the MRCP client to shutdown - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_shutdown(mrcp_client_t *client); - -/** - * Destroy MRCP client. - * @param client the MRCP client to destroy - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_destroy(mrcp_client_t *client); - - -/** - * Register MRCP resource factory. - * @param client the MRCP client to set resource factory for - * @param resource_factory the resource factory to set - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_resource_factory_register(mrcp_client_t *client, mrcp_resource_factory_t *resource_factory); - -/** - * Register codec manager. - * @param client the MRCP client to set codec manager for - * @param codec_manager the codec manager to set - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_codec_manager_register(mrcp_client_t *client, mpf_codec_manager_t *codec_manager); - -/** - * Get registered codec manager. - * @param client the MRCP client to get codec manager from - */ -MRCP_DECLARE(const mpf_codec_manager_t*) mrcp_client_codec_manager_get(const mrcp_client_t *client); - -/** - * Register media engine. - * @param client the MRCP client to set media engine for - * @param media_engine the media engine to set - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_media_engine_register(mrcp_client_t *client, mpf_engine_t *media_engine); - -/** - * Register RTP termination factory. - * @param client the MRCP client to set termination factory for - * @param rtp_termination_factory the termination factory - * @param name the name of the factory - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_rtp_factory_register(mrcp_client_t *client, mpf_termination_factory_t *rtp_termination_factory, const char *name); - -/** - * Register RTP settings. - * @param client the MRCP client to set RTP settings for - * @param rtp_settings the settings to set - * @param name the name of the settings - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_rtp_settings_register(mrcp_client_t *client, mpf_rtp_settings_t *rtp_settings, const char *name); - -/** - * Register MRCP signaling agent. - * @param client the MRCP client to set signaling agent for - * @param signaling_agent the signaling agent to set - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_signaling_agent_register(mrcp_client_t *client, mrcp_sig_agent_t *signaling_agent); - -/** - * Register MRCP signaling settings. - * @param client the MRCP client to set signaling settings for - * @param signaling_settings the signaling settings to set - * @param name the name of the agent - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_signaling_settings_register(mrcp_client_t *client, mrcp_sig_settings_t *signaling_settings, const char *name); - -/** - * Register MRCP connection agent (MRCPv2 only). - * @param client the MRCP client to set connection agent for - * @param connection_agent the connection agent to set - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_connection_agent_register(mrcp_client_t *client, mrcp_connection_agent_t *connection_agent); - -/** Create MRCP profile */ -MRCP_DECLARE(mrcp_client_profile_t*) mrcp_client_profile_create( - mrcp_resource_factory_t *resource_factory, - mrcp_sig_agent_t *signaling_agent, - mrcp_connection_agent_t *connection_agent, - mpf_engine_t *media_engine, - mpf_termination_factory_t *rtp_factory, - mpf_rtp_settings_t *rtp_settings, - mrcp_sig_settings_t *signaling_settings, - apr_pool_t *pool); - -/** Create MRCP profile (extended version) */ -MRCP_DECLARE(mrcp_client_profile_t*) mrcp_client_profile_create_ex( - mrcp_version_e mrcp_version, - mrcp_resource_factory_t *resource_factory, - mrcp_sa_factory_t *sa_factory, - mrcp_ca_factory_t *ca_factory, - mpf_engine_factory_t *mpf_factory, - mpf_termination_factory_t *rtp_factory, - mpf_rtp_settings_t *rtp_settings, - mrcp_sig_settings_t *signaling_settings, - apr_pool_t *pool); - -/** - * Set a tag to the profile. - * @param profile the profile to set a tag for - * @param tag the tag to set - */ -MRCP_DECLARE(void) mrcp_client_profile_tag_set(mrcp_client_profile_t *profile, const char *tag); - -/** - * Register MRCP profile. - * @param client the MRCP client to set profile for - * @param profile the profile to set - * @param name the name of the profile - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_profile_register(mrcp_client_t *client, mrcp_client_profile_t *profile, const char *name); - -/** - * Register MRCP application. - * @param client the MRCP client to set application for - * @param application the application to set - * @param name the name of the application - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_application_register(mrcp_client_t *client, mrcp_application_t *application, const char *name); - -/** - * Get memory pool. - * @param client the MRCP client to get memory pool from - */ -MRCP_DECLARE(apr_pool_t*) mrcp_client_memory_pool_get(const mrcp_client_t *client); - -/** - * Get media engine by name. - * @param client the MRCP client to get media engine from - * @param name the name of the media engine to lookup - */ -MRCP_DECLARE(mpf_engine_t*) mrcp_client_media_engine_get(const mrcp_client_t *client, const char *name); - -/** - * Get RTP termination factory by name. - * @param client the MRCP client to get from - * @param name the name to lookup - */ -MRCP_DECLARE(mpf_termination_factory_t*) mrcp_client_rtp_factory_get(const mrcp_client_t *client, const char *name); - -/** - * Get RTP settings by name - * @param client the MRCP client to get from - * @param name the name to lookup - */ -MRCP_DECLARE(mpf_rtp_settings_t*) mrcp_client_rtp_settings_get(const mrcp_client_t *client, const char *name); - -/** - * Get signaling agent by name. - * @param client the MRCP client to get from - * @param name the name to lookup - */ -MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_client_signaling_agent_get(const mrcp_client_t *client, const char *name); - -/** - * Get signaling settings by name. - * @param client the MRCP client to get from - * @param name the name to lookup - */ -MRCP_DECLARE(mrcp_sig_settings_t*) mrcp_client_signaling_settings_get(const mrcp_client_t *client, const char *name); - -/** - * Get connection agent by name. - * @param client the MRCP client to get from - * @param name the name to lookup - */ -MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_client_connection_agent_get(const mrcp_client_t *client, const char *name); - -/** - * Get profile by name. - * @param client the MRCP client to get from - * @param name the name to lookup - */ -MRCP_DECLARE(mrcp_client_profile_t*) mrcp_client_profile_get(const mrcp_client_t *client, const char *name); - -/** - * Get available profiles. - * @param client the MRCP client to get the profile from - * @param profiles the array of profiles to be filled in - * @param count the max number of profiles on entry; and the number of profiles filled in on exit - * @param tag the tag to be used as a filter (no filter is specified if tag is NULL) - * @return FALSE if the provided max number of profiles is less than the actual number of profiles - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_profiles_get(const mrcp_client_t *client, mrcp_client_profile_t *profiles[], apr_size_t *count, const char *tag); - -/** - * Get directory layout. - * @param client the MRCP client to get from - */ -MRCP_DECLARE(apt_dir_layout_t*) mrcp_client_dir_layout_get(const mrcp_client_t *client); - -APT_END_EXTERN_C - -#endif /* MRCP_CLIENT_H */ diff --git a/libs/unimrcp/libs/mrcp-client/include/mrcp_client_session.h b/libs/unimrcp/libs/mrcp-client/include/mrcp_client_session.h deleted file mode 100644 index f6a3c645ee..0000000000 --- a/libs/unimrcp/libs/mrcp-client/include/mrcp_client_session.h +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_client_session.h 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_CLIENT_SESSION_H -#define MRCP_CLIENT_SESSION_H - -/** - * @file mrcp_client_session.h - * @brief MRCP Client Session - */ - -#include "mrcp_client_types.h" -#include "mrcp_application.h" -#include "mrcp_session.h" -#include "mpf_engine.h" -#include "apt_task_msg.h" -#include "apt_obj_list.h" - -APT_BEGIN_EXTERN_C - -/** RTP termination slot declaration */ -typedef struct rtp_termination_slot_t rtp_termination_slot_t; - -/** MRCP client session declaration */ -typedef struct mrcp_client_session_t mrcp_client_session_t; - -/** Client session states */ -typedef enum { - SESSION_STATE_NONE, - SESSION_STATE_GENERATING_OFFER, - SESSION_STATE_PROCESSING_ANSWER, - SESSION_STATE_TERMINATING, - SESSION_STATE_DISCOVERING -} mrcp_client_session_state_e; - -/** MRCP client session */ -struct mrcp_client_session_t { - /** Session base */ - mrcp_session_t base; - /** Application session belongs to */ - mrcp_application_t *application; - /** External object associated with session */ - void *app_obj; - /** Profile to use */ - mrcp_client_profile_t *profile; - - /** Media context */ - mpf_context_t *context; - /** Codec manager */ - const mpf_codec_manager_t *codec_manager; - - /** RTP termination array (mrcp_termination_slot_t) */ - apr_array_header_t *terminations; - /** MRCP control channel array (mrcp_channel_t*) */ - apr_array_header_t *channels; - - /** Indicates whether session is already added to session table */ - apt_bool_t registered; - - /** In-progress offer */ - mrcp_session_descriptor_t *offer; - /** In-progress answer */ - mrcp_session_descriptor_t *answer; - - /** MRCP application active request */ - const mrcp_app_message_t *active_request; - /** MRCP application request queue */ - apt_obj_list_t *request_queue; - - /** MPF task message, which construction is in progress */ - mpf_task_msg_t *mpf_task_msg; - - /** Session state */ - mrcp_client_session_state_e state; - /** Status code of the app response to be generated */ - mrcp_sig_status_code_e status; - /** Number of in-progress sub requests */ - apr_size_t subrequest_count; - /** True, if server unexpectedly closed session/connection */ - apt_bool_t disconnected; -}; - -/** MRCP channel */ -struct mrcp_channel_t { - /** Memory pool */ - apr_pool_t *pool; - /** External object associated with channel */ - void *obj; - /** MRCP resource */ - mrcp_resource_t *resource; - /** MRCP session entire channel belongs to */ - mrcp_session_t *session; - /** MRCP control channel */ - mrcp_control_channel_t *control_channel; - /** Media termination */ - mpf_termination_t *termination; - /** Associated RTP termination slot */ - rtp_termination_slot_t *rtp_termination_slot; - - /** waiting state of control channel */ - apt_bool_t waiting_for_channel; - /** waiting state of media termination */ - apt_bool_t waiting_for_termination; -}; - -/** RTP termination slot */ -struct rtp_termination_slot_t { - /** waiting state */ - apt_bool_t waiting; - /** RTP termination */ - mpf_termination_t *termination; - /** RTP termination descriptor */ - mpf_rtp_termination_descriptor_t *descriptor; - /** Associated MRCP channel */ - mrcp_channel_t *channel; - /** media descriptor id (index of media in session descriptor) */ - apr_size_t id; -}; - -/** MRCP client profile */ -struct mrcp_client_profile_t { - /** Unique profile name */ - const char *name; - /** Arbitrary tag set/used by user application */ - const char *tag; - /** MRCP version */ - mrcp_version_e mrcp_version; - /** MRCP resource factory */ - mrcp_resource_factory_t *resource_factory; - /** Media engine factory */ - mpf_engine_factory_t *mpf_factory; - /** RTP termination factory */ - mpf_termination_factory_t *rtp_termination_factory; - /** Signaling agent factory */ - mrcp_sa_factory_t *sa_factory; - /** Connection agent factory */ - mrcp_ca_factory_t *ca_factory; - /** Signaling settings */ - mrcp_sig_settings_t *signaling_settings; - /** RTP settings */ - mpf_rtp_settings_t *rtp_settings; -}; - -/** MRCP application */ -struct mrcp_application_t { - /** External object associated with the application */ - void *obj; - /** Application message handler */ - mrcp_app_message_handler_f handler; - /** MRCP client */ - mrcp_client_t *client; - /** Application task message pool */ - apt_task_msg_pool_t *msg_pool; -}; - -/** Create channel */ -mrcp_channel_t* mrcp_client_channel_create( - mrcp_client_session_t *session, - mrcp_resource_t *resource, - mpf_termination_t *termination, - mpf_rtp_termination_descriptor_t *rtp_descriptor, - void *obj); - -/** Create signaling app_message_t request */ -mrcp_app_message_t* mrcp_client_app_signaling_request_create(mrcp_sig_command_e command_id, apr_pool_t *pool); -/** Create signaling app_message_t event */ -mrcp_app_message_t* mrcp_client_app_signaling_event_create(mrcp_sig_event_e event_id, apr_pool_t *pool); -/** Create control app_message_t */ -mrcp_app_message_t* mrcp_client_app_control_message_create(apr_pool_t *pool); - -/** Process application message */ -apt_bool_t mrcp_client_app_message_process(mrcp_app_message_t *app_message); -/** Process MPF message */ -apt_bool_t mrcp_client_mpf_message_process(mpf_message_container_t *mpf_message_container); - -/** Process session answer */ -apt_bool_t mrcp_client_session_answer_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor); -/** Process session termination response */ -apt_bool_t mrcp_client_session_terminate_response_process(mrcp_client_session_t *session); -/** Process session control response */ -apt_bool_t mrcp_client_session_control_response_process(mrcp_client_session_t *session, mrcp_message_t *message); -/** Process resource discovery response */ -apt_bool_t mrcp_client_session_discover_response_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor); -/** Process session termination event */ -apt_bool_t mrcp_client_session_terminate_event_process(mrcp_client_session_t *session); - -/** Process channel add event */ -apt_bool_t mrcp_client_on_channel_add(mrcp_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status); -/** Process channel modify event */ -apt_bool_t mrcp_client_on_channel_modify(mrcp_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status); -/** Process channel remove event */ -apt_bool_t mrcp_client_on_channel_remove(mrcp_channel_t *channel, apt_bool_t status); -/** Process message receive event */ -apt_bool_t mrcp_client_on_message_receive(mrcp_channel_t *channel, mrcp_message_t *message); -/** Process disconnect event */ -apt_bool_t mrcp_client_on_disconnect(mrcp_channel_t *channel); - -APT_END_EXTERN_C - -#endif /* MRCP_CLIENT_SESSION_H */ diff --git a/libs/unimrcp/libs/mrcp-client/include/mrcp_client_types.h b/libs/unimrcp/libs/mrcp-client/include/mrcp_client_types.h deleted file mode 100644 index 61a555bcbe..0000000000 --- a/libs/unimrcp/libs/mrcp-client/include/mrcp_client_types.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_client_types.h 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_CLIENT_TYPES_H -#define MRCP_CLIENT_TYPES_H - -/** - * @file mrcp_client_types.h - * @brief MRCP Client Types - */ - -#include "mrcp_sig_types.h" -#include "mrcp_connection_types.h" -#include "mpf_types.h" - -APT_BEGIN_EXTERN_C - -/** Opaque MRCP client declaration */ -typedef struct mrcp_client_t mrcp_client_t; - -/** Opaque MRCP client profile declaration */ -typedef struct mrcp_client_profile_t mrcp_client_profile_t; -/** Backward compatible declaration of MRCP profile */ -typedef mrcp_client_profile_t mrcp_profile_t; - -/** Opaque MRCP application declaration */ -typedef struct mrcp_application_t mrcp_application_t; - -/** Opaque MRCP channel declaration */ -typedef struct mrcp_channel_t mrcp_channel_t; - - -APT_END_EXTERN_C - -#endif /* MRCP_CLIENT_TYPES_H */ diff --git a/libs/unimrcp/libs/mrcp-client/mrcpclient.2017.vcxproj b/libs/unimrcp/libs/mrcp-client/mrcpclient.2017.vcxproj deleted file mode 100644 index e5cfaa0b33..0000000000 --- a/libs/unimrcp/libs/mrcp-client/mrcpclient.2017.vcxproj +++ /dev/null @@ -1,131 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - mrcpclient - {72782932-37CC-46AE-8C7F-9A7B1A6EE108} - mrcpclient - Win32Proj - - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(SolutionDir)$(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(SolutionDir)$(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - - - - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) - - - - - X64 - - - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) - ProgramDatabase - - - - - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) - - - - - X64 - - - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) - - - - - - - - - - - - - - - - {f6c55d93-b927-4483-bb69-15aef3dd2dff} - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp-client/mrcpclient.vcproj b/libs/unimrcp/libs/mrcp-client/mrcpclient.vcproj deleted file mode 100644 index 046c3e4695..0000000000 --- a/libs/unimrcp/libs/mrcp-client/mrcpclient.vcproj +++ /dev/null @@ -1,280 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/libs/mrcp-client/mrcpclient.vcxproj b/libs/unimrcp/libs/mrcp-client/mrcpclient.vcxproj deleted file mode 100644 index 3447a31724..0000000000 --- a/libs/unimrcp/libs/mrcp-client/mrcpclient.vcxproj +++ /dev/null @@ -1,125 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {72782932-37CC-46AE-8C7F-9A7B1A6EE108} - mrcpclient - Win32Proj - - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - X64 - - - ProgramDatabase - - - - - X64 - - - - - - - - - - - - - - - - {12a49562-bab9-43a3-a21d-15b60bbb4c31} - false - - - {a9edac04-6a5f-4ba7-bc0d-cce7b255b6ea} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp-client/mrcpclient.vcxproj.filters b/libs/unimrcp/libs/mrcp-client/mrcpclient.vcxproj.filters deleted file mode 100644 index 789830de35..0000000000 --- a/libs/unimrcp/libs/mrcp-client/mrcpclient.vcxproj.filters +++ /dev/null @@ -1,38 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {dc4325fe-8e7a-4a40-ab63-4173d85cf131} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - include - - - include - - - include - - - include - - - - - src - - - src - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp-client/src/mrcp_application.c b/libs/unimrcp/libs/mrcp-client/src/mrcp_application.c deleted file mode 100644 index 849847720b..0000000000 --- a/libs/unimrcp/libs/mrcp-client/src/mrcp_application.c +++ /dev/null @@ -1,549 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_application.c 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $ - */ - -#include "mrcp_application.h" -#include "mrcp_client.h" -#include "mrcp_client_session.h" -#include "mrcp_session_descriptor.h" -#include "mrcp_message.h" -#include "mrcp_sig_agent.h" -#include "mrcp_resource_factory.h" -#include "mpf_termination_factory.h" -#include "apt_dir_layout.h" -#include "apt_log.h" - -mrcp_client_session_t* mrcp_client_session_create(mrcp_client_t *client); - -apt_bool_t mrcp_app_signaling_task_msg_signal(mrcp_sig_command_e command_id, mrcp_session_t *session, mrcp_channel_t *channel); -apt_bool_t mrcp_app_control_task_msg_signal(mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message); - - -/** Create application instance */ -MRCP_DECLARE(mrcp_application_t*) mrcp_application_create(const mrcp_app_message_handler_f handler, void *obj, apr_pool_t *pool) -{ - mrcp_application_t *application; - if(!handler) { - return FALSE; - } - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create Application"); - application = apr_palloc(pool,sizeof(mrcp_application_t)); - application->obj = obj; - application->handler = handler; - application->client = NULL; - return application; -} - -/** Destroy application instance */ -MRCP_DECLARE(apt_bool_t) mrcp_application_destroy(mrcp_application_t *application) -{ - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy Application"); - return TRUE; -} - -/** Get external object associated with the application */ -MRCP_DECLARE(void*) mrcp_application_object_get(const mrcp_application_t *application) -{ - return application->obj; -} - -/** Get dir layout structure */ -MRCP_DECLARE(const apt_dir_layout_t*) mrcp_application_dir_layout_get(const mrcp_application_t *application) -{ - return mrcp_client_dir_layout_get(application->client); -} - - - -/** Create client session */ -MRCP_DECLARE(mrcp_session_t*) mrcp_application_session_create(mrcp_application_t *application, const char *profile_name, void *obj) -{ - mrcp_client_profile_t *profile; - mrcp_client_session_t *session; - if(!application || !application->client || !profile_name) { - return NULL; - } - - profile = mrcp_client_profile_get(application->client,profile_name); - if(!profile) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Such Profile [%s]",profile_name); - return NULL; - } - - session = mrcp_client_session_create(application->client); - if(!session) { - return NULL; - } - session->application = application; - session->app_obj = obj; - session->base.log_obj = obj; - session->profile = profile; - - apt_obj_log(APT_LOG_MARK,APT_PRIO_NOTICE,session->base.log_obj,"Create MRCP Handle "APT_PTR_FMT" [%s]", - MRCP_SESSION_PTR(session), - profile_name); - return &session->base; -} - -/** Get memory pool the session object is created out of */ -MRCP_DECLARE(apr_pool_t*) mrcp_application_session_pool_get(const mrcp_session_t *session) -{ - if(!session) { - return NULL; - } - return session->pool; -} - -/** Get session identifier */ -MRCP_DECLARE(const apt_str_t*) mrcp_application_session_id_get(const mrcp_session_t *session) -{ - if(!session) { - return NULL; - } - return &session->id; -} - -/** Get SIP or RTSP response code */ -MRCP_DECLARE(int) mrcp_application_session_response_code_get(const mrcp_session_t *session) -{ - mrcp_client_session_t *client_session = (mrcp_client_session_t*)session; - if(!client_session || !client_session->answer) { - return 0; - } - return client_session->answer->response_code; -} - -/** Get external object associated with the session */ -MRCP_DECLARE(void*) mrcp_application_session_object_get(const mrcp_session_t *session) -{ - mrcp_client_session_t *client_session = (mrcp_client_session_t*)session; - if(!client_session) { - return NULL; - } - return client_session->app_obj; -} - -/** Set (associate) external object to the session */ -MRCP_DECLARE(void) mrcp_application_session_object_set(mrcp_session_t *session, void *obj) -{ - mrcp_client_session_t *client_session = (mrcp_client_session_t*)session; - if(client_session) { - client_session->app_obj = obj; - } -} - -/** Set name of the session (informative only used for debugging) */ -MRCP_DECLARE(void) mrcp_application_session_name_set(mrcp_session_t *session, const char *name) -{ - if(session && name) { - session->name = apr_pstrdup(session->pool,name); - } -} - - -/** Send session update request */ -MRCP_DECLARE(apt_bool_t) mrcp_application_session_update(mrcp_session_t *session) -{ - if(!session) { - return FALSE; - } - return mrcp_app_signaling_task_msg_signal(MRCP_SIG_COMMAND_SESSION_UPDATE,session,NULL); -} - -/** Send session termination request */ -MRCP_DECLARE(apt_bool_t) mrcp_application_session_terminate(mrcp_session_t *session) -{ - if(!session) { - return FALSE; - } - return mrcp_app_signaling_task_msg_signal(MRCP_SIG_COMMAND_SESSION_TERMINATE,session,NULL); -} - -/** Destroy client session (session must be terminated prior to destroy) */ -MRCP_DECLARE(apt_bool_t) mrcp_application_session_destroy(mrcp_session_t *session) -{ - if(!session) { - return FALSE; - } - apt_obj_log(APT_LOG_MARK,APT_PRIO_NOTICE,session->log_obj,"Destroy MRCP Handle %s",session->name); - mrcp_session_destroy(session); - return TRUE; -} - - -/** Create control channel */ -MRCP_DECLARE(mrcp_channel_t*) mrcp_application_channel_create( - mrcp_session_t *session, - mrcp_resource_id resource_id, - mpf_termination_t *termination, - mpf_rtp_termination_descriptor_t *rtp_descriptor, - void *obj) -{ - mrcp_resource_t *resource; - mrcp_client_profile_t *profile; - mrcp_client_session_t *client_session = (mrcp_client_session_t*)session; - if(!client_session || !client_session->profile) { - /* Invalid params */ - return FALSE; - } - profile = client_session->profile; - - if(!profile->resource_factory) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Channel: invalid profile"); - return FALSE; - } - resource = mrcp_resource_get(profile->resource_factory,resource_id); - if(!resource) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Channel: no such resource"); - return FALSE; - } - - if(termination) { - /* Media engine and RTP factory must be specified in this case */ - if(!profile->mpf_factory || !profile->rtp_termination_factory) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Channel: invalid profile"); - return FALSE; - } - } - else { - /* Either termination or rtp_descriptor must be specified */ - if(!rtp_descriptor) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Channel: missing both termination and RTP descriptor"); - return FALSE; - } - } - - return mrcp_client_channel_create(client_session,resource,termination,rtp_descriptor,obj); -} - -/** Get external object associated with the channel */ -MRCP_DECLARE(void*) mrcp_application_channel_object_get(const mrcp_channel_t *channel) -{ - if(!channel) { - return FALSE; - } - return channel->obj; -} - -/** Get RTP termination descriptor */ -MRCP_DECLARE(mpf_rtp_termination_descriptor_t*) mrcp_application_rtp_descriptor_get(const mrcp_channel_t *channel) -{ - if(!channel || !channel->rtp_termination_slot) { - return NULL; - } - return channel->rtp_termination_slot->descriptor; -} - -/** Get codec descriptor of source stream */ -MRCP_DECLARE(const mpf_codec_descriptor_t*) mrcp_application_source_descriptor_get(const mrcp_channel_t *channel) -{ - mpf_audio_stream_t *audio_stream; - if(!channel || !channel->termination) { - return NULL; - } - audio_stream = mpf_termination_audio_stream_get(channel->termination); - if(!audio_stream) { - return NULL; - } - return audio_stream->rx_descriptor; -} - -/** Get codec descriptor of sink stream */ -MRCP_DECLARE(const mpf_codec_descriptor_t*) mrcp_application_sink_descriptor_get(const mrcp_channel_t *channel) -{ - mpf_audio_stream_t *audio_stream; - if(!channel || !channel->termination) { - return NULL; - } - audio_stream = mpf_termination_audio_stream_get(channel->termination); - if(!audio_stream) { - return NULL; - } - return audio_stream->tx_descriptor; -} - -/** Get associated audio stream */ -MRCP_DECLARE(const mpf_audio_stream_t*) mrcp_application_audio_stream_get(const mrcp_channel_t *channel) -{ - if(!channel || !channel->termination) { - return NULL; - } - - return mpf_termination_audio_stream_get(channel->termination); -} - -/** Send channel add request */ -MRCP_DECLARE(apt_bool_t) mrcp_application_channel_add(mrcp_session_t *session, mrcp_channel_t *channel) -{ - if(!session || !channel) { - return FALSE; - } - return mrcp_app_signaling_task_msg_signal(MRCP_SIG_COMMAND_CHANNEL_ADD,session,channel); -} - -/** Send channel removal request */ -MRCP_DECLARE(apt_bool_t) mrcp_application_channel_remove(mrcp_session_t *session, mrcp_channel_t *channel) -{ - if(!session || !channel) { - return FALSE; - } - return mrcp_app_signaling_task_msg_signal(MRCP_SIG_COMMAND_CHANNEL_REMOVE,session,channel); -} - -/** Send resource discovery request */ -MRCP_DECLARE(apt_bool_t) mrcp_application_resource_discover(mrcp_session_t *session) -{ - if(!session) { - return FALSE; - } - return mrcp_app_signaling_task_msg_signal(MRCP_SIG_COMMAND_RESOURCE_DISCOVER,session,NULL); -} - -/** Create MRCP message */ -MRCP_DECLARE(mrcp_message_t*) mrcp_application_message_create(mrcp_session_t *session, mrcp_channel_t *channel, mrcp_method_id method_id) -{ - mrcp_message_t *mrcp_message; - mrcp_client_profile_t *profile; - mrcp_client_session_t *client_session = (mrcp_client_session_t*)session; - if(!client_session || !channel || !channel->resource) { - return NULL; - } - profile = client_session->profile; - if(!profile || !profile->resource_factory) { - return NULL; - } - mrcp_message = mrcp_request_create( - channel->resource, - profile->mrcp_version, - method_id, - session->pool); - return mrcp_message; -} - -/** Send MRCP message */ -MRCP_DECLARE(apt_bool_t) mrcp_application_message_send(mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message) -{ - if(!session || !channel || !message) { - return FALSE; - } - return mrcp_app_control_task_msg_signal(session,channel,message); -} - -/** Create audio termination */ -MRCP_DECLARE(mpf_termination_t*) mrcp_application_audio_termination_create( - mrcp_session_t *session, - const mpf_audio_stream_vtable_t *stream_vtable, - mpf_stream_capabilities_t *capabilities, - void *obj) -{ - mpf_audio_stream_t *audio_stream; - - if(!capabilities) { - return NULL; - } - - if(mpf_codec_capabilities_validate(&capabilities->codecs) == FALSE) { - return NULL; - } - - /* create audio stream */ - audio_stream = mpf_audio_stream_create( - obj, /* object to associate */ - stream_vtable, /* virtual methods table of audio stream */ - capabilities, /* stream capabilities */ - session->pool); /* memory pool to allocate memory from */ - if(!audio_stream) { - return NULL; - } - - /* create raw termination */ - return mpf_raw_termination_create( - NULL, /* no object to associate */ - audio_stream, /* audio stream */ - NULL, /* no video stream */ - session->pool); /* memory pool to allocate memory from */ -} - -/** Create source media termination */ -MRCP_DECLARE(mpf_termination_t*) mrcp_application_source_termination_create( - mrcp_session_t *session, - const mpf_audio_stream_vtable_t *stream_vtable, - mpf_codec_descriptor_t *codec_descriptor, - void *obj) -{ - mpf_stream_capabilities_t *capabilities; - mpf_audio_stream_t *audio_stream; - - capabilities = mpf_source_stream_capabilities_create(session->pool); - if(codec_descriptor) { - mpf_codec_capabilities_add( - &capabilities->codecs, - mpf_sample_rate_mask_get(codec_descriptor->sampling_rate), - codec_descriptor->name.buf); - } - else { - mpf_codec_default_capabilities_add(&capabilities->codecs); - } - - /* create audio stream */ - audio_stream = mpf_audio_stream_create( - obj, /* object to associate */ - stream_vtable, /* virtual methods table of audio stream */ - capabilities, /* stream capabilities */ - session->pool); /* memory pool to allocate memory from */ - - if(!audio_stream) { - return NULL; - } - - audio_stream->rx_descriptor = codec_descriptor; - - /* create raw termination */ - return mpf_raw_termination_create( - NULL, /* no object to associate */ - audio_stream, /* audio stream */ - NULL, /* no video stream */ - session->pool); /* memory pool to allocate memory from */ -} - -/** Create sink media termination */ -MRCP_DECLARE(mpf_termination_t*) mrcp_application_sink_termination_create( - mrcp_session_t *session, - const mpf_audio_stream_vtable_t *stream_vtable, - mpf_codec_descriptor_t *codec_descriptor, - void *obj) -{ - mpf_stream_capabilities_t *capabilities; - mpf_audio_stream_t *audio_stream; - - capabilities = mpf_sink_stream_capabilities_create(session->pool); - if(codec_descriptor) { - mpf_codec_capabilities_add( - &capabilities->codecs, - mpf_sample_rate_mask_get(codec_descriptor->sampling_rate), - codec_descriptor->name.buf); - } - else { - mpf_codec_default_capabilities_add(&capabilities->codecs); - } - - /* create audio stream */ - audio_stream = mpf_audio_stream_create( - obj, /* object to associate */ - stream_vtable, /* virtual methods table of audio stream */ - capabilities, /* stream capabilities */ - session->pool); /* memory pool to allocate memory from */ - if(!audio_stream) { - return NULL; - } - - audio_stream->tx_descriptor = codec_descriptor; - - /* create raw termination */ - return mpf_raw_termination_create( - NULL, /* no object to associate */ - audio_stream, /* audio stream */ - NULL, /* no video stream */ - session->pool); /* memory pool to allocate memory from */ -} - -/** Dispatch application message */ -MRCP_DECLARE(apt_bool_t) mrcp_application_message_dispatch(const mrcp_app_message_dispatcher_t *dispatcher, const mrcp_app_message_t *app_message) -{ - apt_bool_t status = FALSE; - switch(app_message->message_type) { - case MRCP_APP_MESSAGE_TYPE_SIGNALING: - { - if(app_message->sig_message.message_type == MRCP_SIG_MESSAGE_TYPE_RESPONSE) { - switch(app_message->sig_message.command_id) { - case MRCP_SIG_COMMAND_SESSION_UPDATE: - if(dispatcher->on_session_update) { - status = dispatcher->on_session_update( - app_message->application, - app_message->session, - app_message->sig_message.status); - } - break; - case MRCP_SIG_COMMAND_SESSION_TERMINATE: - if(dispatcher->on_session_terminate) { - status = dispatcher->on_session_terminate( - app_message->application, - app_message->session, - app_message->sig_message.status); - } - break; - case MRCP_SIG_COMMAND_CHANNEL_ADD: - if(dispatcher->on_channel_add) { - status = dispatcher->on_channel_add( - app_message->application, - app_message->session, - app_message->channel, - app_message->sig_message.status); - } - break; - case MRCP_SIG_COMMAND_CHANNEL_REMOVE: - if(dispatcher->on_channel_remove) { - status = dispatcher->on_channel_remove( - app_message->application, - app_message->session, - app_message->channel, - app_message->sig_message.status); - } - break; - case MRCP_SIG_COMMAND_RESOURCE_DISCOVER: - if(dispatcher->on_resource_discover) { - status = dispatcher->on_resource_discover( - app_message->application, - app_message->session, - app_message->descriptor, - app_message->sig_message.status); - } - break; - default: - break; - } - } - else if(app_message->sig_message.message_type == MRCP_SIG_MESSAGE_TYPE_EVENT) { - switch(app_message->sig_message.event_id) { - case MRCP_SIG_EVENT_TERMINATE: - if(dispatcher->on_terminate_event) { - status = dispatcher->on_terminate_event( - app_message->application, - app_message->session, - app_message->channel); - } - break; - default: - break; - } - } - break; - } - case MRCP_APP_MESSAGE_TYPE_CONTROL: - { - if(dispatcher->on_message_receive) { - status = dispatcher->on_message_receive( - app_message->application, - app_message->session, - app_message->channel, - app_message->control_message); - } - break; - } - } - return status; -} diff --git a/libs/unimrcp/libs/mrcp-client/src/mrcp_client.c b/libs/unimrcp/libs/mrcp-client/src/mrcp_client.c deleted file mode 100644 index 0212ff8a86..0000000000 --- a/libs/unimrcp/libs/mrcp-client/src/mrcp_client.c +++ /dev/null @@ -1,989 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_client.c 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $ - */ - -#include -#include -#include "mrcp_client.h" -#include "mrcp_sig_agent.h" -#include "mrcp_client_session.h" -#include "mrcp_client_connection.h" -#include "mrcp_ca_factory.h" -#include "mpf_engine_factory.h" -#include "apt_consumer_task.h" -#include "apt_pool.h" -#include "apt_log.h" - -#define CLIENT_TASK_NAME "MRCP Client" - -/** MRCP client */ -struct mrcp_client_t { - /** Main message processing task */ - apt_consumer_task_t *task; - - /** MRCP resource factory */ - mrcp_resource_factory_t *resource_factory; - /** Codec manager */ - mpf_codec_manager_t *codec_manager; - /** Table of media processing engines (mpf_engine_t*) */ - apr_hash_t *media_engine_table; - /** Table of RTP termination factories (mpf_termination_factory_t*) */ - apr_hash_t *rtp_factory_table; - /** Table of signaling agents (mrcp_sig_agent_t*) */ - apr_hash_t *sig_agent_table; - /** Table of signaling settings (mrcp_sig_settings_t*) */ - apr_hash_t *sig_settings_table; - /** Table of connection agents (mrcp_connection_agent_t*) */ - apr_hash_t *cnt_agent_table; - /** Table of RTP settings (mpf_rtp_settings_t*) */ - apr_hash_t *rtp_settings_table; - /** Table of profiles (mrcp_client_profile_t*) */ - apr_hash_t *profile_table; - - /** Table of applications (mrcp_application_t*) */ - apr_hash_t *app_table; - - /** Table of sessions/handles */ - apr_hash_t *session_table; - - /** Connection task message pool */ - apt_task_msg_pool_t *cnt_msg_pool; - - /** Event handler used in case of async start */ - mrcp_client_handler_f on_start_complete; - /** Wait object used in case of synch start */ - apr_thread_cond_t *sync_start_object; - /** Mutex to protect sync start routine */ - apr_thread_mutex_t *sync_start_mutex; - - /** Dir layout structure */ - apt_dir_layout_t *dir_layout; - /** Memory pool */ - apr_pool_t *pool; -}; - - -typedef enum { - MRCP_CLIENT_SIGNALING_TASK_MSG = TASK_MSG_USER, - MRCP_CLIENT_CONNECTION_TASK_MSG, - MRCP_CLIENT_MEDIA_TASK_MSG, - MRCP_CLIENT_APPLICATION_TASK_MSG -} mrcp_client_task_msg_type_e; - -/* Signaling agent interface */ -typedef enum { - SIG_AGENT_TASK_MSG_ANSWER, - SIG_AGENT_TASK_MSG_TERMINATE_RESPONSE, - SIG_AGENT_TASK_MSG_CONTROL_RESPONSE, - SIG_AGENT_TASK_MSG_DISCOVER_RESPONSE, - SIG_AGENT_TASK_MSG_TERMINATE_EVENT -} sig_agent_task_msg_type_e; - -typedef struct sig_agent_task_msg_data_t sig_agent_task_msg_data_t; -struct sig_agent_task_msg_data_t { - mrcp_client_session_t *session; - mrcp_session_descriptor_t *descriptor; - mrcp_message_t *message; -}; - -static apt_bool_t mrcp_client_answer_signal(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor); -static apt_bool_t mrcp_client_terminate_response_signal(mrcp_session_t *session); -static apt_bool_t mrcp_client_control_response_signal(mrcp_session_t *session, mrcp_message_t *message); -static apt_bool_t mrcp_client_discover_response_signal(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor); - -static apt_bool_t mrcp_client_terminate_event_signal(mrcp_session_t *session); - -static const mrcp_session_response_vtable_t session_response_vtable = { - mrcp_client_answer_signal, - mrcp_client_terminate_response_signal, - mrcp_client_control_response_signal, - mrcp_client_discover_response_signal -}; - -static const mrcp_session_event_vtable_t session_event_vtable = { - mrcp_client_terminate_event_signal -}; - -/* Connection agent interface */ -typedef enum { - CONNECTION_AGENT_TASK_MSG_ADD_CHANNEL, - CONNECTION_AGENT_TASK_MSG_MODIFY_CHANNEL, - CONNECTION_AGENT_TASK_MSG_REMOVE_CHANNEL, - CONNECTION_AGENT_TASK_MSG_RECEIVE_MESSAGE, - CONNECTION_AGENT_TASK_MSG_DISCONNECT -} connection_agent_task_msg_type_e ; - -typedef struct connection_agent_task_msg_data_t connection_agent_task_msg_data_t; -struct connection_agent_task_msg_data_t { - mrcp_channel_t *channel; - mrcp_control_descriptor_t *descriptor; - mrcp_message_t *message; - apt_bool_t status; -}; - -static apt_bool_t mrcp_client_channel_add_signal(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status); -static apt_bool_t mrcp_client_channel_modify_signal(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status); -static apt_bool_t mrcp_client_channel_remove_signal(mrcp_control_channel_t *channel, apt_bool_t status); -static apt_bool_t mrcp_client_message_signal(mrcp_control_channel_t *channel, mrcp_message_t *message); -static apt_bool_t mrcp_client_disconnect_signal(mrcp_control_channel_t *channel); - -static const mrcp_connection_event_vtable_t connection_method_vtable = { - mrcp_client_channel_add_signal, - mrcp_client_channel_modify_signal, - mrcp_client_channel_remove_signal, - mrcp_client_message_signal, - mrcp_client_disconnect_signal -}; - -/* Task interface */ -static void mrcp_client_on_start_complete(apt_task_t *task); -static void mrcp_client_on_terminate_complete(apt_task_t *task); -static apt_bool_t mrcp_client_msg_process(apt_task_t *task, apt_task_msg_t *msg); - - -/** Create MRCP client instance */ -MRCP_DECLARE(mrcp_client_t*) mrcp_client_create(apt_dir_layout_t *dir_layout) -{ - mrcp_client_t *client; - apr_pool_t *pool; - apt_task_t *task; - apt_task_vtable_t *vtable; - apt_task_msg_pool_t *msg_pool; - - pool = apt_pool_create(); - if(!pool) { - return NULL; - } - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create "CLIENT_TASK_NAME); - client = apr_palloc(pool,sizeof(mrcp_client_t)); - client->pool = pool; - client->dir_layout = dir_layout; - client->resource_factory = NULL; - client->media_engine_table = NULL; - client->rtp_factory_table = NULL; - client->sig_agent_table = NULL; - client->sig_settings_table = NULL; - client->cnt_agent_table = NULL; - client->rtp_settings_table = NULL; - client->profile_table = NULL; - client->app_table = NULL; - client->session_table = NULL; - client->cnt_msg_pool = NULL; - - msg_pool = apt_task_msg_pool_create_dynamic(0,pool); - client->task = apt_consumer_task_create(client,msg_pool,pool); - if(!client->task) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Client Task"); - return NULL; - } - task = apt_consumer_task_base_get(client->task); - apt_task_name_set(task,CLIENT_TASK_NAME); - vtable = apt_task_vtable_get(task); - if(vtable) { - vtable->process_msg = mrcp_client_msg_process; - vtable->on_start_complete = mrcp_client_on_start_complete; - vtable->on_terminate_complete = mrcp_client_on_terminate_complete; - } - - client->media_engine_table = apr_hash_make(client->pool); - client->rtp_factory_table = apr_hash_make(client->pool); - client->sig_agent_table = apr_hash_make(client->pool); - client->sig_settings_table = apr_hash_make(client->pool); - client->cnt_agent_table = apr_hash_make(client->pool); - client->rtp_settings_table = apr_hash_make(client->pool); - client->profile_table = apr_hash_make(client->pool); - client->app_table = apr_hash_make(client->pool); - - client->session_table = apr_hash_make(client->pool); - - client->on_start_complete = NULL; - client->sync_start_object = NULL; - client->sync_start_mutex = NULL; - return client; -} - -/** Set asynchronous start mode */ -MRCP_DECLARE(void) mrcp_client_async_start_set(mrcp_client_t *client, mrcp_client_handler_f handler) -{ - if(client) { - client->on_start_complete = handler; - } -} - -/** Start message processing loop */ -MRCP_DECLARE(apt_bool_t) mrcp_client_start(mrcp_client_t *client) -{ - apt_bool_t sync_start = TRUE; - apt_task_t *task; - if(!client || !client->task) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid Client"); - return FALSE; - } - task = apt_consumer_task_base_get(client->task); - - if(client->on_start_complete) { - sync_start = FALSE; - } - - if(sync_start == TRUE) { - /* get prepared to start stack synchronously */ - apr_thread_mutex_create(&client->sync_start_mutex,APR_THREAD_MUTEX_DEFAULT,client->pool); - apr_thread_cond_create(&client->sync_start_object,client->pool); - - apr_thread_mutex_lock(client->sync_start_mutex); - } - - if(apt_task_start(task) == FALSE) { - if(sync_start == TRUE) { - apr_thread_mutex_unlock(client->sync_start_mutex); - } - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Start Client Task"); - return FALSE; - } - - if(sync_start == TRUE) { - /* wait for start complete */ - apr_thread_cond_wait(client->sync_start_object,client->sync_start_mutex); - apr_thread_mutex_unlock(client->sync_start_mutex); - } - - return TRUE; -} - -/** Shutdown message processing loop */ -MRCP_DECLARE(apt_bool_t) mrcp_client_shutdown(mrcp_client_t *client) -{ - apt_task_t *task; - if(!client || !client->task) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid Client"); - return FALSE; - } - task = apt_consumer_task_base_get(client->task); - if(apt_task_terminate(task,TRUE) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Shutdown Client Task"); - return FALSE; - } - client->session_table = NULL; - - if(client->sync_start_object) { - apr_thread_cond_destroy(client->sync_start_object); - client->sync_start_object = NULL; - } - if(client->sync_start_mutex) { - apr_thread_mutex_destroy(client->sync_start_mutex); - client->sync_start_mutex = NULL; - } - - return TRUE; -} - -/** Destroy MRCP client */ -MRCP_DECLARE(apt_bool_t) mrcp_client_destroy(mrcp_client_t *client) -{ - apt_task_t *task; - if(!client || !client->task) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid Client"); - return FALSE; - } - task = apt_consumer_task_base_get(client->task); - apt_task_destroy(task); - - apr_pool_destroy(client->pool); - return TRUE; -} - - -/** Register MRCP resource factory */ -MRCP_DECLARE(apt_bool_t) mrcp_client_resource_factory_register(mrcp_client_t *client, mrcp_resource_factory_t *resource_factory) -{ - if(!resource_factory) { - return FALSE; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Resource Factory"); - client->resource_factory = resource_factory; - return TRUE; -} - -/** Register codec manager */ -MRCP_DECLARE(apt_bool_t) mrcp_client_codec_manager_register(mrcp_client_t *client, mpf_codec_manager_t *codec_manager) -{ - if(!codec_manager) { - return FALSE; - } - client->codec_manager = codec_manager; - return TRUE; -} - -/** Get registered codec manager */ -MRCP_DECLARE(const mpf_codec_manager_t*) mrcp_client_codec_manager_get(const mrcp_client_t *client) -{ - return client->codec_manager; -} - -/** Register media engine */ -MRCP_DECLARE(apt_bool_t) mrcp_client_media_engine_register(mrcp_client_t *client, mpf_engine_t *media_engine) -{ - const char *id; - if(!media_engine) { - return FALSE; - } - id = mpf_engine_id_get(media_engine); - if(!id) { - return FALSE; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Media Engine [%s]",id); - mpf_engine_codec_manager_register(media_engine,client->codec_manager); - apr_hash_set(client->media_engine_table,id,APR_HASH_KEY_STRING,media_engine); - mpf_engine_task_msg_type_set(media_engine,MRCP_CLIENT_MEDIA_TASK_MSG); - if(client->task) { - apt_task_t *media_task = mpf_task_get(media_engine); - apt_task_t *task = apt_consumer_task_base_get(client->task); - apt_task_add(task,media_task); - } - return TRUE; -} - -/** Get media engine by name */ -MRCP_DECLARE(mpf_engine_t*) mrcp_client_media_engine_get(const mrcp_client_t *client, const char *name) -{ - return apr_hash_get(client->media_engine_table,name,APR_HASH_KEY_STRING); -} - -/** Register RTP termination factory */ -MRCP_DECLARE(apt_bool_t) mrcp_client_rtp_factory_register(mrcp_client_t *client, mpf_termination_factory_t *rtp_termination_factory, const char *name) -{ - if(!rtp_termination_factory || !name) { - return FALSE; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register RTP Termination Factory [%s]",name); - apr_hash_set(client->rtp_factory_table,name,APR_HASH_KEY_STRING,rtp_termination_factory); - return TRUE; -} - -/** Get RTP termination factory by name */ -MRCP_DECLARE(mpf_termination_factory_t*) mrcp_client_rtp_factory_get(const mrcp_client_t *client, const char *name) -{ - return apr_hash_get(client->rtp_factory_table,name,APR_HASH_KEY_STRING); -} - -/** Register RTP settings */ -MRCP_DECLARE(apt_bool_t) mrcp_client_rtp_settings_register(mrcp_client_t *client, mpf_rtp_settings_t *rtp_settings, const char *name) -{ - if(!rtp_settings || !name) { - return FALSE; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register RTP Settings [%s]",name); - apr_hash_set(client->rtp_settings_table,name,APR_HASH_KEY_STRING,rtp_settings); - return TRUE; -} - -/** Get RTP settings by name */ -MRCP_DECLARE(mpf_rtp_settings_t*) mrcp_client_rtp_settings_get(const mrcp_client_t *client, const char *name) -{ - return apr_hash_get(client->rtp_settings_table,name,APR_HASH_KEY_STRING); -} - -/** Register MRCP signaling agent */ -MRCP_DECLARE(apt_bool_t) mrcp_client_signaling_agent_register(mrcp_client_t *client, mrcp_sig_agent_t *signaling_agent) -{ - if(!signaling_agent || !signaling_agent->id) { - return FALSE; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Signaling Agent [%s]",signaling_agent->id); - signaling_agent->msg_pool = apt_task_msg_pool_create_dynamic(sizeof(sig_agent_task_msg_data_t),client->pool); - signaling_agent->parent = client; - signaling_agent->resource_factory = client->resource_factory; - apr_hash_set(client->sig_agent_table,signaling_agent->id,APR_HASH_KEY_STRING,signaling_agent); - if(client->task) { - apt_task_t *task = apt_consumer_task_base_get(client->task); - apt_task_add(task,signaling_agent->task); - } - return TRUE; -} - -/** Get signaling agent by name */ -MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_client_signaling_agent_get(const mrcp_client_t *client, const char *name) -{ - return apr_hash_get(client->sig_agent_table,name,APR_HASH_KEY_STRING); -} - -/** Register MRCP signaling settings */ -MRCP_DECLARE(apt_bool_t) mrcp_client_signaling_settings_register(mrcp_client_t *client, mrcp_sig_settings_t *signaling_settings, const char *name) -{ - if(!signaling_settings || !name) { - return FALSE; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Signaling Settings [%s]",name); - apr_hash_set(client->sig_settings_table,name,APR_HASH_KEY_STRING,signaling_settings); - return TRUE; -} - -/** Get signaling settings by name */ -MRCP_DECLARE(mrcp_sig_settings_t*) mrcp_client_signaling_settings_get(const mrcp_client_t *client, const char *name) -{ - return apr_hash_get(client->sig_settings_table,name,APR_HASH_KEY_STRING); -} - - -/** Register MRCP connection agent (MRCPv2 only) */ -MRCP_DECLARE(apt_bool_t) mrcp_client_connection_agent_register(mrcp_client_t *client, mrcp_connection_agent_t *connection_agent) -{ - const char *id; - if(!connection_agent) { - return FALSE; - } - id = mrcp_client_connection_agent_id_get(connection_agent); - if(!id) { - return FALSE; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Connection Agent [%s]",id); - mrcp_client_connection_resource_factory_set(connection_agent,client->resource_factory); - mrcp_client_connection_agent_handler_set(connection_agent,client,&connection_method_vtable); - client->cnt_msg_pool = apt_task_msg_pool_create_dynamic(sizeof(connection_agent_task_msg_data_t),client->pool); - apr_hash_set(client->cnt_agent_table,id,APR_HASH_KEY_STRING,connection_agent); - if(client->task) { - apt_task_t *task = apt_consumer_task_base_get(client->task); - apt_task_t *connection_task = mrcp_client_connection_agent_task_get(connection_agent); - apt_task_add(task,connection_task); - } - return TRUE; -} - -/** Get connection agent by name */ -MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_client_connection_agent_get(const mrcp_client_t *client, const char *name) -{ - return apr_hash_get(client->cnt_agent_table,name,APR_HASH_KEY_STRING); -} - -/** Create MRCP profile */ -MRCP_DECLARE(mrcp_client_profile_t*) mrcp_client_profile_create( - mrcp_resource_factory_t *resource_factory, - mrcp_sig_agent_t *signaling_agent, - mrcp_connection_agent_t *connection_agent, - mpf_engine_t *media_engine, - mpf_termination_factory_t *rtp_factory, - mpf_rtp_settings_t *rtp_settings, - mrcp_sig_settings_t *signaling_settings, - apr_pool_t *pool) -{ - mrcp_sa_factory_t *sa_factory = NULL; - mrcp_ca_factory_t *ca_factory = NULL; - mpf_engine_factory_t *mpf_factory = NULL; - mrcp_version_e mrcp_version = MRCP_VERSION_2; - if(!connection_agent) - mrcp_version = MRCP_VERSION_1; - - if(signaling_agent) { - sa_factory = mrcp_sa_factory_create(pool); - mrcp_sa_factory_agent_add(sa_factory,signaling_agent); - } - - if(connection_agent) { - ca_factory = mrcp_ca_factory_create(pool); - mrcp_ca_factory_agent_add(ca_factory,connection_agent); - } - - if(media_engine) { - mpf_factory = mpf_engine_factory_create(pool); - mpf_engine_factory_engine_add(mpf_factory,media_engine); - } - - return mrcp_client_profile_create_ex( - mrcp_version, - resource_factory, - sa_factory, - ca_factory, - mpf_factory, - rtp_factory, - rtp_settings, - signaling_settings, - pool); -} - -/** Create MRCP profile (extended version) */ -MRCP_DECLARE(mrcp_client_profile_t*) mrcp_client_profile_create_ex( - mrcp_version_e mrcp_version, - mrcp_resource_factory_t *resource_factory, - mrcp_sa_factory_t *sa_factory, - mrcp_ca_factory_t *ca_factory, - mpf_engine_factory_t *mpf_factory, - mpf_termination_factory_t *rtp_factory, - mpf_rtp_settings_t *rtp_settings, - mrcp_sig_settings_t *signaling_settings, - apr_pool_t *pool) -{ - mrcp_client_profile_t *profile = apr_palloc(pool,sizeof(mrcp_client_profile_t)); - profile->name = NULL; - profile->tag = NULL; - profile->mrcp_version = mrcp_version; - profile->resource_factory = resource_factory; - profile->mpf_factory = mpf_factory; - profile->rtp_termination_factory = rtp_factory; - profile->rtp_settings = rtp_settings; - profile->sa_factory = sa_factory; - profile->ca_factory = ca_factory; - profile->signaling_settings = signaling_settings; - - if(mpf_factory && rtp_factory) - mpf_engine_factory_rtp_factory_assign(mpf_factory,rtp_factory); - return profile; -} - -/** Set a tag to the profile */ -MRCP_DECLARE(void) mrcp_client_profile_tag_set(mrcp_client_profile_t *profile, const char *tag) -{ - if(profile) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Profile Tag [%s]",tag); - profile->tag = tag; - } -} - -/** Register MRCP profile */ -MRCP_DECLARE(apt_bool_t) mrcp_client_profile_register(mrcp_client_t *client, mrcp_client_profile_t *profile, const char *name) -{ - if(!profile || !name) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile: no name"); - return FALSE; - } - if(!profile->resource_factory) { - profile->resource_factory = client->resource_factory; - } - if(!profile->sa_factory) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile [%s]: missing signaling agent factory",name); - return FALSE; - } - if(mrcp_sa_factory_is_empty(profile->sa_factory) == TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile [%s]: empty signaling agent factory",name); - return FALSE; - } - if(profile->mrcp_version == MRCP_VERSION_2) { - if(!profile->ca_factory) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile [%s]: missing connection agent factory",name); - return FALSE; - } - if(mrcp_ca_factory_is_empty(profile->ca_factory) == TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile [%s]: empty connection agent factory",name); - return FALSE; - } - } - - /* mpf_factory may not be specified; but if it is specified, it must not be empty */ - if(profile->mpf_factory) { - if(mpf_engine_factory_is_empty(profile->mpf_factory) == TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile [%s]: empty media engine factory",name); - return FALSE; - } - } - - if(!profile->signaling_settings) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile [%s]: missing signaling settings",name); - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Profile [%s]",name); - apr_hash_set(client->profile_table,name,APR_HASH_KEY_STRING,profile); - profile->name = name; - return TRUE; -} - -/** Get profile by name */ -MRCP_DECLARE(mrcp_client_profile_t*) mrcp_client_profile_get(const mrcp_client_t *client, const char *name) -{ - return apr_hash_get(client->profile_table,name,APR_HASH_KEY_STRING); -} - -/** Get available profiles */ -MRCP_DECLARE(apt_bool_t) mrcp_client_profiles_get(const mrcp_client_t *client, mrcp_client_profile_t *profiles[], apr_size_t *count, const char *tag) -{ - apr_hash_index_t *it; - void *val; - mrcp_client_profile_t *profile; - apr_size_t i = 0; - apt_bool_t status = TRUE; - - if(!profiles || !count) { - return FALSE; - } - - for(it = apr_hash_first(client->pool, client->profile_table); it; it = apr_hash_next(it)) { - apr_hash_this(it, NULL, NULL, &val); - if(!val) continue; - - if(i >= *count) { - status = FALSE; - break; - } - - profile = val; - if(!tag || (profile->tag && strcasecmp(tag,profile->tag) == 0)) { - profiles[i] = profile; - i++; - } - } - *count = i; - return status; -} - -/** Register MRCP application */ -MRCP_DECLARE(apt_bool_t) mrcp_client_application_register(mrcp_client_t *client, mrcp_application_t *application, const char *name) -{ - if(!application || !name) { - return FALSE; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Application [%s]",name); - application->client = client; - application->msg_pool = apt_task_msg_pool_create_dynamic(sizeof(mrcp_app_message_t*),client->pool); - apr_hash_set(client->app_table,name,APR_HASH_KEY_STRING,application); - return TRUE; -} - -/** Get memory pool */ -MRCP_DECLARE(apr_pool_t*) mrcp_client_memory_pool_get(const mrcp_client_t *client) -{ - return client->pool; -} - -/** Get directory layout */ -MRCP_DECLARE(apt_dir_layout_t*) mrcp_client_dir_layout_get(const mrcp_client_t *client) -{ - return client->dir_layout; -} - -mrcp_client_session_t* mrcp_client_session_create(mrcp_client_t *client) -{ - apr_pool_t *pool; - mrcp_client_session_t *session = (mrcp_client_session_t*) mrcp_session_create(sizeof(mrcp_client_session_t)-sizeof(mrcp_session_t)); - - pool = session->base.pool; - session->base.name = apr_psprintf(pool,"0x%pp",session); - session->base.response_vtable = &session_response_vtable; - session->base.event_vtable = &session_event_vtable; - - session->application = NULL; - session->app_obj = NULL; - session->profile = NULL; - session->context = NULL; - session->codec_manager = client->codec_manager; - session->terminations = apr_array_make(pool,2,sizeof(rtp_termination_slot_t)); - session->channels = apr_array_make(pool,2,sizeof(mrcp_channel_t*)); - session->registered = FALSE; - session->offer = NULL; - session->answer = NULL; - session->active_request = NULL; - session->request_queue = apt_list_create(pool); - session->mpf_task_msg = NULL; - session->subrequest_count = 0; - session->disconnected = FALSE; - session->state = SESSION_STATE_NONE; - session->status = MRCP_SIG_STATUS_CODE_SUCCESS; - return session; -} - -void mrcp_client_session_add(mrcp_client_t *client, mrcp_client_session_t *session) -{ - if(session) { - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Add MRCP Handle "APT_NAMESID_FMT, - session->base.name, - MRCP_SESSION_SID(&session->base)); - apr_hash_set(client->session_table,session,sizeof(void*),session); - } -} - -void mrcp_client_session_remove(mrcp_client_t *client, mrcp_client_session_t *session) -{ - if(session) { - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Remove MRCP Handle "APT_NAMESID_FMT, - session->base.name, - MRCP_SESSION_SID(&session->base)); - apr_hash_set(client->session_table,session,sizeof(void*),NULL); - } -} - -static void mrcp_client_on_start_complete(apt_task_t *task) -{ - apt_consumer_task_t *consumer_task = apt_task_object_get(task); - mrcp_client_t *client = apt_consumer_task_object_get(consumer_task); - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,CLIENT_TASK_NAME" Started"); - if(client->on_start_complete) { - /* async start */ - client->on_start_complete(TRUE); - } - else { - /* sync start */ - apr_thread_mutex_lock(client->sync_start_mutex); - apr_thread_cond_signal(client->sync_start_object); - apr_thread_mutex_unlock(client->sync_start_mutex); - } -} - -static void mrcp_client_on_terminate_complete(apt_task_t *task) -{ - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,CLIENT_TASK_NAME" Terminated"); -} - - -static apt_bool_t mrcp_client_msg_process(apt_task_t *task, apt_task_msg_t *msg) -{ - apt_consumer_task_t *consumer_task = apt_task_object_get(task); - mrcp_client_t *client = apt_consumer_task_object_get(consumer_task); - if(!client) { - return FALSE; - } - switch(msg->type) { - case MRCP_CLIENT_SIGNALING_TASK_MSG: - { - const sig_agent_task_msg_data_t *sig_message = (const sig_agent_task_msg_data_t*)msg->data; - switch(msg->sub_type) { - case SIG_AGENT_TASK_MSG_ANSWER: - mrcp_client_session_answer_process(sig_message->session,sig_message->descriptor); - break; - case SIG_AGENT_TASK_MSG_TERMINATE_RESPONSE: - mrcp_client_session_terminate_response_process(sig_message->session); - break; - case SIG_AGENT_TASK_MSG_CONTROL_RESPONSE: - mrcp_client_session_control_response_process(sig_message->session,sig_message->message); - break; - case SIG_AGENT_TASK_MSG_DISCOVER_RESPONSE: - mrcp_client_session_discover_response_process(sig_message->session,sig_message->descriptor); - break; - case SIG_AGENT_TASK_MSG_TERMINATE_EVENT: - mrcp_client_session_terminate_event_process(sig_message->session); - break; - default: - break; - } - break; - } - case MRCP_CLIENT_CONNECTION_TASK_MSG: - { - const connection_agent_task_msg_data_t *data = (const connection_agent_task_msg_data_t*)msg->data; - switch(msg->sub_type) { - case CONNECTION_AGENT_TASK_MSG_ADD_CHANNEL: - mrcp_client_on_channel_add(data->channel,data->descriptor,data->status); - break; - case CONNECTION_AGENT_TASK_MSG_MODIFY_CHANNEL: - mrcp_client_on_channel_modify(data->channel,data->descriptor,data->status); - break; - case CONNECTION_AGENT_TASK_MSG_REMOVE_CHANNEL: - mrcp_client_on_channel_remove(data->channel,data->status); - break; - case CONNECTION_AGENT_TASK_MSG_RECEIVE_MESSAGE: - mrcp_client_on_message_receive(data->channel,data->message); - break; - case CONNECTION_AGENT_TASK_MSG_DISCONNECT: - mrcp_client_on_disconnect(data->channel); - break; - default: - break; - } - break; - } - case MRCP_CLIENT_MEDIA_TASK_MSG: - { - mpf_message_container_t *container = (mpf_message_container_t*) msg->data; - mrcp_client_mpf_message_process(container); - break; - } - case MRCP_CLIENT_APPLICATION_TASK_MSG: - { - mrcp_app_message_t **app_message = (mrcp_app_message_t**) msg->data; - mrcp_client_app_message_process(*app_message); - break; - } - default: - { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Task Message Received [%d;%d]", msg->type,msg->sub_type); - break; - } - } - return TRUE; -} - -apt_bool_t mrcp_app_signaling_task_msg_signal(mrcp_sig_command_e command_id, mrcp_session_t *session, mrcp_channel_t *channel) -{ - mrcp_client_session_t *client_session = (mrcp_client_session_t*)session; - mrcp_application_t *application = client_session->application; - apt_task_t *task = apt_consumer_task_base_get(application->client->task); - apt_task_msg_t *task_msg = apt_task_msg_acquire(application->msg_pool); - if(task_msg) { - mrcp_app_message_t **slot = ((mrcp_app_message_t**)task_msg->data); - mrcp_app_message_t *app_message; - task_msg->type = MRCP_CLIENT_APPLICATION_TASK_MSG; - - app_message = mrcp_client_app_signaling_request_create(command_id,session->pool); - app_message->application = client_session->application; - app_message->session = session; - app_message->channel = channel; - app_message->control_message = NULL; - app_message->descriptor = NULL; - *slot = app_message; - return apt_task_msg_signal(task,task_msg); - } - return FALSE; -} - -apt_bool_t mrcp_app_control_task_msg_signal(mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message) -{ - mrcp_client_session_t *client_session = (mrcp_client_session_t*)session; - mrcp_application_t *application = client_session->application; - apt_task_t *task = apt_consumer_task_base_get(application->client->task); - apt_task_msg_t *task_msg = apt_task_msg_acquire(application->msg_pool); - if(task_msg) { - mrcp_app_message_t **slot = ((mrcp_app_message_t**)task_msg->data); - mrcp_app_message_t *app_message; - task_msg->type = MRCP_CLIENT_APPLICATION_TASK_MSG; - - app_message = mrcp_client_app_control_message_create(session->pool); - app_message->application = client_session->application; - app_message->session = session; - app_message->channel = channel; - app_message->control_message = message; - *slot = app_message; - return apt_task_msg_signal(task,task_msg); - } - return FALSE; -} - -static apt_bool_t mrcp_client_signaling_task_msg_signal(sig_agent_task_msg_type_e type, mrcp_session_t *session, mrcp_session_descriptor_t *descriptor, mrcp_message_t *message) -{ - sig_agent_task_msg_data_t *data; - apt_task_msg_t *task_msg = apt_task_msg_acquire(session->signaling_agent->msg_pool); - if(task_msg) { - task_msg->type = MRCP_CLIENT_SIGNALING_TASK_MSG; - task_msg->sub_type = type; - data = (sig_agent_task_msg_data_t*) task_msg->data; - data->session = (mrcp_client_session_t*)session; - data->descriptor = descriptor; - data->message = message; - return apt_task_msg_parent_signal(session->signaling_agent->task,task_msg); - } - return FALSE; -} - -static apt_bool_t mrcp_client_connection_task_msg_signal( - connection_agent_task_msg_type_e type, - mrcp_connection_agent_t *agent, - mrcp_control_channel_t *channel, - mrcp_control_descriptor_t *descriptor, - mrcp_message_t *message, - apt_bool_t status) -{ - apt_task_t *task; - apt_task_msg_t *task_msg; - connection_agent_task_msg_data_t *data; - mrcp_client_t *client = mrcp_client_connection_agent_object_get(agent); - if(!client || !client->cnt_msg_pool) { - return FALSE; - } - task = apt_consumer_task_base_get(client->task); - task_msg = apt_task_msg_acquire(client->cnt_msg_pool); - if(task_msg) { - task_msg->type = MRCP_CLIENT_CONNECTION_TASK_MSG; - task_msg->sub_type = type; - data = (connection_agent_task_msg_data_t*) task_msg->data; - data->channel = channel ? channel->obj : NULL; - data->descriptor = descriptor; - data->message = message; - data->status = status; - return apt_task_msg_signal(task,task_msg); - } - return FALSE; -} - - -static apt_bool_t mrcp_client_answer_signal(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor) -{ - return mrcp_client_signaling_task_msg_signal(SIG_AGENT_TASK_MSG_ANSWER,session,descriptor,NULL); -} - -static apt_bool_t mrcp_client_terminate_response_signal(mrcp_session_t *session) -{ - return mrcp_client_signaling_task_msg_signal(SIG_AGENT_TASK_MSG_TERMINATE_RESPONSE,session,NULL,NULL); -} - -static apt_bool_t mrcp_client_control_response_signal(mrcp_session_t *session, mrcp_message_t *message) -{ - return mrcp_client_signaling_task_msg_signal(SIG_AGENT_TASK_MSG_CONTROL_RESPONSE,session,NULL,message); -} - -static apt_bool_t mrcp_client_discover_response_signal(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor) -{ - return mrcp_client_signaling_task_msg_signal(SIG_AGENT_TASK_MSG_DISCOVER_RESPONSE,session,descriptor,NULL); -} - -static apt_bool_t mrcp_client_terminate_event_signal(mrcp_session_t *session) -{ - return mrcp_client_signaling_task_msg_signal(SIG_AGENT_TASK_MSG_TERMINATE_EVENT,session,NULL,NULL); -} - - -static apt_bool_t mrcp_client_channel_add_signal(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status) -{ - return mrcp_client_connection_task_msg_signal( - CONNECTION_AGENT_TASK_MSG_ADD_CHANNEL, - channel->agent, - channel, - descriptor, - NULL, - status); -} - -static apt_bool_t mrcp_client_channel_modify_signal(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status) -{ - return mrcp_client_connection_task_msg_signal( - CONNECTION_AGENT_TASK_MSG_MODIFY_CHANNEL, - channel->agent, - channel, - descriptor, - NULL, - status); -} - -static apt_bool_t mrcp_client_channel_remove_signal(mrcp_control_channel_t *channel, apt_bool_t status) -{ - return mrcp_client_connection_task_msg_signal( - CONNECTION_AGENT_TASK_MSG_REMOVE_CHANNEL, - channel->agent, - channel, - NULL, - NULL, - status); -} - -static apt_bool_t mrcp_client_message_signal(mrcp_control_channel_t *channel, mrcp_message_t *mrcp_message) -{ - return mrcp_client_connection_task_msg_signal( - CONNECTION_AGENT_TASK_MSG_RECEIVE_MESSAGE, - channel->agent, - channel, - NULL, - mrcp_message, - TRUE); -} - -static apt_bool_t mrcp_client_disconnect_signal(mrcp_control_channel_t *channel) -{ - return mrcp_client_connection_task_msg_signal( - CONNECTION_AGENT_TASK_MSG_DISCONNECT, - channel->agent, - channel, - NULL, - NULL, - TRUE); -} diff --git a/libs/unimrcp/libs/mrcp-client/src/mrcp_client_session.c b/libs/unimrcp/libs/mrcp-client/src/mrcp_client_session.c deleted file mode 100644 index 851e7ffcba..0000000000 --- a/libs/unimrcp/libs/mrcp-client/src/mrcp_client_session.c +++ /dev/null @@ -1,1314 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_client_session.c 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $ - */ - -#include "mrcp_client_session.h" -#include "mrcp_resource_factory.h" -#include "mrcp_resource.h" -#include "mrcp_sig_agent.h" -#include "mrcp_client_connection.h" -#include "mrcp_session.h" -#include "mrcp_session_descriptor.h" -#include "mrcp_control_descriptor.h" -#include "mrcp_message.h" -#include "mrcp_ca_factory.h" -#include "mpf_engine_factory.h" -#include "mpf_termination_factory.h" -#include "mpf_stream.h" -#include "apt_consumer_task.h" -#include "apt_obj_list.h" -#include "apt_log.h" - -/** Macro to log session name and identifier */ -#define MRCP_SESSION_NAMESID(session) \ - session->base.name, MRCP_SESSION_SID(&session->base) - -#define IS_SESSION_TERMINATE(app_message) \ - (app_message->message_type == MRCP_APP_MESSAGE_TYPE_SIGNALING && \ - app_message->sig_message.command_id == MRCP_SIG_COMMAND_SESSION_TERMINATE) - -void mrcp_client_session_add(mrcp_client_t *client, mrcp_client_session_t *session); -void mrcp_client_session_remove(mrcp_client_t *client, mrcp_client_session_t *session); - -static apt_bool_t mrcp_client_session_offer_send(mrcp_client_session_t *session); - -static apt_bool_t mrcp_app_session_terminate_raise(mrcp_client_session_t *session, mrcp_sig_status_code_e status); -static apt_bool_t mrcp_app_sig_response_raise(mrcp_client_session_t *session, apt_bool_t process_pending_requests); -static apt_bool_t mrcp_app_sig_event_raise(mrcp_client_session_t *session, mrcp_channel_t *channel); -static apt_bool_t mrcp_app_control_message_raise(mrcp_client_session_t *session, mrcp_channel_t *channel, mrcp_message_t *mrcp_message); -static apt_bool_t mrcp_app_failure_message_raise(mrcp_client_session_t *session); -static apt_bool_t mrcp_app_request_dispatch(mrcp_client_session_t *session, const mrcp_app_message_t *app_message); - -static apt_bool_t mrcp_client_resource_answer_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor); -static apt_bool_t mrcp_client_control_media_answer_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor); -static apt_bool_t mrcp_client_av_media_answer_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor); - -static mrcp_channel_t* mrcp_client_channel_find_by_name(mrcp_client_session_t *session, const apt_str_t *resource_name); - -static APR_INLINE mrcp_version_e mrcp_session_version_get(mrcp_client_session_t *session) -{ - return session->profile->mrcp_version; -} - -static APR_INLINE void mrcp_client_session_state_set(mrcp_client_session_t *session, mrcp_client_session_state_e state) -{ - if(session->subrequest_count != 0) { - /* error case */ - apt_obj_log(APT_LOG_MARK,APT_PRIO_ERROR,session->base.log_obj,"Unexpected State Change [%d] pending subrequests [%d] "APT_NAMESID_FMT, - state, - session->subrequest_count, - MRCP_SESSION_NAMESID(session)); - session->subrequest_count = 0; - } - session->state = state; -} - -static APR_INLINE void mrcp_client_session_subrequest_add(mrcp_client_session_t *session) -{ - session->subrequest_count++; -} - -static APR_INLINE apt_bool_t mrcp_client_session_subrequest_remove(mrcp_client_session_t *session) -{ - if(!session->subrequest_count) { - /* error case */ - return FALSE; - } - - session->subrequest_count--; - return (session->subrequest_count ? FALSE : TRUE); -} - -static mrcp_app_message_t* mrcp_client_app_response_create(const mrcp_app_message_t *app_request, mrcp_sig_status_code_e status, apr_pool_t *pool) -{ - mrcp_app_message_t *app_response = apr_palloc(pool,sizeof(mrcp_app_message_t)); - *app_response = *app_request; - app_response->sig_message.message_type = MRCP_SIG_MESSAGE_TYPE_RESPONSE; - app_response->sig_message.status = status; - return app_response; -} - - -mrcp_channel_t* mrcp_client_channel_create( - mrcp_client_session_t *session, - mrcp_resource_t *resource, - mpf_termination_t *termination, - mpf_rtp_termination_descriptor_t *rtp_descriptor, - void *obj) -{ - mrcp_channel_t *channel = apr_palloc(session->base.pool,sizeof(mrcp_channel_t)); - channel->pool = session->base.pool; - channel->obj = obj; - channel->session = &session->base; - channel->control_channel = NULL; - channel->termination = termination; - channel->rtp_termination_slot = NULL; - channel->resource = resource; - channel->waiting_for_channel = FALSE; - channel->waiting_for_termination = FALSE; - - if(rtp_descriptor) { - rtp_termination_slot_t *termination_slot = apr_palloc(channel->pool,sizeof(rtp_termination_slot_t)); - termination_slot->descriptor = rtp_descriptor; - termination_slot->termination = NULL; - termination_slot->waiting = FALSE; - termination_slot->channel = channel; - termination_slot->id = 0; - channel->rtp_termination_slot = termination_slot; - } - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Create Channel "APT_NAMESID_FMT, - MRCP_SESSION_NAMESID(session)); - return channel; -} - -apt_bool_t mrcp_client_session_answer_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor) -{ - if(!session->offer) { - return FALSE; - } - if(!descriptor) { - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Receive Answer "APT_NAMESID_FMT" [null descriptor]", - MRCP_SESSION_NAMESID(session)); - session->status = MRCP_SIG_STATUS_CODE_FAILURE; - /* raise app response */ - return mrcp_app_sig_response_raise(session,TRUE); - } - - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Receive Answer "APT_NAMESID_FMT" [c:%d a:%d v:%d] Status %d", - MRCP_SESSION_NAMESID(session), - descriptor->control_media_arr->nelts, - descriptor->audio_media_arr->nelts, - descriptor->video_media_arr->nelts, - descriptor->response_code); - - if(descriptor->response_code >=200 && descriptor->response_code < 300) { - mrcp_client_session_state_set(session,SESSION_STATE_PROCESSING_ANSWER); - if(session->context) { - /* first, reset/destroy existing associations and topology */ - if(mpf_engine_topology_message_add( - session->base.media_engine, - MPF_RESET_ASSOCIATIONS,session->context, - &session->mpf_task_msg) == TRUE){ - mrcp_client_session_subrequest_add(session); - } - } - - if(mrcp_session_version_get(session) == MRCP_VERSION_1) { - if(mrcp_client_resource_answer_process(session,descriptor) != TRUE) { - session->status = MRCP_SIG_STATUS_CODE_FAILURE; - } - } - else { - mrcp_client_control_media_answer_process(session,descriptor); - mrcp_client_av_media_answer_process(session,descriptor); - } - - if(session->context) { - /* apply topology based on assigned associations */ - if(mpf_engine_topology_message_add( - session->base.media_engine, - MPF_APPLY_TOPOLOGY,session->context, - &session->mpf_task_msg) == TRUE) { - mrcp_client_session_subrequest_add(session); - } - - mpf_engine_message_send(session->base.media_engine,&session->mpf_task_msg); - } - } - else { - session->status = MRCP_SIG_STATUS_CODE_TERMINATE; - } - - /* store received answer */ - session->answer = descriptor; - - if(!session->subrequest_count) { - /* raise app response */ - mrcp_app_sig_response_raise(session,TRUE); - } - - return TRUE; -} - -apt_bool_t mrcp_client_session_terminate_response_process(mrcp_client_session_t *session) -{ - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Session Terminated "APT_NAMESID_FMT, MRCP_SESSION_NAMESID(session)); - - if(mrcp_client_session_subrequest_remove(session) == TRUE) { - mrcp_app_session_terminate_raise(session,MRCP_SIG_STATUS_CODE_SUCCESS); - } - return TRUE; -} - -apt_bool_t mrcp_client_session_terminate_event_process(mrcp_client_session_t *session) -{ - if(session->state == SESSION_STATE_TERMINATING) { - /* session termination request has been sent, still waiting for the response, - all the events must be ignored at this stage */ - apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,session->base.log_obj,"Unexpected Event! "APT_NAMESID_FMT, - MRCP_SESSION_NAMESID(session)); - return FALSE; - } - - apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Mark Session as Disconnected "APT_NAMESID_FMT, - MRCP_SESSION_NAMESID(session)); - session->disconnected = TRUE; - if(!session->active_request) { - /* raise app event */ - mrcp_app_sig_event_raise(session,NULL); - } - - return TRUE; -} - -apt_bool_t mrcp_client_session_control_response_process(mrcp_client_session_t *session, mrcp_message_t *message) -{ - mrcp_channel_t *channel = mrcp_client_channel_find_by_name(session,&message->channel_id.resource_name); - if(!channel) { - return FALSE; - } - return mrcp_app_control_message_raise(session,channel,message); -} - -apt_bool_t mrcp_client_session_discover_response_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor) -{ - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Resources Discovered %s", session->base.name); - if(!session->active_request) { - return FALSE; - } - - if(!descriptor) { - /* raise app response */ - session->status = MRCP_SIG_STATUS_CODE_FAILURE; - return mrcp_app_sig_response_raise(session,TRUE); - } - - if(mrcp_session_version_get(session) == MRCP_VERSION_1) { - if(descriptor->resource_state == TRUE) { - mrcp_control_descriptor_t *control_media; - if(!session->answer) { - session->answer = descriptor; - } - control_media = mrcp_control_descriptor_create(session->base.pool); - control_media->id = mrcp_session_control_media_add(session->answer,control_media); - control_media->resource_name = descriptor->resource_name; - } - } - else { - session->answer = descriptor; - } - - if(mrcp_client_session_subrequest_remove(session) == TRUE) { - mrcp_app_message_t *response; - response = mrcp_client_app_response_create(session->active_request,MRCP_SIG_STATUS_CODE_SUCCESS,session->base.pool); - response->descriptor = session->answer; - session->answer = NULL; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Raise App Resource Discovery Response %s", session->base.name); - session->application->handler(response); - - session->active_request = apt_list_pop_front(session->request_queue); - if(session->active_request) { - mrcp_app_request_dispatch(session,session->active_request); - } - } - return TRUE; -} - -apt_bool_t mrcp_client_on_channel_add(mrcp_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status) -{ - mrcp_client_session_t *session = (mrcp_client_session_t*)channel->session; - apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Control Channel Added "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - channel->resource->name.buf); - if(!channel->waiting_for_channel) { - return FALSE; - } - channel->waiting_for_channel = FALSE; - if(mrcp_client_session_subrequest_remove(session) == TRUE) { - /* send offer to server */ - mrcp_client_session_offer_send(session); - } - return TRUE; -} - -apt_bool_t mrcp_client_on_channel_modify(mrcp_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status) -{ - mrcp_client_session_t *session = (mrcp_client_session_t*)channel->session; - apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Control Channel Modified "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - channel->resource->name.buf); - if(!channel->waiting_for_channel) { - return FALSE; - } - channel->waiting_for_channel = FALSE; - if(mrcp_client_session_subrequest_remove(session) == TRUE) { - /* raise app response */ - if(status != TRUE) { - session->status = MRCP_SIG_STATUS_CODE_FAILURE; - } - mrcp_app_sig_response_raise(session,TRUE); - } - return TRUE; -} - -apt_bool_t mrcp_client_on_channel_remove(mrcp_channel_t *channel, apt_bool_t status) -{ - mrcp_client_session_t *session = (mrcp_client_session_t*)channel->session; - apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Control Channel Removed "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - channel->resource->name.buf); - if(!channel->waiting_for_channel) { - return FALSE; - } - channel->waiting_for_channel = FALSE; - if(mrcp_client_session_subrequest_remove(session) == TRUE) { - mrcp_app_session_terminate_raise( - session, - status == TRUE ? MRCP_SIG_STATUS_CODE_SUCCESS : MRCP_SIG_STATUS_CODE_FAILURE); - } - return TRUE; -} - -apt_bool_t mrcp_client_on_message_receive(mrcp_channel_t *channel, mrcp_message_t *message) -{ - mrcp_client_session_t *session = (mrcp_client_session_t*)channel->session; - return mrcp_app_control_message_raise(session,channel,message); -} - -apt_bool_t mrcp_client_on_disconnect(mrcp_channel_t *channel) -{ - mrcp_client_session_t *session = (mrcp_client_session_t*)channel->session; - return mrcp_client_session_terminate_event_process(session); -} - -mrcp_app_message_t* mrcp_client_app_signaling_request_create(mrcp_sig_command_e command_id, apr_pool_t *pool) -{ - mrcp_app_message_t *app_message = apr_palloc(pool,sizeof(mrcp_app_message_t)); - app_message->message_type = MRCP_APP_MESSAGE_TYPE_SIGNALING; - app_message->sig_message.message_type = MRCP_SIG_MESSAGE_TYPE_REQUEST; - app_message->sig_message.command_id = command_id; - return app_message; -} - -mrcp_app_message_t* mrcp_client_app_signaling_event_create(mrcp_sig_event_e event_id, apr_pool_t *pool) -{ - mrcp_app_message_t *app_message = apr_palloc(pool,sizeof(mrcp_app_message_t)); - app_message->message_type = MRCP_APP_MESSAGE_TYPE_SIGNALING; - app_message->sig_message.message_type = MRCP_SIG_MESSAGE_TYPE_EVENT; - app_message->sig_message.event_id = event_id; - return app_message; -} - -mrcp_app_message_t* mrcp_client_app_control_message_create(apr_pool_t *pool) -{ - mrcp_app_message_t *app_message = apr_palloc(pool,sizeof(mrcp_app_message_t)); - app_message->message_type = MRCP_APP_MESSAGE_TYPE_CONTROL; - return app_message; -} - -apt_bool_t mrcp_client_app_message_process(mrcp_app_message_t *app_message) -{ - mrcp_client_session_t *session = (mrcp_client_session_t*)app_message->session; - if(app_message->message_type == MRCP_APP_MESSAGE_TYPE_SIGNALING) { - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Receive App Request "APT_NAMESID_FMT" [%d]", - MRCP_SESSION_NAMESID(session), - app_message->sig_message.command_id); - } - else { - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Receive App MRCP Request "APT_NAMESID_FMT, - MRCP_SESSION_NAMESID(session)); - } - - if(session->active_request) { - apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Push Request to Queue "APT_NAMESID_FMT, - MRCP_SESSION_NAMESID(session)); - apt_list_push_back(session->request_queue,app_message,session->base.pool); - return TRUE; - } - - session->active_request = app_message; - mrcp_app_request_dispatch(session,app_message); - return TRUE; -} - -static apt_bool_t mrcp_client_session_offer_send(mrcp_client_session_t *session) -{ - mrcp_session_descriptor_t *descriptor = session->offer; - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Send Offer "APT_NAMESID_FMT" [c:%d a:%d v:%d] to %s:%hu", - MRCP_SESSION_NAMESID(session), - descriptor->control_media_arr->nelts, - descriptor->audio_media_arr->nelts, - descriptor->video_media_arr->nelts, - session->profile->signaling_settings->server_ip, - session->profile->signaling_settings->server_port); - return mrcp_session_offer(&session->base,descriptor); -} - -static apt_bool_t mrcp_app_session_terminate_raise(mrcp_client_session_t *session, mrcp_sig_status_code_e status) -{ - int i; - mrcp_channel_t *channel; - for(i=0; ichannels->nelts; i++) { - channel = APR_ARRAY_IDX(session->channels,i,mrcp_channel_t*); - if(!channel) continue; - - if(channel->control_channel) { - mrcp_client_control_channel_destroy(channel->control_channel); - channel->control_channel = NULL; - } - } - - mrcp_client_session_remove(session->application->client,session); - /* raise app response */ - if(status != MRCP_SIG_STATUS_CODE_SUCCESS) { - session->status = status; - } - return mrcp_app_sig_response_raise(session,FALSE); -} - -static apt_bool_t mrcp_app_sig_response_raise(mrcp_client_session_t *session, apt_bool_t process_pending_requests) -{ - mrcp_app_message_t *response; - const mrcp_app_message_t *request = session->active_request; - if(!request) { - return FALSE; - } - session->active_request = NULL; - if(session->disconnected == TRUE) { - session->status = MRCP_SIG_STATUS_CODE_TERMINATE; - } - response = mrcp_client_app_response_create(request,session->status,session->base.pool); - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Raise App Response "APT_NAMESID_FMT" [%d] %s [%d]", - MRCP_SESSION_NAMESID(session), - response->sig_message.command_id, - session->status == MRCP_SIG_STATUS_CODE_SUCCESS ? "SUCCESS" : "FAILURE", - session->status); - session->application->handler(response); - - if(process_pending_requests) { - session->active_request = apt_list_pop_front(session->request_queue); - if(session->active_request) { - mrcp_app_request_dispatch(session,session->active_request); - } - } - return TRUE; -} - -static apt_bool_t mrcp_app_sig_event_raise(mrcp_client_session_t *session, mrcp_channel_t *channel) -{ - mrcp_app_message_t *app_event; - if(!session) { - return FALSE; - } - app_event = mrcp_client_app_signaling_event_create(MRCP_SIG_EVENT_TERMINATE,session->base.pool); - app_event->application = session->application; - app_event->session = &session->base; - app_event->channel = channel; - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Raise App Event "APT_NAMESID_FMT" [%d]", - MRCP_SESSION_NAMESID(session), - app_event->sig_message.event_id); - return session->application->handler(app_event); -} - -static apt_bool_t mrcp_app_control_message_raise(mrcp_client_session_t *session, mrcp_channel_t *channel, mrcp_message_t *mrcp_message) -{ - if(mrcp_message->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) { - mrcp_app_message_t *response; - mrcp_message_t *mrcp_request; - if(!session->active_request || !session->active_request->control_message) { - return FALSE; - } - response = mrcp_client_app_response_create(session->active_request,0,session->base.pool); - mrcp_request = session->active_request->control_message; - mrcp_message->start_line.method_id = mrcp_request->start_line.method_id; - mrcp_message->start_line.method_name = mrcp_request->start_line.method_name; - response->control_message = mrcp_message; - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Raise App MRCP Response "APT_NAMESID_FMT, - MRCP_SESSION_NAMESID(session)); - session->application->handler(response); - - session->active_request = apt_list_pop_front(session->request_queue); - if(session->active_request) { - mrcp_app_request_dispatch(session,session->active_request); - } - } - else if(mrcp_message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) { - mrcp_app_message_t *app_message; - app_message = mrcp_client_app_control_message_create(session->base.pool); - app_message->control_message = mrcp_message; - app_message->application = session->application; - app_message->session = &session->base; - app_message->channel = channel; - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Raise App MRCP Event "APT_NAMESID_FMT, - MRCP_SESSION_NAMESID(session)); - session->application->handler(app_message); - } - return TRUE; -} - -static apt_bool_t mrcp_app_failure_message_raise(mrcp_client_session_t *session) -{ - mrcp_app_message_t *response; - const mrcp_app_message_t *request = session->active_request; - if(!request) { - return FALSE; - } - session->active_request = NULL; - response = mrcp_client_app_response_create(request,session->status,session->base.pool); - if(response->message_type == MRCP_APP_MESSAGE_TYPE_SIGNALING) { - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Raise App Response "APT_NAMESID_FMT" [%d] %s [%d]", - MRCP_SESSION_NAMESID(session), - response->sig_message.command_id, - session->status == MRCP_SIG_STATUS_CODE_SUCCESS ? "SUCCESS" : "FAILURE", - session->status); - } - else if(response->control_message){ - mrcp_message_t *mrcp_response = mrcp_response_create(response->control_message,response->control_message->pool); - mrcp_response->start_line.status_code = MRCP_STATUS_CODE_METHOD_FAILED; - response->control_message = mrcp_response; - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Raise App MRCP Response "APT_NAMESID_FMT, - MRCP_SESSION_NAMESID(session)); - } - session->application->handler(response); - return TRUE; -} - -static apt_bool_t mrcp_client_channel_find(mrcp_client_session_t *session, mrcp_channel_t *channel, int *index) -{ - int i; - mrcp_channel_t *existing_channel; - for(i=0; ichannels->nelts; i++) { - existing_channel = APR_ARRAY_IDX(session->channels,i,mrcp_channel_t*); - if(existing_channel == channel) { - if(index) { - *index = i; - } - return TRUE; - } - } - return FALSE; -} - -static rtp_termination_slot_t* mrcp_client_rtp_termination_find(mrcp_client_session_t *session, mpf_termination_t *termination) -{ - int i; - rtp_termination_slot_t *slot; - for(i=0; iterminations->nelts; i++) { - slot = &APR_ARRAY_IDX(session->terminations,i,rtp_termination_slot_t); - if(slot->termination == termination) { - return slot; - } - } - return NULL; -} - -static mrcp_channel_t* mrcp_client_channel_termination_find(mrcp_client_session_t *session, mpf_termination_t *termination) -{ - int i; - mrcp_channel_t *channel; - for(i=0; ichannels->nelts; i++) { - channel = APR_ARRAY_IDX(session->channels,i,mrcp_channel_t*); - if(!channel) continue; - - if(channel->termination == termination) { - return channel; - } - } - return NULL; -} - -static mrcp_channel_t* mrcp_client_channel_find_by_name(mrcp_client_session_t *session, const apt_str_t *resource_name) -{ - int i; - mrcp_channel_t *channel; - for(i=0; ichannels->nelts; i++) { - channel = APR_ARRAY_IDX(session->channels,i,mrcp_channel_t*); - if(!channel || !channel->resource) continue; - - if(apt_string_compare(&channel->resource->name,resource_name) == TRUE) { - return channel; - } - } - return NULL; -} - -static apt_bool_t mrcp_client_message_send(mrcp_client_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message) -{ - if(!session->base.id.length) { - mrcp_message_t *response = mrcp_response_create(message,message->pool); - response->start_line.status_code = MRCP_STATUS_CODE_METHOD_FAILED; - apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Raise App Failure MRCP Response "APT_NAMESID_FMT, - MRCP_SESSION_NAMESID(session)); - mrcp_app_control_message_raise(session,channel,response); - return TRUE; - } - - message->channel_id.session_id = session->base.id; - message->start_line.request_id = ++session->base.last_request_id; - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Send MRCP Request "APT_NAMESIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_SESSION_NAMESID(session), - channel->resource->name.buf, - message->start_line.request_id); - - if(channel->control_channel) { - /* MRCPv2 */ - mrcp_client_control_message_send(channel->control_channel,message); - } - else { - /* MRCPv1 */ - mrcp_session_control_request(channel->session,message); - } - - return TRUE; -} - -static apt_bool_t mrcp_client_channel_modify(mrcp_client_session_t *session, mrcp_channel_t *channel, apt_bool_t enable) -{ - int index; - if(!session->offer) { - return FALSE; - } - if(!channel->resource) { - return FALSE; - } - - apt_obj_log(APT_LOG_MARK,APT_PRIO_NOTICE,session->base.log_obj,"Modify Control Channel "APT_NAMESIDRES_FMT" [%d]", - MRCP_SESSION_NAMESID(session), - channel->resource->name.buf, - enable); - if(mrcp_client_channel_find(session,channel,&index) == TRUE) { - mrcp_control_descriptor_t *control_media = mrcp_session_control_media_get(session->offer,(apr_size_t)index); - if(control_media) { - control_media->port = (enable == TRUE) ? TCP_DISCARD_PORT : 0; - } - if(channel->termination && channel->rtp_termination_slot) { - mpf_audio_stream_t *audio_stream = mpf_termination_audio_stream_get( - channel->termination); - mpf_rtp_media_descriptor_t *audio_media = mrcp_session_audio_media_get( - session->offer, - channel->rtp_termination_slot->id); - if(audio_media && audio_stream) { - mpf_stream_direction_e direction = mpf_stream_reverse_direction_get(audio_stream->direction); - if(enable == TRUE) { - audio_media->direction |= direction; - } - else { - audio_media->direction &= ~direction; - } - audio_media->state = (audio_media->direction != STREAM_DIRECTION_NONE) ? MPF_MEDIA_ENABLED : MPF_MEDIA_DISABLED; - } - } - } - - session->offer->resource_name = channel->resource->name; - session->offer->resource_state = enable; - return mrcp_client_session_offer_send(session); -} - -static apt_bool_t mrcp_client_channel_add(mrcp_client_session_t *session, mrcp_channel_t *channel) -{ - mpf_rtp_termination_descriptor_t *rtp_descriptor = NULL; - rtp_termination_slot_t *slot; - apr_pool_t *pool = session->base.pool; - mrcp_client_profile_t *profile = session->profile; - if(mrcp_client_channel_find(session,channel,NULL) == TRUE) { - /* update */ - return mrcp_client_channel_modify(session,channel,TRUE); - } - - if(!session->offer) { - session->offer = mrcp_session_descriptor_create(pool); - } - - mrcp_client_session_state_set(session,SESSION_STATE_GENERATING_OFFER); - - if(mrcp_session_version_get(session) == MRCP_VERSION_1) { - session->offer->resource_name = channel->resource->name; - session->offer->resource_state = TRUE; - } - else { - mrcp_control_descriptor_t *control_media; - if(!channel->control_channel) { - channel->control_channel = mrcp_client_control_channel_create(session->base.connection_agent,channel,pool); - mrcp_client_control_channel_log_obj_set(channel->control_channel,session->base.log_obj); - } - control_media = mrcp_control_offer_create(pool); - control_media->id = mrcp_session_control_media_add(session->offer,control_media); - mrcp_cmid_add(control_media->cmid_arr,session->offer->control_media_arr->nelts); - control_media->resource_name = channel->resource->name; - if(mrcp_client_control_channel_add(channel->control_channel,control_media) == TRUE) { - channel->waiting_for_channel = TRUE; - mrcp_client_session_subrequest_add(session); - } - } - - apt_obj_log(APT_LOG_MARK,APT_PRIO_NOTICE,session->base.log_obj,"Add Control Channel "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - channel->resource->name.buf); - /* add control channel */ - APR_ARRAY_PUSH(session->channels,mrcp_channel_t*) = channel; - - /* add rtp termination slot */ - slot = apr_array_push(session->terminations); - slot->waiting = FALSE; - slot->termination = NULL; - slot->descriptor = NULL; - slot->channel = channel; - slot->id = 0; - - if(channel->termination) { - /* media termination mode */ - mpf_termination_t *termination; - mpf_audio_stream_t *audio_stream; - - if(!session->context) { - /* create media context first */ - session->context = mpf_engine_context_create( - session->base.media_engine, - session->base.name, - session,5,pool); - } - apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Add Media Termination "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - mpf_termination_name_get(channel->termination)); - if(mpf_engine_termination_message_add( - session->base.media_engine, - MPF_ADD_TERMINATION,session->context,channel->termination,NULL, - &session->mpf_task_msg) == TRUE) { - channel->waiting_for_termination = TRUE; - mrcp_client_session_subrequest_add(session); - } - - /* initialize rtp descriptor */ - rtp_descriptor = apr_palloc(pool,sizeof(mpf_rtp_termination_descriptor_t)); - mpf_rtp_termination_descriptor_init(rtp_descriptor); - rtp_descriptor->audio.settings = profile->rtp_settings; - audio_stream = mpf_termination_audio_stream_get(channel->termination); - if(audio_stream) { - mpf_rtp_media_descriptor_t *media; - media = apr_palloc(pool,sizeof(mpf_rtp_media_descriptor_t)); - mpf_rtp_media_descriptor_init(media); - media->state = MPF_MEDIA_ENABLED; - media->direction = mpf_stream_reverse_direction_get(audio_stream->direction); - rtp_descriptor->audio.local = media; - if(audio_stream->capabilities) { - rtp_descriptor->audio.capabilities = mpf_stream_capabilities_clone(audio_stream->capabilities,pool); - rtp_descriptor->audio.capabilities->direction = media->direction; - } - } - - /* create rtp termination */ - termination = mpf_termination_create(session->base.rtp_factory,session,pool); - slot->termination = termination; - apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Add Media Termination "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - mpf_termination_name_get(termination)); - - /* send add termination request (add to media context) */ - if(mpf_engine_termination_message_add( - session->base.media_engine, - MPF_ADD_TERMINATION,session->context,termination,rtp_descriptor, - &session->mpf_task_msg) == TRUE) { - slot->waiting = TRUE; - mrcp_client_session_subrequest_add(session); - } - mpf_engine_message_send(session->base.media_engine,&session->mpf_task_msg); - } - else { - /* bypass media mode */ - if(channel->rtp_termination_slot) { - rtp_descriptor = channel->rtp_termination_slot->descriptor; - if(rtp_descriptor) { - if(rtp_descriptor->audio.local) { - session->offer->ip = rtp_descriptor->audio.local->ip; - session->offer->ext_ip = rtp_descriptor->audio.local->ext_ip; - rtp_descriptor->audio.local->id = mrcp_session_audio_media_add(session->offer,rtp_descriptor->audio.local); - rtp_descriptor->audio.local->mid = session->offer->audio_media_arr->nelts; - slot->id = session->offer->audio_media_arr->nelts - 1; - } - } - } - } - - slot->descriptor = rtp_descriptor; - channel->rtp_termination_slot = slot; - - if(!session->subrequest_count) { - /* send offer to server */ - mrcp_client_session_offer_send(session); - } - return TRUE; -} - -static apt_bool_t mrcp_client_session_update(mrcp_client_session_t *session) -{ - if(!session->offer) { - return FALSE; - } - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Update Session "APT_NAMESID_FMT, - MRCP_SESSION_NAMESID(session)); - return mrcp_client_session_offer_send(session); -} - -static apt_bool_t mrcp_client_session_terminate(mrcp_client_session_t *session) -{ - mrcp_channel_t *channel; - rtp_termination_slot_t *slot; - int i; - - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Terminate Session "APT_NAMESID_FMT, - MRCP_SESSION_NAMESID(session)); - - mrcp_client_session_state_set(session,SESSION_STATE_TERMINATING); - if(session->context) { - /* first destroy existing topology */ - if(mpf_engine_topology_message_add( - session->base.media_engine, - MPF_DESTROY_TOPOLOGY,session->context, - &session->mpf_task_msg) == TRUE){ - mrcp_client_session_subrequest_add(session); - } - } - /* remove existing control channels */ - for(i=0; ichannels->nelts; i++) { - /* get existing channel */ - channel = APR_ARRAY_IDX(session->channels,i,mrcp_channel_t*); - if(!channel) continue; - - if(channel->control_channel) { - /* remove channel */ - apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Remove Control Channel "APT_NAMESID_FMT, - MRCP_SESSION_NAMESID(session)); - if(mrcp_client_control_channel_remove(channel->control_channel) == TRUE) { - channel->waiting_for_channel = TRUE; - mrcp_client_session_subrequest_add(session); - } - } - - /* send subtract termination request */ - if(channel->termination) { - apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Subtract Media Termination "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - mpf_termination_name_get(channel->termination)); - if(mpf_engine_termination_message_add( - session->base.media_engine, - MPF_SUBTRACT_TERMINATION,session->context,channel->termination,NULL, - &session->mpf_task_msg) == TRUE) { - channel->waiting_for_termination = TRUE; - mrcp_client_session_subrequest_add(session); - } - } - } - - if(session->context) { - /* subtract existing terminations */ - for(i=0; iterminations->nelts; i++) { - /* get existing termination */ - slot = &APR_ARRAY_IDX(session->terminations,i,rtp_termination_slot_t); - if(!slot->termination) continue; - - /* send subtract termination request */ - apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Subtract Media Termination "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - mpf_termination_name_get(slot->termination)); - if(mpf_engine_termination_message_add( - session->base.media_engine, - MPF_SUBTRACT_TERMINATION,session->context,slot->termination,NULL, - &session->mpf_task_msg) == TRUE) { - slot->waiting = TRUE; - mrcp_client_session_subrequest_add(session); - } - } - - mpf_engine_message_send(session->base.media_engine,&session->mpf_task_msg); - } - - mrcp_client_session_subrequest_add(session); - mrcp_session_terminate_request(&session->base); - return TRUE; -} - -static apt_bool_t mrcp_client_resource_discover(mrcp_client_session_t *session) -{ - mrcp_session_descriptor_t *descriptor = NULL; - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Discover Resources "APT_PTR_FMT, MRCP_SESSION_PTR(&session->base)); - session->answer = NULL; - mrcp_client_session_state_set(session,SESSION_STATE_DISCOVERING); - - if(mrcp_session_version_get(session) == MRCP_VERSION_1) { - mrcp_resource_t *resource; - mrcp_resource_id i; - - for(i=0; iprofile->resource_factory,i); - if(!resource) continue; - - descriptor = mrcp_session_descriptor_create(session->base.pool); - apt_string_copy(&descriptor->resource_name,&resource->name,session->base.pool); - if(mrcp_session_discover_request(&session->base,descriptor) == TRUE) { - mrcp_client_session_subrequest_add(session); - } - } - } - else { - if(mrcp_session_discover_request(&session->base,descriptor) == TRUE) { - mrcp_client_session_subrequest_add(session); - } - } - - if(session->subrequest_count == 0) { - session->status = MRCP_SIG_STATUS_CODE_FAILURE; - mrcp_app_sig_response_raise(session,TRUE); - } - return TRUE; -} - -static apt_bool_t mrcp_client_on_termination_add(mrcp_client_session_t *session, const mpf_message_t *mpf_message) -{ - rtp_termination_slot_t *termination_slot; - apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Media Termination Added "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - mpf_termination_name_get(mpf_message->termination)); - termination_slot = mrcp_client_rtp_termination_find(session,mpf_message->termination); - if(termination_slot) { - /* rtp termination */ - mpf_rtp_termination_descriptor_t *rtp_descriptor; - if(termination_slot->waiting == FALSE) { - return FALSE; - } - termination_slot->waiting = FALSE; - rtp_descriptor = mpf_message->descriptor; - if(rtp_descriptor->audio.local) { - session->offer->ip = rtp_descriptor->audio.local->ip; - session->offer->ext_ip = rtp_descriptor->audio.local->ext_ip; - rtp_descriptor->audio.local->id = mrcp_session_audio_media_add(session->offer,rtp_descriptor->audio.local); - rtp_descriptor->audio.local->mid = session->offer->audio_media_arr->nelts; - termination_slot->id = session->offer->audio_media_arr->nelts - 1; - } - if(mrcp_client_session_subrequest_remove(session) == TRUE) { - /* send offer to server */ - mrcp_client_session_offer_send(session); - } - } - else { - /* channel termination */ - mrcp_channel_t *channel = mrcp_client_channel_termination_find(session,mpf_message->termination); - if(channel && channel->waiting_for_termination == TRUE) { - channel->waiting_for_termination = FALSE; - if(mrcp_client_session_subrequest_remove(session) == TRUE) { - /* send offer to server */ - mrcp_client_session_offer_send(session); - } - } - } - return TRUE; -} - -static apt_bool_t mrcp_client_on_termination_modify(mrcp_client_session_t *session, const mpf_message_t *mpf_message) -{ - rtp_termination_slot_t *termination_slot; - apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Media Termination Modified "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - mpf_termination_name_get(mpf_message->termination)); - termination_slot = mrcp_client_rtp_termination_find(session,mpf_message->termination); - if(termination_slot) { - /* rtp termination */ - if(termination_slot->waiting == FALSE) { - return FALSE; - } - termination_slot->waiting = FALSE; - termination_slot->descriptor = mpf_message->descriptor;; - - if(mrcp_client_session_subrequest_remove(session) == TRUE) { - if(session->state == SESSION_STATE_GENERATING_OFFER) { - /* send offer to server */ - mrcp_client_session_offer_send(session); - } - else if(session->state == SESSION_STATE_PROCESSING_ANSWER) { - /* raise app response */ - mrcp_app_sig_response_raise(session,TRUE); - } - } - } - return TRUE; -} - -static apt_bool_t mrcp_client_on_termination_subtract(mrcp_client_session_t *session, const mpf_message_t *mpf_message) -{ - rtp_termination_slot_t *termination_slot; - apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Media Termination Subtracted "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - mpf_termination_name_get(mpf_message->termination)); - termination_slot = mrcp_client_rtp_termination_find(session,mpf_message->termination); - if(termination_slot) { - /* rtp termination */ - if(termination_slot->waiting == FALSE) { - return FALSE; - } - termination_slot->waiting = FALSE; - if(mrcp_client_session_subrequest_remove(session) == TRUE) { - mrcp_app_session_terminate_raise(session,MRCP_SIG_STATUS_CODE_SUCCESS); - } - } - else { - /* channel termination */ - mrcp_channel_t *channel = mrcp_client_channel_termination_find(session,mpf_message->termination); - if(channel && channel->waiting_for_termination == TRUE) { - channel->waiting_for_termination = FALSE; - if(mrcp_client_session_subrequest_remove(session) == TRUE) { - /* raise app response */ - mrcp_app_sig_response_raise(session,TRUE); - } - } - } - return TRUE; -} - -apt_bool_t mrcp_client_mpf_message_process(mpf_message_container_t *mpf_message_container) -{ - apr_size_t i; - mrcp_client_session_t *session; - const mpf_message_t *mpf_message; - for(i=0; icount; i++) { - mpf_message = &mpf_message_container->messages[i]; - if(mpf_message->context) { - session = mpf_engine_context_object_get(mpf_message->context); - } - else { - session = NULL; - } - if(!session) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Received MPF Message: NULL session"); - continue; - } - if(mpf_message->message_type == MPF_MESSAGE_TYPE_RESPONSE) { - switch(mpf_message->command_id) { - case MPF_ADD_TERMINATION: - mrcp_client_on_termination_add(session,mpf_message); - break; - case MPF_MODIFY_TERMINATION: - mrcp_client_on_termination_modify(session,mpf_message); - break; - case MPF_SUBTRACT_TERMINATION: - mrcp_client_on_termination_subtract(session,mpf_message); - break; - case MPF_ADD_ASSOCIATION: - case MPF_REMOVE_ASSOCIATION: - case MPF_RESET_ASSOCIATIONS: - case MPF_APPLY_TOPOLOGY: - case MPF_DESTROY_TOPOLOGY: - if(mrcp_client_session_subrequest_remove(session) == TRUE) { - if(session->state == SESSION_STATE_GENERATING_OFFER) { - /* send offer to server */ - mrcp_client_session_offer_send(session); - } - else if(session->state == SESSION_STATE_PROCESSING_ANSWER) { - /* raise app response */ - mrcp_app_sig_response_raise(session,TRUE); - } - } - break; - default: - break; - } - } - else if(mpf_message->message_type == MPF_MESSAGE_TYPE_EVENT) { - apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Process MPF Event "APT_NAMESID_FMT, - MRCP_SESSION_NAMESID(session)); - } - } - return TRUE; -} - -static apt_bool_t mrcp_client_resource_answer_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor) -{ - apt_bool_t status = TRUE; - if(session->offer->resource_state == TRUE) { - if(descriptor->resource_state == TRUE) { - mrcp_client_av_media_answer_process(session,descriptor); - } - else { - status = FALSE; - } - } - return status; -} - -static apt_bool_t mrcp_client_control_media_answer_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor) -{ - mrcp_channel_t *channel; - mrcp_control_descriptor_t *control_descriptor; - int i; - int count = session->channels->nelts; - if(count != descriptor->control_media_arr->nelts) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Number of control channels [%d] != Number of control media in answer [%d]", - count,descriptor->control_media_arr->nelts); - count = descriptor->control_media_arr->nelts; - } - - if(!session->base.id.length) { - /* initial answer received, store session id and add to session's table */ - control_descriptor = mrcp_session_control_media_get(descriptor,0); - if(control_descriptor) { - session->base.id = control_descriptor->session_id; - } - } - - /* update existing control channels */ - for(i=0; ichannels,i,mrcp_channel_t*); - if(!channel) continue; - - /* get control descriptor */ - control_descriptor = mrcp_session_control_media_get(descriptor,i); - /* modify channel */ - apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Modify Control Channel "APT_NAMESID_FMT, - MRCP_SESSION_NAMESID(session)); - if(mrcp_client_control_channel_modify(channel->control_channel,control_descriptor) == TRUE) { - channel->waiting_for_channel = TRUE; - mrcp_client_session_subrequest_add(session); - } - } - return TRUE; -} - -static apt_bool_t mrcp_client_av_media_answer_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor) -{ - rtp_termination_slot_t *slot; - int i; - int count = session->terminations->nelts; - if(count != descriptor->audio_media_arr->nelts) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Number of terminations [%d] != Number of audio media in answer [%d]", - count,descriptor->audio_media_arr->nelts); - count = descriptor->audio_media_arr->nelts; - } - - /* update existing terminations */ - for(i=0; iterminations,i,rtp_termination_slot_t); - remote_media = mrcp_session_audio_media_get(descriptor,i); - if(slot->descriptor) { - slot->descriptor->audio.remote = remote_media; - } - if(slot->termination) { - /* construct termination descriptor */ - rtp_descriptor = apr_palloc(session->base.pool,sizeof(mpf_rtp_termination_descriptor_t)); - mpf_rtp_termination_descriptor_init(rtp_descriptor); - rtp_descriptor->audio.local = NULL; - rtp_descriptor->audio.remote = remote_media; - - /* send modify termination request */ - apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Modify Media Termination "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - mpf_termination_name_get(slot->termination)); - if(mpf_engine_termination_message_add( - session->base.media_engine, - MPF_MODIFY_TERMINATION,session->context,slot->termination,rtp_descriptor, - &session->mpf_task_msg) == TRUE) { - slot->waiting = TRUE; - mrcp_client_session_subrequest_add(session); - } - if(slot->channel && slot->channel->termination) { - if(mpf_engine_assoc_message_add( - session->base.media_engine, - MPF_ADD_ASSOCIATION,session->context,slot->termination,slot->channel->termination, - &session->mpf_task_msg) == TRUE) { - mrcp_client_session_subrequest_add(session); - } - } - } - } - return TRUE; -} - -static apt_bool_t mrcp_app_request_dispatch(mrcp_client_session_t *session, const mrcp_app_message_t *app_message) -{ - if(session->state == SESSION_STATE_TERMINATING) { - /* no more requests are allowed, as session is being terminated! - just return, it is horribly wrong and can crash anytime here */ - apt_obj_log(APT_LOG_MARK,APT_PRIO_ERROR,session->base.log_obj,"Inappropriate Application Request "APT_NAMESID_FMT" [%d]", - MRCP_SESSION_NAMESID(session), - app_message->sig_message.command_id); - return FALSE; - } - - if(session->disconnected == TRUE) { - /* cancel all the requests besides session termination one */ - if(!IS_SESSION_TERMINATE(app_message)) { - apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,session->base.log_obj,"Cancel App Request "APT_NAMESID_FMT" [%d]", - MRCP_SESSION_NAMESID(session), app_message->sig_message.command_id); - session->status = MRCP_SIG_STATUS_CODE_CANCEL; - return mrcp_app_failure_message_raise(session); - } - } - - if(session->registered == FALSE) { - if(IS_SESSION_TERMINATE(app_message)) { - /* if session is not registered, nothing to terminate, just respond with success */ - session->status = MRCP_SIG_STATUS_CODE_SUCCESS; - return mrcp_app_sig_response_raise(session,FALSE); - } - - /* select signaling agent */ - session->base.signaling_agent = mrcp_sa_factory_agent_select(session->profile->sa_factory); - if(!session->base.signaling_agent) { - apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,session->base.log_obj,"Failed to Select Signaling Agent "APT_NAMESID_FMT" [%d]", - MRCP_SESSION_NAMESID(session), - app_message->sig_message.command_id); - session->status = MRCP_SIG_STATUS_CODE_FAILURE; - } - if(session->profile->mrcp_version == MRCP_VERSION_2) { - /* select connection agent */ - session->base.connection_agent = mrcp_ca_factory_agent_select(session->profile->ca_factory); - if(!session->base.connection_agent) { - apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,session->base.log_obj,"Failed to Select Connection Agent "APT_NAMESID_FMT" [%d]", - MRCP_SESSION_NAMESID(session), - app_message->sig_message.command_id); - session->status = MRCP_SIG_STATUS_CODE_FAILURE; - } - } - if(session->profile->mpf_factory) { - /* select media engine */ - session->base.media_engine = mpf_engine_factory_engine_select(session->profile->mpf_factory); - if(!session->base.media_engine) { - apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,session->base.log_obj,"Failed to Select Media Engine "APT_NAMESID_FMT" [%d]", - MRCP_SESSION_NAMESID(session), - app_message->sig_message.command_id); - session->status = MRCP_SIG_STATUS_CODE_FAILURE; - } - } - /* set rtp termination factory */ - session->base.rtp_factory = session->profile->rtp_termination_factory; - - if(session->status == MRCP_SIG_STATUS_CODE_FAILURE) { - /* raise app response in case of failure */ - return mrcp_app_failure_message_raise(session); - } - - if(session->base.signaling_agent->create_client_session(&session->base,session->profile->signaling_settings) != TRUE) { - /* raise app response */ - apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,session->base.log_obj,"Failed to Create Session "APT_NAMESID_FMT" [%d]", - MRCP_SESSION_NAMESID(session), - app_message->sig_message.command_id); - session->status = MRCP_SIG_STATUS_CODE_FAILURE; - return mrcp_app_failure_message_raise(session); - } - - mrcp_client_session_add(session->application->client,session); - session->registered = TRUE; - } - session->status = MRCP_SIG_STATUS_CODE_SUCCESS; - switch(app_message->message_type) { - case MRCP_APP_MESSAGE_TYPE_SIGNALING: - { - apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Dispatch App Request "APT_NAMESID_FMT" [%d]", - MRCP_SESSION_NAMESID(session), - app_message->sig_message.command_id); - switch(app_message->sig_message.command_id) { - case MRCP_SIG_COMMAND_SESSION_UPDATE: - mrcp_client_session_update(session); - break; - case MRCP_SIG_COMMAND_SESSION_TERMINATE: - mrcp_client_session_terminate(session); - break; - case MRCP_SIG_COMMAND_CHANNEL_ADD: - mrcp_client_channel_add(session,app_message->channel); - break; - case MRCP_SIG_COMMAND_CHANNEL_REMOVE: - mrcp_client_channel_modify(session,app_message->channel,FALSE); - break; - case MRCP_SIG_COMMAND_RESOURCE_DISCOVER: - mrcp_client_resource_discover(session); - break; - default: - break; - } - break; - } - case MRCP_APP_MESSAGE_TYPE_CONTROL: - { - mrcp_client_message_send(session,app_message->channel,app_message->control_message); - break; - } - } - return TRUE; -} diff --git a/libs/unimrcp/libs/mrcp-engine/Makefile.am b/libs/unimrcp/libs/mrcp-engine/Makefile.am deleted file mode 100644 index a67c910526..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/Makefile.am +++ /dev/null @@ -1,38 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -AM_CPPFLAGS = -I$(top_srcdir)/libs/mrcp-engine/include \ - -I$(top_srcdir)/libs/mrcp/include \ - -I$(top_srcdir)/libs/mrcp/message/include \ - -I$(top_srcdir)/libs/mrcp/control/include \ - -I$(top_srcdir)/libs/mrcp/resources/include \ - -I$(top_srcdir)/libs/mpf/include \ - -I$(top_srcdir)/libs/apr-toolkit/include \ - $(UNIMRCP_APR_INCLUDES) - -noinst_LTLIBRARIES = libmrcpengine.la - -include_HEADERS = include/mrcp_engine_types.h \ - include/mrcp_engine_plugin.h \ - include/mrcp_engine_iface.h \ - include/mrcp_engine_impl.h \ - include/mrcp_synth_engine.h \ - include/mrcp_recog_engine.h \ - include/mrcp_recorder_engine.h \ - include/mrcp_verifier_engine.h \ - include/mrcp_resource_engine.h \ - include/mrcp_engine_factory.h \ - include/mrcp_engine_loader.h \ - include/mrcp_state_machine.h \ - include/mrcp_synth_state_machine.h \ - include/mrcp_recog_state_machine.h \ - include/mrcp_recorder_state_machine.h \ - include/mrcp_verifier_state_machine.h - -libmrcpengine_la_SOURCES = src/mrcp_engine_iface.c \ - src/mrcp_engine_impl.c \ - src/mrcp_engine_factory.c \ - src/mrcp_engine_loader.c \ - src/mrcp_synth_state_machine.c \ - src/mrcp_recog_state_machine.c \ - src/mrcp_recorder_state_machine.c \ - src/mrcp_verifier_state_machine.c diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_factory.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_factory.h deleted file mode 100644 index d769a0a937..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_factory.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_engine_factory.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_ENGINE_FACTORY_H -#define MRCP_ENGINE_FACTORY_H - -/** - * @file mrcp_engine_factory.h - * @brief Factory of MRCP Engines - */ - -#include "mrcp_engine_iface.h" - -APT_BEGIN_EXTERN_C - -/** Opaque engine factory declaration */ -typedef struct mrcp_engine_factory_t mrcp_engine_factory_t; - -/** Create engine factory */ -MRCP_DECLARE(mrcp_engine_factory_t*) mrcp_engine_factory_create(apr_pool_t *pool); - -/** Destroy registered engines and the factory */ -MRCP_DECLARE(apt_bool_t) mrcp_engine_factory_destroy(mrcp_engine_factory_t *factory); - -/** Open registered engines */ -MRCP_DECLARE(apt_bool_t) mrcp_engine_factory_open(mrcp_engine_factory_t *factory); - -/** Close registered engines */ -MRCP_DECLARE(apt_bool_t) mrcp_engine_factory_close(mrcp_engine_factory_t *factory); - - -/** Register engine */ -MRCP_DECLARE(apt_bool_t) mrcp_engine_factory_engine_register(mrcp_engine_factory_t *factory, mrcp_engine_t *engine); - -/** Get engine by name */ -MRCP_DECLARE(mrcp_engine_t*) mrcp_engine_factory_engine_get(const mrcp_engine_factory_t *factory, const char *name); - -/** Find engine by resource identifier */ -MRCP_DECLARE(mrcp_engine_t*) mrcp_engine_factory_engine_find(const mrcp_engine_factory_t *factory, mrcp_resource_id resource_id); - -/** Start iterating over the engines in a factory */ -MRCP_DECLARE(apr_hash_index_t*) mrcp_engine_factory_engine_first(const mrcp_engine_factory_t *factory); - - -APT_END_EXTERN_C - -#endif /* MRCP_ENGINE_FACTORY_H */ diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_iface.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_iface.h deleted file mode 100644 index 2e70c80dec..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_iface.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_engine_iface.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_ENGINE_IFACE_H -#define MRCP_ENGINE_IFACE_H - -/** - * @file mrcp_engine_iface.h - * @brief MRCP Engine User Interface (typically user is an MRCP server) - */ - -#include "mrcp_engine_types.h" - -APT_BEGIN_EXTERN_C - -/** Destroy engine */ -apt_bool_t mrcp_engine_virtual_destroy(mrcp_engine_t *engine); - -/** Open engine */ -apt_bool_t mrcp_engine_virtual_open(mrcp_engine_t *engine); - -/** Response to open engine request */ -void mrcp_engine_on_open(mrcp_engine_t *engine, apt_bool_t status); - -/** Close engine */ -apt_bool_t mrcp_engine_virtual_close(mrcp_engine_t *engine); - -/** Response to close engine request */ -void mrcp_engine_on_close(mrcp_engine_t *engine); - - -/** Create engine channel */ -mrcp_engine_channel_t* mrcp_engine_channel_virtual_create(mrcp_engine_t *engine, mrcp_version_e mrcp_version, apr_pool_t *pool); - -/** Destroy engine channel */ -apt_bool_t mrcp_engine_channel_virtual_destroy(mrcp_engine_channel_t *channel); - -/** Open engine channel */ -static APR_INLINE apt_bool_t mrcp_engine_channel_virtual_open(mrcp_engine_channel_t *channel) -{ - if(channel->is_open == FALSE) { - channel->is_open = channel->method_vtable->open(channel); - return channel->is_open; - } - return FALSE; -} - -/** Close engine channel */ -static APR_INLINE apt_bool_t mrcp_engine_channel_virtual_close(mrcp_engine_channel_t *channel) -{ - if(channel->is_open == TRUE) { - channel->is_open = FALSE; - return channel->method_vtable->close(channel); - } - return FALSE; -} - -/** Process request */ -static APR_INLINE apt_bool_t mrcp_engine_channel_request_process(mrcp_engine_channel_t *channel, mrcp_message_t *message) -{ - return channel->method_vtable->process_request(channel,message); -} - -/** Allocate engine config */ -mrcp_engine_config_t* mrcp_engine_config_alloc(apr_pool_t *pool); - - -APT_END_EXTERN_C - -#endif /* MRCP_ENGINE_IFACE_H */ diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_impl.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_impl.h deleted file mode 100644 index 6900b6abe0..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_impl.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_engine_impl.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_ENGINE_IMPL_H -#define MRCP_ENGINE_IMPL_H - -/** - * @file mrcp_engine_impl.h - * @brief MRCP Engine Realization Interface (typically should be implemented in plugins) - */ - -#include "mrcp_engine_types.h" -#include "mpf_stream.h" - -APT_BEGIN_EXTERN_C - -/** Create engine */ -mrcp_engine_t* mrcp_engine_create( - mrcp_resource_id resource_id, - void *obj, - const mrcp_engine_method_vtable_t *vtable, - apr_pool_t *pool); - -/** Send engine open response */ -static APR_INLINE apt_bool_t mrcp_engine_open_respond(mrcp_engine_t *engine, apt_bool_t status) -{ - return engine->event_vtable->on_open(engine,status); -} - -/** Send engine close response */ -static APR_INLINE apt_bool_t mrcp_engine_close_respond(mrcp_engine_t *engine) -{ - return engine->event_vtable->on_close(engine); -} - - -/** Get engine config */ -const mrcp_engine_config_t* mrcp_engine_config_get(const mrcp_engine_t *engine); - -/** Get engine param by name */ -const char* mrcp_engine_param_get(const mrcp_engine_t *engine, const char *name); - - -/** Create engine channel */ -mrcp_engine_channel_t* mrcp_engine_channel_create( - mrcp_engine_t *engine, - const mrcp_engine_channel_method_vtable_t *method_vtable, - void *method_obj, - mpf_termination_t *termination, - apr_pool_t *pool); - -/** Create audio termination */ -mpf_termination_t* mrcp_engine_audio_termination_create( - void *obj, - const mpf_audio_stream_vtable_t *stream_vtable, - mpf_stream_capabilities_t *capabilities, - apr_pool_t *pool); - -/** Create engine channel and source media termination - * @deprecated @see mrcp_engine_channel_create() and mrcp_engine_audio_termination_create() - */ -mrcp_engine_channel_t* mrcp_engine_source_channel_create( - mrcp_engine_t *engine, - const mrcp_engine_channel_method_vtable_t *channel_vtable, - const mpf_audio_stream_vtable_t *stream_vtable, - void *method_obj, - mpf_codec_descriptor_t *codec_descriptor, - apr_pool_t *pool); - -/** Create engine channel and sink media termination - * @deprecated @see mrcp_engine_channel_create() and mrcp_engine_audio_termination_create() - */ -mrcp_engine_channel_t* mrcp_engine_sink_channel_create( - mrcp_engine_t *engine, - const mrcp_engine_channel_method_vtable_t *channel_vtable, - const mpf_audio_stream_vtable_t *stream_vtable, - void *method_obj, - mpf_codec_descriptor_t *codec_descriptor, - apr_pool_t *pool); - -/** Send channel open response */ -static APR_INLINE apt_bool_t mrcp_engine_channel_open_respond(mrcp_engine_channel_t *channel, apt_bool_t status) -{ - return channel->event_vtable->on_open(channel,status); -} - -/** Send channel close response */ -static APR_INLINE apt_bool_t mrcp_engine_channel_close_respond(mrcp_engine_channel_t *channel) -{ - return channel->event_vtable->on_close(channel); -} - -/** Send response/event message */ -static APR_INLINE apt_bool_t mrcp_engine_channel_message_send(mrcp_engine_channel_t *channel, mrcp_message_t *message) -{ - return channel->event_vtable->on_message(channel,message); -} - -/** Get channel identifier */ -static APR_INLINE const char* mrcp_engine_channel_id_get(mrcp_engine_channel_t *channel) -{ - return channel->id.buf; -} - -/** Get MRCP version channel is created in the scope of */ -static APR_INLINE mrcp_version_e mrcp_engine_channel_version_get(const mrcp_engine_channel_t *channel) -{ - return channel->mrcp_version; -} - -/** Get codec descriptor of the audio source stream */ -const mpf_codec_descriptor_t* mrcp_engine_source_stream_codec_get(const mrcp_engine_channel_t *channel); - -/** Get codec descriptor of the audio sink stream */ -const mpf_codec_descriptor_t* mrcp_engine_sink_stream_codec_get(const mrcp_engine_channel_t *channel); - - -APT_END_EXTERN_C - -#endif /* MRCP_ENGINE_IMPL_H */ diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_loader.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_loader.h deleted file mode 100644 index a408497266..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_loader.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_engine_loader.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_ENGINE_LOADER_H -#define MRCP_ENGINE_LOADER_H - -/** - * @file mrcp_engine_loader.h - * @brief Loader of plugins for MRCP engines - */ - -#include "mrcp_engine_iface.h" - -APT_BEGIN_EXTERN_C - -/** Opaque engine loader declaration */ -typedef struct mrcp_engine_loader_t mrcp_engine_loader_t; - -/** Create engine loader */ -MRCP_DECLARE(mrcp_engine_loader_t*) mrcp_engine_loader_create(apr_pool_t *pool); - -/** Destroy engine loader */ -MRCP_DECLARE(apt_bool_t) mrcp_engine_loader_destroy(mrcp_engine_loader_t *loader); - -/** Unload loaded plugins */ -MRCP_DECLARE(apt_bool_t) mrcp_engine_loader_plugins_unload(mrcp_engine_loader_t *loader); - - -/** Load engine plugin */ -MRCP_DECLARE(mrcp_engine_t*) mrcp_engine_loader_plugin_load( - mrcp_engine_loader_t *loader, - const char *id, - const char *path, - mrcp_engine_config_t *config); - - -APT_END_EXTERN_C - -#endif /* MRCP_ENGINE_LOADER_H */ diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_plugin.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_plugin.h deleted file mode 100644 index e9cdb6da9b..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_plugin.h +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_engine_plugin.h 2139 2014-07-07 05:06:19Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_ENGINE_PLUGIN_H -#define MRCP_ENGINE_PLUGIN_H - -/** - * @file mrcp_engine_plugin.h - * @brief MRCP Engine Plugin - */ - -#include "apr_version.h" -#include "apt_log.h" -#include "mrcp_engine_types.h" - -APT_BEGIN_EXTERN_C - -/** Let the plugin symbols be always exported as C functions */ -#ifdef __cplusplus -#define MRCP_PLUGIN_EXTERN_C extern "C" -#else -#define MRCP_PLUGIN_EXTERN_C extern -#endif - -/** Plugin export defines */ -#ifdef WIN32 -#define MRCP_PLUGIN_DECLARE(type) MRCP_PLUGIN_EXTERN_C __declspec(dllexport) type -#else -#define MRCP_PLUGIN_DECLARE(type) MRCP_PLUGIN_EXTERN_C type -#endif - -/** [REQUIRED] Symbol name of the main entry point in plugin DSO */ -#define MRCP_PLUGIN_ENGINE_SYM_NAME "mrcp_plugin_create" -/** [REQUIRED] Symbol name of the vesrion number entry point in plugin DSO */ -#define MRCP_PLUGIN_VERSION_SYM_NAME "mrcp_plugin_version" -/** [IMPLIED] Symbol name of the log accessor entry point in plugin DSO */ -#define MRCP_PLUGIN_LOGGER_SYM_NAME "mrcp_plugin_logger_set" - -/** Prototype of engine creator (entry point of plugin DSO) */ -typedef mrcp_engine_t* (*mrcp_plugin_creator_f)(apr_pool_t *pool); - -/** Prototype of log accessor (entry point of plugin DSO) */ -typedef apt_bool_t (*mrcp_plugin_log_accessor_f)(apt_logger_t *logger); - -/** Declare this macro in plugins to use log routine of the server */ -#define MRCP_PLUGIN_LOGGER_IMPLEMENT \ - MRCP_PLUGIN_DECLARE(apt_bool_t) mrcp_plugin_logger_set(apt_logger_t *logger) \ - { return apt_log_instance_set(logger); } - -/** Declare this macro in plugins to set plugin version */ -#define MRCP_PLUGIN_VERSION_DECLARE \ - MRCP_PLUGIN_DECLARE(mrcp_plugin_version_t) mrcp_plugin_version; \ - mrcp_plugin_version_t mrcp_plugin_version = \ - {PLUGIN_MAJOR_VERSION, PLUGIN_MINOR_VERSION, PLUGIN_PATCH_VERSION}; - - -/** major version - * Major API changes that could cause compatibility problems for older - * plugins such as structure size changes. No binary compatibility is - * possible across a change in the major version. - */ -#define PLUGIN_MAJOR_VERSION 1 - -/** minor version - * Minor API changes that do not cause binary compatibility problems. - * Reset to 0 when upgrading PLUGIN_MAJOR_VERSION - */ -#define PLUGIN_MINOR_VERSION 2 - -/** patch level - * The Patch Level never includes API changes, simply bug fixes. - * Reset to 0 when upgrading PLUGIN_MINOR_VERSION - */ -#define PLUGIN_PATCH_VERSION 0 - - -/** - * Check at compile time if the plugin version is at least a certain - * level. - */ -#define PLUGIN_VERSION_AT_LEAST(major,minor,patch) \ -(((major) < PLUGIN_MAJOR_VERSION) \ - || ((major) == PLUGIN_MAJOR_VERSION && (minor) < PLUGIN_MINOR_VERSION) \ - || ((major) == PLUGIN_MAJOR_VERSION && (minor) == PLUGIN_MINOR_VERSION && (patch) <= PLUGIN_PATCH_VERSION)) - -/** The formatted string of plugin's version */ -#define PLUGIN_VERSION_STRING \ - APR_STRINGIFY(PLUGIN_MAJOR_VERSION) "." \ - APR_STRINGIFY(PLUGIN_MINOR_VERSION) "." \ - APR_STRINGIFY(PLUGIN_PATCH_VERSION) - -/** Plugin version */ -typedef apr_version_t mrcp_plugin_version_t; - -/** Get plugin version */ -static APR_INLINE void mrcp_plugin_version_get(mrcp_plugin_version_t *version) -{ - version->major = PLUGIN_MAJOR_VERSION; - version->minor = PLUGIN_MINOR_VERSION; - version->patch = PLUGIN_PATCH_VERSION; -} - -/** Check plugin version */ -static APR_INLINE int mrcp_plugin_version_check(mrcp_plugin_version_t *version) -{ - return PLUGIN_VERSION_AT_LEAST(version->major,version->minor,version->patch); -} - -APT_END_EXTERN_C - -#endif /* MRCP_ENGINE_PLUGIN_H */ diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_types.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_types.h deleted file mode 100644 index ee2390c255..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_types.h +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_engine_types.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_ENGINE_TYPES_H -#define MRCP_ENGINE_TYPES_H - -/** - * @file mrcp_engine_types.h - * @brief MRCP Engine Types - */ - -#include -#include "mrcp_state_machine.h" -#include "mpf_types.h" -#include "apt_string.h" - -APT_BEGIN_EXTERN_C - -/** MRCP engine declaration */ -typedef struct mrcp_engine_t mrcp_engine_t; -/** MRCP engine config declaration */ -typedef struct mrcp_engine_config_t mrcp_engine_config_t; -/** MRCP engine vtable declaration */ -typedef struct mrcp_engine_method_vtable_t mrcp_engine_method_vtable_t; -/** MRCP engine event vtable declaration */ -typedef struct mrcp_engine_event_vtable_t mrcp_engine_event_vtable_t; -/** MRCP engine channel declaration */ -typedef struct mrcp_engine_channel_t mrcp_engine_channel_t; -/** MRCP engine channel virtual method table declaration */ -typedef struct mrcp_engine_channel_method_vtable_t mrcp_engine_channel_method_vtable_t; -/** MRCP engine channel virtual event table declaration */ -typedef struct mrcp_engine_channel_event_vtable_t mrcp_engine_channel_event_vtable_t; - -/** Table of channel virtual methods */ -struct mrcp_engine_channel_method_vtable_t { - /** Virtual destroy */ - apt_bool_t (*destroy)(mrcp_engine_channel_t *channel); - /** Virtual open */ - apt_bool_t (*open)(mrcp_engine_channel_t *channel); - /** Virtual close */ - apt_bool_t (*close)(mrcp_engine_channel_t *channel); - /** Virtual process_request */ - apt_bool_t (*process_request)(mrcp_engine_channel_t *channel, mrcp_message_t *request); -}; - -/** Table of channel virtual event handlers */ -struct mrcp_engine_channel_event_vtable_t { - /** Open event handler */ - apt_bool_t (*on_open)(mrcp_engine_channel_t *channel, apt_bool_t status); - /** Close event handler */ - apt_bool_t (*on_close)(mrcp_engine_channel_t *channel); - /** Message event handler */ - apt_bool_t (*on_message)(mrcp_engine_channel_t *channel, mrcp_message_t *message); -}; - -/** MRCP engine channel declaration */ -struct mrcp_engine_channel_t { - /** Table of virtual methods */ - const mrcp_engine_channel_method_vtable_t *method_vtable; - /** External object used with virtual methods */ - void *method_obj; - /** Table of virtual event handlers */ - const mrcp_engine_channel_event_vtable_t *event_vtable; - /** External object used with event handlers */ - void *event_obj; - /** Media termination */ - mpf_termination_t *termination; - /** Back pointer to engine */ - mrcp_engine_t *engine; - /** Unique identifier to be used in traces */ - apt_str_t id; - /** MRCP version */ - mrcp_version_e mrcp_version; - /** Is channel successfully opened */ - apt_bool_t is_open; - /** Pool to allocate memory from */ - apr_pool_t *pool; -}; - -/** Table of MRCP engine virtual methods */ -struct mrcp_engine_method_vtable_t { - /** Virtual destroy */ - apt_bool_t (*destroy)(mrcp_engine_t *engine); - /** Virtual open */ - apt_bool_t (*open)(mrcp_engine_t *engine); - /** Virtual close */ - apt_bool_t (*close)(mrcp_engine_t *engine); - /** Virtual channel create */ - mrcp_engine_channel_t* (*create_channel)(mrcp_engine_t *engine, apr_pool_t *pool); -}; - -/** Table of MRCP engine virtual event handlers */ -struct mrcp_engine_event_vtable_t { - /** Open event handler */ - apt_bool_t (*on_open)(mrcp_engine_t *channel, apt_bool_t status); - /** Close event handler */ - apt_bool_t (*on_close)(mrcp_engine_t *channel); -}; - -/** MRCP engine */ -struct mrcp_engine_t { - /** Identifier of the engine */ - const char *id; - /** Resource identifier */ - mrcp_resource_id resource_id; - /** External object associated with engine */ - void *obj; - /** Table of virtual methods */ - const mrcp_engine_method_vtable_t *method_vtable; - /** Table of virtual event handlers */ - const mrcp_engine_event_vtable_t *event_vtable; - /** External object used with event handlers */ - void *event_obj; - /** Codec manager */ - const mpf_codec_manager_t *codec_manager; - /** Dir layout structure */ - const apt_dir_layout_t *dir_layout; - /** Config of engine */ - mrcp_engine_config_t *config; - /** Number of simultaneous channels currently in use */ - apr_size_t cur_channel_count; - /** Is engine successfully opened */ - apt_bool_t is_open; - /** Pool to allocate memory from */ - apr_pool_t *pool; - - /** Create state machine */ - mrcp_state_machine_t* (*create_state_machine)(void *obj, mrcp_version_e version, apr_pool_t *pool); -}; - -/** MRCP engine config */ -struct mrcp_engine_config_t { - /** Max number of simultaneous channels */ - apr_size_t max_channel_count; - /** Table of name/value string params */ - apr_table_t *params; -}; - -APT_END_EXTERN_C - -#endif /* MRCP_ENGINE_TYPES_H */ diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_recog_engine.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_recog_engine.h deleted file mode 100644 index d9fce1bd97..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_recog_engine.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_recog_engine.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_RECOG_ENGINE_H -#define MRCP_RECOG_ENGINE_H - -/** - * @file mrcp_recog_engine.h - * @brief Recognizer Engine Includes - */ - -#include "mrcp_engine_plugin.h" -#include "mrcp_engine_impl.h" - -#include "mrcp_recog_resource.h" -#include "mrcp_recog_header.h" -#include "mrcp_generic_header.h" -#include "mrcp_message.h" - -#endif /* MRCP_RECOG_ENGINE_H */ diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_recog_state_machine.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_recog_state_machine.h deleted file mode 100644 index 9be07b6bec..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_recog_state_machine.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_recog_state_machine.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_RECOG_STATE_MACHINE_H -#define MRCP_RECOG_STATE_MACHINE_H - -/** - * @file mrcp_recog_state_machine.h - * @brief MRCP Recognizer State Machine - */ - -#include "mrcp_state_machine.h" - -APT_BEGIN_EXTERN_C - -/** Create MRCP recognizer state machine */ -mrcp_state_machine_t* mrcp_recog_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool); - -APT_END_EXTERN_C - -#endif /* MRCP_RECOG_STATE_MACHINE_H */ diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_recorder_engine.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_recorder_engine.h deleted file mode 100644 index 90fa022725..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_recorder_engine.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_recorder_engine.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_RECORDER_ENGINE_H -#define MRCP_RECORDER_ENGINE_H - -/** - * @file mrcp_recorder_engine.h - * @brief Recorder Engine Includes - */ - -#include "mrcp_engine_plugin.h" -#include "mrcp_engine_impl.h" - -#include "mrcp_recorder_resource.h" -#include "mrcp_recorder_header.h" -#include "mrcp_generic_header.h" -#include "mrcp_message.h" - -#endif /* MRCP_RECORDER_ENGINE_H */ diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_recorder_state_machine.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_recorder_state_machine.h deleted file mode 100644 index 242440a42f..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_recorder_state_machine.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_recorder_state_machine.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_RECORDER_STATE_MACHINE_H -#define MRCP_RECORDER_STATE_MACHINE_H - -/** - * @file mrcp_recorder_state_machine.h - * @brief MRCP Recorder State Machine - */ - -#include "mrcp_state_machine.h" - -APT_BEGIN_EXTERN_C - -/** Create MRCP recorder state machine */ -mrcp_state_machine_t* mrcp_recorder_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool); - -APT_END_EXTERN_C - -#endif /* MRCP_RECORDER_STATE_MACHINE_H */ diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_resource_engine.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_resource_engine.h deleted file mode 100644 index 3743af9ab0..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_resource_engine.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_resource_engine.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_RESOURCE_ENGINE_H -#define MRCP_RESOURCE_ENGINE_H - -/** - * @file mrcp_resource_engine.h - * @brief Legacy MRCP Resource Engine - * @deprecated @see mrcp_engine_plugin.h and mrcp_engine_impl.h - */ - -#include "mrcp_engine_plugin.h" -#include "mrcp_engine_impl.h" - -APT_BEGIN_EXTERN_C - -/** Termorary define legacy mrcp_resource_engine_t as mrcp_engine_t */ -typedef mrcp_engine_t mrcp_resource_engine_t; - -/** - * Create resource engine - * @deprecated @see mrcp_engine_create - */ -static APR_INLINE mrcp_engine_t* mrcp_resource_engine_create( - mrcp_resource_id resource_id, - void *obj, - const mrcp_engine_method_vtable_t *vtable, - apr_pool_t *pool) -{ - return mrcp_engine_create(resource_id,obj,vtable,pool); -} - -APT_END_EXTERN_C - -#endif /* MRCP_RESOURCE_ENGINE_H */ diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_state_machine.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_state_machine.h deleted file mode 100644 index acec6fa8bc..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_state_machine.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_state_machine.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_STATE_MACHINE_H -#define MRCP_STATE_MACHINE_H - -/** - * @file mrcp_state_machine.h - * @brief MRCP State Machine - */ - -#include "mrcp_types.h" - -APT_BEGIN_EXTERN_C - -/** MRCP state machine declaration */ -typedef struct mrcp_state_machine_t mrcp_state_machine_t; - - -/** MRCP state machine */ -struct mrcp_state_machine_t { - /** External object associated with state machine */ - void *obj; - /** State either active or deactivating */ - apt_bool_t active; - - /** Virtual update */ - apt_bool_t (*update)(mrcp_state_machine_t *state_machine, mrcp_message_t *message); - /** Deactivate */ - apt_bool_t (*deactivate)(mrcp_state_machine_t *state_machine); - - - /** Message dispatcher */ - apt_bool_t (*on_dispatch)(mrcp_state_machine_t *state_machine, mrcp_message_t *message); - /** Deactivated */ - apt_bool_t (*on_deactivate)(mrcp_state_machine_t *state_machine); -}; - -/** Initialize MRCP state machine */ -static APR_INLINE void mrcp_state_machine_init(mrcp_state_machine_t *state_machine, void *obj) -{ - state_machine->obj = obj; - state_machine->active = TRUE; - state_machine->on_dispatch = NULL; - state_machine->on_deactivate = NULL; - state_machine->update = NULL; - state_machine->deactivate = NULL; -} - -/** Update MRCP state machine */ -static APR_INLINE apt_bool_t mrcp_state_machine_update(mrcp_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(state_machine->update) { - return state_machine->update(state_machine,message); - } - return FALSE; -} - -/** Deactivate MRCP state machine */ -static APR_INLINE apt_bool_t mrcp_state_machine_deactivate(mrcp_state_machine_t *state_machine) -{ - if(state_machine->deactivate) { - state_machine->active = FALSE; - return state_machine->deactivate(state_machine); - } - return FALSE; -} - -APT_END_EXTERN_C - -#endif /* MRCP_STATE_MACHINE_H */ diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_synth_engine.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_synth_engine.h deleted file mode 100644 index 0536ef4b4b..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_synth_engine.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_synth_engine.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_SYNTH_ENGINE_H -#define MRCP_SYNTH_ENGINE_H - -/** - * @file mrcp_synth_engine.h - * @brief Synthesizer Engine Includes - */ - -#include "mrcp_engine_plugin.h" -#include "mrcp_engine_impl.h" - -#include "mrcp_synth_resource.h" -#include "mrcp_synth_header.h" -#include "mrcp_generic_header.h" -#include "mrcp_message.h" - -#endif /* MRCP_SYNTH_ENGINE_H */ diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_synth_state_machine.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_synth_state_machine.h deleted file mode 100644 index 2ddc1ac069..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_synth_state_machine.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_synth_state_machine.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_SYNTH_STATE_MACHINE_H -#define MRCP_SYNTH_STATE_MACHINE_H - -/** - * @file mrcp_synth_state_machine.h - * @brief MRCP Synthesizer State Machine - */ - -#include "mrcp_state_machine.h" - -APT_BEGIN_EXTERN_C - -/** Create MRCP synthesizer state machine */ -mrcp_state_machine_t* mrcp_synth_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool); - -APT_END_EXTERN_C - -#endif /* MRCP_SYNTH_STATE_MACHINE_H */ diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_verifier_engine.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_verifier_engine.h deleted file mode 100644 index e741209c27..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_verifier_engine.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_verifier_engine.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_VERIFIER_ENGINE_H -#define MRCP_VERIFIER_ENGINE_H - -/** - * @file mrcp_verifier_engine.h - * @brief Verifier Engine Includes - */ - -#include "mrcp_engine_plugin.h" -#include "mrcp_engine_impl.h" - -#include "mrcp_verifier_resource.h" -#include "mrcp_verifier_header.h" -#include "mrcp_generic_header.h" -#include "mrcp_message.h" - -#endif /* MRCP_VERIFIER_ENGINE_H */ diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_verifier_state_machine.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_verifier_state_machine.h deleted file mode 100644 index a4b320a87d..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_verifier_state_machine.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_verifier_state_machine.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_VERIFIER_STATE_MACHINE_H -#define MRCP_VERIFIER_STATE_MACHINE_H - -/** - * @file mrcp_verifier_state_machine.h - * @brief MRCP Verifier State Machine - */ - -#include "mrcp_state_machine.h" - -APT_BEGIN_EXTERN_C - -/** Create MRCP verifier state machine */ -mrcp_state_machine_t* mrcp_verifier_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool); - -APT_END_EXTERN_C - -#endif /* MRCP_VERIFIER_STATE_MACHINE_H */ diff --git a/libs/unimrcp/libs/mrcp-engine/mrcpengine.vcproj b/libs/unimrcp/libs/mrcp-engine/mrcpengine.vcproj deleted file mode 100644 index 8966705a4e..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/mrcpengine.vcproj +++ /dev/null @@ -1,348 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/libs/mrcp-engine/mrcpengine.vcxproj b/libs/unimrcp/libs/mrcp-engine/mrcpengine.vcxproj deleted file mode 100644 index 1288995027..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/mrcpengine.vcxproj +++ /dev/null @@ -1,142 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C} - mrcpengine - Win32Proj - - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - X64 - - - ProgramDatabase - - - - - X64 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {b5a00bfa-6083-4fae-a097-71642d6473b5} - false - - - {1c320193-46a6-4b34-9c56-8ab584fc1b56} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp-engine/mrcpengine.vcxproj.filters b/libs/unimrcp/libs/mrcp-engine/mrcpengine.vcxproj.filters deleted file mode 100644 index 33be90e794..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/mrcpengine.vcxproj.filters +++ /dev/null @@ -1,89 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {dd062ad2-9a06-4efc-8e17-328567b52854} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_factory.c b/libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_factory.c deleted file mode 100644 index 5c20286fff..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_factory.c +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_engine_factory.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include "mrcp_engine_factory.h" -#include "mrcp_synth_state_machine.h" -#include "mrcp_recog_state_machine.h" -#include "mrcp_recorder_state_machine.h" -#include "mrcp_verifier_state_machine.h" -#include "apt_log.h" - -/** Engine factory declaration */ -struct mrcp_engine_factory_t { - apr_hash_t *engines; - apr_pool_t *pool; -}; - - -MRCP_DECLARE(mrcp_engine_factory_t*) mrcp_engine_factory_create(apr_pool_t *pool) -{ - mrcp_engine_factory_t *factory = apr_palloc(pool,sizeof(mrcp_engine_factory_t)); - factory->pool = pool; - factory->engines = apr_hash_make(pool); - return factory; -} - -/** Destroy registered engines and the factory */ -MRCP_DECLARE(apt_bool_t) mrcp_engine_factory_destroy(mrcp_engine_factory_t *factory) -{ - mrcp_engine_t *engine; - apr_hash_index_t *it; - void *val; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Destroy MRCP Engines"); - it=apr_hash_first(factory->pool,factory->engines); - for(; it; it = apr_hash_next(it)) { - apr_hash_this(it,NULL,NULL,&val); - engine = val; - if(engine) { - mrcp_engine_virtual_destroy(engine); - } - } - apr_hash_clear(factory->engines); - return TRUE; -} - -/** Open registered engines */ -MRCP_DECLARE(apt_bool_t) mrcp_engine_factory_open(mrcp_engine_factory_t *factory) -{ - mrcp_engine_t *engine; - apr_hash_index_t *it; - void *val; - it = apr_hash_first(factory->pool,factory->engines); - for(; it; it = apr_hash_next(it)) { - apr_hash_this(it,NULL,NULL,&val); - engine = val; - if(engine) { - mrcp_engine_virtual_open(engine); - } - } - return TRUE; -} - -/** Close registered engines */ -MRCP_DECLARE(apt_bool_t) mrcp_engine_factory_close(mrcp_engine_factory_t *factory) -{ - mrcp_engine_t *engine; - apr_hash_index_t *it; - void *val; - it=apr_hash_first(factory->pool,factory->engines); - for(; it; it = apr_hash_next(it)) { - apr_hash_this(it,NULL,NULL,&val); - engine = val; - if(engine) { - mrcp_engine_virtual_close(engine); - } - } - return TRUE; -} - -/** Register new engine */ -MRCP_DECLARE(apt_bool_t) mrcp_engine_factory_engine_register(mrcp_engine_factory_t *factory, mrcp_engine_t *engine) -{ - if(!engine || !engine->id) { - return FALSE; - } - - switch(engine->resource_id) { - case MRCP_SYNTHESIZER_RESOURCE: - engine->create_state_machine = mrcp_synth_state_machine_create; - break; - case MRCP_RECOGNIZER_RESOURCE: - engine->create_state_machine = mrcp_recog_state_machine_create; - break; - case MRCP_RECORDER_RESOURCE: - engine->create_state_machine = mrcp_recorder_state_machine_create; - break; - case MRCP_VERIFIER_RESOURCE: - engine->create_state_machine = mrcp_verifier_state_machine_create; - break; - default: - break; - } - - if(!engine->create_state_machine) { - return FALSE; - } - - apr_hash_set(factory->engines,engine->id,APR_HASH_KEY_STRING,engine); - return TRUE; -} - -/** Get engine by name */ -MRCP_DECLARE(mrcp_engine_t*) mrcp_engine_factory_engine_get(const mrcp_engine_factory_t *factory, const char *name) -{ - if(!name) { - return NULL; - } - return apr_hash_get(factory->engines,name,APR_HASH_KEY_STRING); -} - -/** Find engine by resource identifier */ -MRCP_DECLARE(mrcp_engine_t*) mrcp_engine_factory_engine_find(const mrcp_engine_factory_t *factory, mrcp_resource_id resource_id) -{ - mrcp_engine_t *engine; - void *val; - apr_hash_index_t *it = apr_hash_first(factory->pool,factory->engines); - /* walk through the engines */ - for(; it; it = apr_hash_next(it)) { - apr_hash_this(it,NULL,NULL,&val); - engine = val; - if(engine && engine->resource_id == resource_id) { - return engine; - } - } - return NULL; -} - -/** Start iterating over the engines in a factory */ -MRCP_DECLARE(apr_hash_index_t*) mrcp_engine_factory_engine_first(const mrcp_engine_factory_t *factory) -{ - return apr_hash_first(factory->pool,factory->engines); -} diff --git a/libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_iface.c b/libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_iface.c deleted file mode 100644 index daea6039c8..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_iface.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_engine_iface.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mrcp_engine_iface.h" -#include "apt_log.h" - -/** Destroy engine */ -apt_bool_t mrcp_engine_virtual_destroy(mrcp_engine_t *engine) -{ - return engine->method_vtable->destroy(engine); -} - -/** Open engine */ -apt_bool_t mrcp_engine_virtual_open(mrcp_engine_t *engine) -{ - if(engine->is_open == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Open Engine [%s]",engine->id); - return engine->method_vtable->open(engine); - } - return FALSE; -} - -/** Response to open engine request */ -void mrcp_engine_on_open(mrcp_engine_t *engine, apt_bool_t status) -{ - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Engine Opened [%s] status [%s]", - engine->id, - status == TRUE ? "success" : "failure"); - engine->is_open = status; -} - -/** Close engine */ -apt_bool_t mrcp_engine_virtual_close(mrcp_engine_t *engine) -{ - if(engine->is_open == TRUE) { - engine->is_open = FALSE; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Close Engine [%s]",engine->id); - return engine->method_vtable->close(engine); - } - return FALSE; -} - -/** Response to close engine request */ -void mrcp_engine_on_close(mrcp_engine_t *engine) -{ - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Engine Closed [%s]",engine->id); - engine->is_open = FALSE; -} - -/** Create engine channel */ -mrcp_engine_channel_t* mrcp_engine_channel_virtual_create(mrcp_engine_t *engine, mrcp_version_e mrcp_version, apr_pool_t *pool) -{ - mrcp_engine_channel_t *channel; - if(engine->is_open != TRUE) { - return NULL; - } - if(engine->config->max_channel_count && engine->cur_channel_count >= engine->config->max_channel_count) { - apt_log(APT_LOG_MARK, APT_PRIO_NOTICE, "Maximum channel count %"APR_SIZE_T_FMT" exceeded for engine [%s]", - engine->config->max_channel_count, engine->id); - return NULL; - } - channel = engine->method_vtable->create_channel(engine,pool); - if(channel) { - channel->mrcp_version = mrcp_version; - engine->cur_channel_count++; - } - return channel; -} - -/** Destroy engine channel */ -apt_bool_t mrcp_engine_channel_virtual_destroy(mrcp_engine_channel_t *channel) -{ - mrcp_engine_t *engine = channel->engine; - if(engine->cur_channel_count) { - engine->cur_channel_count--; - } - return channel->method_vtable->destroy(channel); -} - -/** Allocate engine config */ -mrcp_engine_config_t* mrcp_engine_config_alloc(apr_pool_t *pool) -{ - mrcp_engine_config_t *config = apr_palloc(pool,sizeof(mrcp_engine_config_t)); - config->max_channel_count = 0; - config->params = NULL; - return config; -} diff --git a/libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_impl.c b/libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_impl.c deleted file mode 100644 index 2e536e18b4..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_impl.c +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_engine_impl.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mrcp_engine_impl.h" -#include "mpf_termination_factory.h" - -/** Create engine */ -mrcp_engine_t* mrcp_engine_create( - mrcp_resource_id resource_id, - void *obj, - const mrcp_engine_method_vtable_t *vtable, - apr_pool_t *pool) -{ - mrcp_engine_t *engine = apr_palloc(pool,sizeof(mrcp_engine_t)); - engine->id = NULL; - engine->resource_id = resource_id; - engine->obj = obj; - engine->method_vtable =vtable; - engine->event_vtable = NULL; - engine->event_obj = NULL; - engine->config = NULL; - engine->codec_manager = NULL; - engine->dir_layout = NULL; - engine->cur_channel_count = 0; - engine->is_open = FALSE; - engine->pool = pool; - engine->create_state_machine = NULL; - return engine; -} - -/** Get engine config */ -const mrcp_engine_config_t* mrcp_engine_config_get(const mrcp_engine_t *engine) -{ - return engine->config; -} - -/** Get engine param by name */ -const char* mrcp_engine_param_get(const mrcp_engine_t *engine, const char *name) -{ - if(!engine->config || !engine->config->params) { - return NULL; - } - return apr_table_get(engine->config->params,name); -} - -/** Create engine channel */ -mrcp_engine_channel_t* mrcp_engine_channel_create( - mrcp_engine_t *engine, - const mrcp_engine_channel_method_vtable_t *method_vtable, - void *method_obj, - mpf_termination_t *termination, - apr_pool_t *pool) -{ - mrcp_engine_channel_t *channel = apr_palloc(pool,sizeof(mrcp_engine_channel_t)); - channel->method_vtable = method_vtable; - channel->method_obj = method_obj; - channel->event_vtable = NULL; - channel->event_obj = NULL; - channel->termination = termination; - channel->engine = engine; - channel->is_open = FALSE; - channel->pool = pool; - apt_string_reset(&channel->id); - return channel; -} - -/** Create audio termination */ -mpf_termination_t* mrcp_engine_audio_termination_create( - void *obj, - const mpf_audio_stream_vtable_t *stream_vtable, - mpf_stream_capabilities_t *capabilities, - apr_pool_t *pool) -{ - mpf_audio_stream_t *audio_stream; - if(!capabilities) { - return NULL; - } - - if(mpf_codec_capabilities_validate(&capabilities->codecs) == FALSE) { - return NULL; - } - - /* create audio stream */ - audio_stream = mpf_audio_stream_create( - obj, /* object to associate */ - stream_vtable, /* virtual methods table of audio stream */ - capabilities, /* stream capabilities */ - pool); /* pool to allocate memory from */ - - if(!audio_stream) { - return NULL; - } - - /* create media termination */ - return mpf_raw_termination_create( - NULL, /* no object to associate */ - audio_stream, /* audio stream */ - NULL, /* no video stream */ - pool); /* pool to allocate memory from */ -} - - -/** Create engine channel and source media termination */ -mrcp_engine_channel_t* mrcp_engine_source_channel_create( - mrcp_engine_t *engine, - const mrcp_engine_channel_method_vtable_t *channel_vtable, - const mpf_audio_stream_vtable_t *stream_vtable, - void *method_obj, - mpf_codec_descriptor_t *codec_descriptor, - apr_pool_t *pool) -{ - mpf_stream_capabilities_t *capabilities; - mpf_audio_stream_t *audio_stream; - mpf_termination_t *termination; - - capabilities = mpf_source_stream_capabilities_create(pool); - if(codec_descriptor) { - mpf_codec_capabilities_add( - &capabilities->codecs, - mpf_sample_rate_mask_get(codec_descriptor->sampling_rate), - codec_descriptor->name.buf); - } - else { - mpf_codec_default_capabilities_add(&capabilities->codecs); - } - - /* create audio stream */ - audio_stream = mpf_audio_stream_create( - method_obj, /* object to associate */ - stream_vtable, /* virtual methods table of audio stream */ - capabilities, /* stream capabilities */ - pool); /* pool to allocate memory from */ - - if(!audio_stream) { - return NULL; - } - - audio_stream->rx_descriptor = codec_descriptor; - - /* create media termination */ - termination = mpf_raw_termination_create( - NULL, /* no object to associate */ - audio_stream, /* audio stream */ - NULL, /* no video stream */ - pool); /* pool to allocate memory from */ - - /* create engine channel base */ - return mrcp_engine_channel_create( - engine, /* engine */ - channel_vtable, /* virtual methods table of engine channel */ - method_obj, /* object to associate */ - termination, /* media termination, used to terminate audio stream */ - pool); /* pool to allocate memory from */ -} - -/** Create engine channel and sink media termination */ -mrcp_engine_channel_t* mrcp_engine_sink_channel_create( - mrcp_engine_t *engine, - const mrcp_engine_channel_method_vtable_t *channel_vtable, - const mpf_audio_stream_vtable_t *stream_vtable, - void *method_obj, - mpf_codec_descriptor_t *codec_descriptor, - apr_pool_t *pool) -{ - mpf_stream_capabilities_t *capabilities; - mpf_audio_stream_t *audio_stream; - mpf_termination_t *termination; - - capabilities = mpf_sink_stream_capabilities_create(pool); - if(codec_descriptor) { - mpf_codec_capabilities_add( - &capabilities->codecs, - mpf_sample_rate_mask_get(codec_descriptor->sampling_rate), - codec_descriptor->name.buf); - } - else { - mpf_codec_default_capabilities_add(&capabilities->codecs); - } - - /* create audio stream */ - audio_stream = mpf_audio_stream_create( - method_obj, /* object to associate */ - stream_vtable, /* virtual methods table of audio stream */ - capabilities, /* stream capabilities */ - pool); /* pool to allocate memory from */ - - if(!audio_stream) { - return NULL; - } - - audio_stream->tx_descriptor = codec_descriptor; - - /* create media termination */ - termination = mpf_raw_termination_create( - NULL, /* no object to associate */ - audio_stream, /* audio stream */ - NULL, /* no video stream */ - pool); /* pool to allocate memory from */ - - /* create engine channel base */ - return mrcp_engine_channel_create( - engine, /* engine */ - channel_vtable, /* virtual methods table of engine channel */ - method_obj, /* object to associate */ - termination, /* media termination, used to terminate audio stream */ - pool); /* pool to allocate memory from */ -} - -/** Get codec descriptor of the audio source stream */ -const mpf_codec_descriptor_t* mrcp_engine_source_stream_codec_get(const mrcp_engine_channel_t *channel) -{ - if(channel && channel->termination) { - mpf_audio_stream_t *audio_stream = mpf_termination_audio_stream_get(channel->termination); - if(audio_stream) { - return audio_stream->rx_descriptor; - } - } - return NULL; -} - -/** Get codec descriptor of the audio sink stream */ -const mpf_codec_descriptor_t* mrcp_engine_sink_stream_codec_get(const mrcp_engine_channel_t *channel) -{ - if(channel && channel->termination) { - mpf_audio_stream_t *audio_stream = mpf_termination_audio_stream_get(channel->termination); - if(audio_stream) { - return audio_stream->tx_descriptor; - } - } - return NULL; -} diff --git a/libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_loader.c b/libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_loader.c deleted file mode 100644 index 45996cce7e..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_loader.c +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_engine_loader.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include -#include "mrcp_engine_loader.h" -#include "mrcp_engine_plugin.h" -#include "apt_log.h" - -/** Engine loader declaration */ -struct mrcp_engine_loader_t { - /** Table of plugins (apr_dso_handle_t*) */ - apr_hash_t *plugins; - apr_pool_t *pool; -}; - - -/** Create engine loader */ -MRCP_DECLARE(mrcp_engine_loader_t*) mrcp_engine_loader_create(apr_pool_t *pool) -{ - mrcp_engine_loader_t *loader = apr_palloc(pool,sizeof(mrcp_engine_loader_t)); - loader->pool = pool; - loader->plugins = apr_hash_make(pool); - return loader; -} - -/** Destroy engine loader */ -MRCP_DECLARE(apt_bool_t) mrcp_engine_loader_destroy(mrcp_engine_loader_t *loader) -{ - return mrcp_engine_loader_plugins_unload(loader); -} - -/** Unload loaded plugins */ -MRCP_DECLARE(apt_bool_t) mrcp_engine_loader_plugins_unload(mrcp_engine_loader_t *loader) -{ - apr_hash_index_t *it; - void *val; - apr_dso_handle_t *plugin; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Unload Plugins"); - it=apr_hash_first(loader->pool,loader->plugins); - for(; it; it = apr_hash_next(it)) { - apr_hash_this(it,NULL,NULL,&val); - plugin = val; - if(plugin) { - apr_dso_unload(plugin); - } - } - apr_hash_clear(loader->plugins); - return TRUE; -} - -static apt_bool_t plugin_version_load(apr_dso_handle_t *plugin) -{ - apr_dso_handle_sym_t version_handle = NULL; - if(apr_dso_sym(&version_handle,plugin,MRCP_PLUGIN_VERSION_SYM_NAME) != APR_SUCCESS) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Version Info Found: %s", MRCP_PLUGIN_VERSION_SYM_NAME); - return FALSE; - } - - if(version_handle) { - mrcp_plugin_version_t *version = (mrcp_plugin_version_t*)version_handle; - if(mrcp_plugin_version_check(version)) { - return TRUE; - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Incompatible Plugin Version Found [%d.%d.%d] < ["PLUGIN_VERSION_STRING"]", - version->major, - version->minor, - version->patch); - } - } - return FALSE; -} - -static mrcp_plugin_creator_f plugin_creator_load(apr_dso_handle_t *plugin) -{ - apr_dso_handle_sym_t func_handle = NULL; - mrcp_plugin_creator_f plugin_creator = NULL; - - if(apr_dso_sym(&func_handle,plugin,MRCP_PLUGIN_ENGINE_SYM_NAME) == APR_SUCCESS) { - if(func_handle) { - plugin_creator = (mrcp_plugin_creator_f)(intptr_t)func_handle; - } - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Load DSO Symbol: "MRCP_PLUGIN_ENGINE_SYM_NAME); - return NULL; - } - - return plugin_creator; -} - -static apt_bool_t plugin_logger_load(apr_dso_handle_t *plugin) -{ - apr_dso_handle_sym_t func_handle = NULL; - if(apr_dso_sym(&func_handle,plugin,MRCP_PLUGIN_LOGGER_SYM_NAME) != APR_SUCCESS) { - return FALSE; - } - - if(func_handle) { - apt_logger_t *logger = apt_log_instance_get(); - mrcp_plugin_log_accessor_f log_accessor; - log_accessor = (mrcp_plugin_log_accessor_f)(intptr_t)func_handle; - log_accessor(logger); - } - return TRUE; -} - - -/** Load engine plugin */ -MRCP_DECLARE(mrcp_engine_t*) mrcp_engine_loader_plugin_load(mrcp_engine_loader_t *loader, const char *id, const char *path, mrcp_engine_config_t *config) -{ - apr_dso_handle_t *plugin = NULL; - mrcp_plugin_creator_f plugin_creator = NULL; - mrcp_engine_t *engine = NULL; - if(!path || !id) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Load Plugin: invalid params"); - return NULL; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Load Plugin [%s] [%s]",id,path); - if(apr_dso_load(&plugin,path,loader->pool) != APR_SUCCESS) { - char derr[512] = ""; - apr_dso_error(plugin,derr,sizeof(derr)); - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Load DSO: %s", derr); - return NULL; - } - - if(plugin_version_load(plugin) != TRUE) { - apr_dso_unload(plugin); - return NULL; - } - - plugin_creator = plugin_creator_load(plugin); - if(!plugin_creator) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Entry Point Found for Plugin"); - apr_dso_unload(plugin); - return NULL; - } - - plugin_logger_load(plugin); - - apr_hash_set(loader->plugins,id,APR_HASH_KEY_STRING,plugin); - - engine = plugin_creator(loader->pool); - if(!engine) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create MRCP Engine"); - return NULL; - } - - engine->id = id; - engine->config = config; - return engine; -} diff --git a/libs/unimrcp/libs/mrcp-engine/src/mrcp_recog_state_machine.c b/libs/unimrcp/libs/mrcp-engine/src/mrcp_recog_state_machine.c deleted file mode 100644 index f205d2ea78..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/src/mrcp_recog_state_machine.c +++ /dev/null @@ -1,553 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_recog_state_machine.c 2228 2014-11-12 01:18:27Z achaloyan@gmail.com $ - */ - -#include "apt_obj_list.h" -#include "apt_log.h" -#include "mrcp_state_machine.h" -#include "mrcp_recog_state_machine.h" -#include "mrcp_recog_header.h" -#include "mrcp_generic_header.h" -#include "mrcp_recog_resource.h" -#include "mrcp_message.h" - -/** MRCP recognizer states */ -typedef enum { - RECOGNIZER_STATE_IDLE, - RECOGNIZER_STATE_RECOGNIZING, - RECOGNIZER_STATE_RECOGNIZED, - - RECOGNIZER_STATE_COUNT -} mrcp_recog_state_e; - -static const char * state_names[RECOGNIZER_STATE_COUNT] = { - "IDLE", - "RECOGNIZING", - "RECOGNIZED" -}; - -typedef struct mrcp_recog_state_machine_t mrcp_recog_state_machine_t; -struct mrcp_recog_state_machine_t { - /** state machine base */ - mrcp_state_machine_t base; - /** recognizer state */ - mrcp_recog_state_e state; - /** indicate whether active_request was processed from pending request queue */ - apt_bool_t is_pending; - /** request sent to recognition engine and waiting for the response to be received */ - mrcp_message_t *active_request; - /** in-progress recognize request */ - mrcp_message_t *recog; - /** queue of pending recognition requests */ - apt_obj_list_t *queue; - /** properties used in set/get params */ - mrcp_message_header_t *properties; -}; - -typedef apt_bool_t (*recog_method_f)(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message); - -static APR_INLINE apt_bool_t recog_request_dispatch(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - state_machine->active_request = message; - return state_machine->base.on_dispatch(&state_machine->base,message); -} - -static APR_INLINE apt_bool_t recog_response_dispatch(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - state_machine->active_request = NULL; - if(state_machine->base.active == FALSE) { - /* this is the response to deactivation (STOP) request */ - return state_machine->base.on_deactivate(&state_machine->base); - } - return state_machine->base.on_dispatch(&state_machine->base,message); -} - -static APR_INLINE apt_bool_t recog_event_dispatch(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(state_machine->base.active == FALSE) { - /* do nothing, state machine has already been deactivated */ - return FALSE; - } - return state_machine->base.on_dispatch(&state_machine->base,message); -} - -static APR_INLINE void recog_state_change(mrcp_recog_state_machine_t *state_machine, mrcp_recog_state_e state, mrcp_message_t *message) -{ - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"State Transition %s -> %s "APT_SIDRES_FMT, - state_names[state_machine->state], - state_names[state], - MRCP_MESSAGE_SIDRES(message)); - state_machine->state = state; - if(state == RECOGNIZER_STATE_IDLE) { - state_machine->recog = NULL; - } -} - - -static apt_bool_t recog_request_set_params(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_header_fields_set(state_machine->properties,&message->header,message->pool); - return recog_request_dispatch(state_machine,message); -} - -static apt_bool_t recog_response_set_params(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - return recog_response_dispatch(state_machine,message); -} - -static apt_bool_t recog_request_get_params(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - return recog_request_dispatch(state_machine,message); -} - -static apt_bool_t recog_response_get_params(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_header_fields_get(&message->header,state_machine->properties,&state_machine->active_request->header,message->pool); - return recog_response_dispatch(state_machine,message); -} - -static apt_bool_t recog_request_define_grammar(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(state_machine->state == RECOGNIZER_STATE_RECOGNIZING) { - mrcp_message_t *response_message = mrcp_response_create(message,message->pool); - response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID; - return recog_response_dispatch(state_machine,response_message); - } - else if(state_machine->state == RECOGNIZER_STATE_RECOGNIZED) { - recog_state_change(state_machine,RECOGNIZER_STATE_IDLE,message); - } - - return recog_request_dispatch(state_machine,message); -} - -static apt_bool_t recog_response_define_grammar(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(mrcp_resource_header_property_check(message,RECOGNIZER_HEADER_COMPLETION_CAUSE) != TRUE) { - mrcp_recog_header_t *recog_header = mrcp_resource_header_prepare(message); - recog_header->completion_cause = RECOGNIZER_COMPLETION_CAUSE_SUCCESS; - mrcp_resource_header_property_add(message,RECOGNIZER_HEADER_COMPLETION_CAUSE); - } - return recog_response_dispatch(state_machine,message); -} - -static apt_bool_t recog_request_recognize(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_header_fields_inherit(&message->header,state_machine->properties,message->pool); - if(state_machine->state == RECOGNIZER_STATE_RECOGNIZING) { - mrcp_message_t *response; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Queue Up RECOGNIZE Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - message->start_line.request_state = MRCP_REQUEST_STATE_PENDING; - apt_list_push_back(state_machine->queue,message,message->pool); - - response = mrcp_response_create(message,message->pool); - response->start_line.request_state = MRCP_REQUEST_STATE_PENDING; - return recog_response_dispatch(state_machine,response); - } - - return recog_request_dispatch(state_machine,message); -} - -static apt_bool_t recog_response_recognize(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(message->start_line.request_state == MRCP_REQUEST_STATE_INPROGRESS) { - state_machine->recog = state_machine->active_request; - recog_state_change(state_machine,RECOGNIZER_STATE_RECOGNIZING,message); - } - if(state_machine->is_pending == TRUE) { - state_machine->is_pending = FALSE; - /* not to send the response for pending request */ - return TRUE; - } - return recog_response_dispatch(state_machine,message); -} - -static apt_bool_t recog_request_interpret(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_header_fields_inherit(&message->header,state_machine->properties,message->pool); - return recog_request_dispatch(state_machine,message); -} - -static apt_bool_t recog_response_interpret(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - return recog_response_dispatch(state_machine,message); -} - -static apt_bool_t recog_request_get_result(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_message_t *response_message; - if(state_machine->state == RECOGNIZER_STATE_RECOGNIZED) { - /* found recognized request */ - return recog_request_dispatch(state_machine,message); - } - - /* found no recognized request */ - response_message = mrcp_response_create(message,message->pool); - response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID; - return recog_response_dispatch(state_machine,response_message); -} - -static apt_bool_t recog_response_get_result(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - return recog_response_dispatch(state_machine,message); -} - -static apt_bool_t recog_request_recognition_start_timers(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_message_t *response_message; - if(state_machine->state == RECOGNIZER_STATE_RECOGNIZING) { - /* found in-progress request */ - return recog_request_dispatch(state_machine,message); - } - - /* found no in-progress request */ - response_message = mrcp_response_create(message,message->pool); - response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID; - return recog_response_dispatch(state_machine,response_message); -} - -static apt_bool_t recog_response_recognition_start_timers(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - return recog_response_dispatch(state_machine,message); -} - -static apt_bool_t recog_pending_requests_remove(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *request_message, mrcp_message_t *response_message) -{ - apt_list_elem_t *elem; - mrcp_message_t *pending_message; - mrcp_request_id_list_t *request_id_list = NULL; - mrcp_generic_header_t *generic_header = mrcp_generic_header_get(request_message); - mrcp_generic_header_t *response_generic_header = mrcp_generic_header_prepare(response_message); - if(generic_header && mrcp_generic_header_property_check(request_message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST) == TRUE) { - if(generic_header->active_request_id_list.count) { - /* selective STOP request */ - request_id_list = &generic_header->active_request_id_list; - } - } - - elem = apt_list_first_elem_get(state_machine->queue); - while(elem) { - pending_message = apt_list_elem_object_get(elem); - if(!request_id_list || active_request_id_list_find(generic_header,pending_message->start_line.request_id) == TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove Pending RECOGNIZE Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(pending_message), - pending_message->start_line.request_id); - elem = apt_list_elem_remove(state_machine->queue,elem); - /* append active id list */ - active_request_id_list_append(response_generic_header,pending_message->start_line.request_id); - } - else { - /* speak request remains in the queue, just proceed to the next one */ - elem = apt_list_next_elem_get(state_machine->queue,elem); - } - } - if(response_generic_header->active_request_id_list.count) { - mrcp_generic_header_property_add(response_message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST); - } - return TRUE; -} - -static apt_bool_t recog_request_stop(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_message_t *response_message; - if(state_machine->state == RECOGNIZER_STATE_RECOGNIZING) { - mrcp_request_id_list_t *request_id_list = NULL; - mrcp_generic_header_t *generic_header = mrcp_generic_header_get(message); - if(generic_header && mrcp_generic_header_property_check(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST) == TRUE) { - if(generic_header->active_request_id_list.count) { - /* selective STOP request */ - request_id_list = &generic_header->active_request_id_list; - } - } - - if(!request_id_list || active_request_id_list_find(generic_header,state_machine->recog->start_line.request_id) == TRUE) { - /* found in-progress RECOGNIZE request, stop it */ - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Found IN-PROGRESS RECOGNIZE Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - return recog_request_dispatch(state_machine,message); - } - } - else if(state_machine->state == RECOGNIZER_STATE_RECOGNIZED) { - recog_state_change(state_machine,RECOGNIZER_STATE_IDLE,message); - } - - /* found no in-progress RECOGNIZE request, sending immediate response */ - response_message = mrcp_response_create(message,message->pool); - recog_pending_requests_remove(state_machine,message,response_message); - return recog_response_dispatch(state_machine,response_message); -} - -static apt_bool_t recog_response_stop(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_message_t *pending_request; - mrcp_generic_header_t *generic_header = mrcp_generic_header_prepare(message); - /* append active id list */ - active_request_id_list_append(generic_header,state_machine->recog->start_line.request_id); - mrcp_generic_header_property_add(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST); - recog_pending_requests_remove(state_machine,state_machine->active_request,message); - recog_state_change(state_machine,RECOGNIZER_STATE_IDLE,message); - pending_request = apt_list_pop_front(state_machine->queue); - recog_response_dispatch(state_machine,message); - - /* process pending RECOGNIZE requests / if any */ - if(pending_request) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process Pending RECOGNIZE Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(pending_request), - pending_request->start_line.request_id); - state_machine->is_pending = TRUE; - recog_request_dispatch(state_machine,pending_request); - } - return TRUE; -} - -static apt_bool_t recog_event_start_of_input(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(!state_machine->recog) { - /* unexpected event, no in-progress recognition request */ - return FALSE; - } - - if(state_machine->recog->start_line.request_id != message->start_line.request_id) { - /* unexpected event */ - return FALSE; - } - - message->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS; - return recog_event_dispatch(state_machine,message); -} - -static apt_bool_t recog_event_recognition_complete(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_message_t *pending_request; - if(!state_machine->recog) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Unexpected RECOGNITION-COMPLETE Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - return FALSE; - } - - if(state_machine->recog->start_line.request_id != message->start_line.request_id) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Unexpected RECOGNITION-COMPLETE Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - return FALSE; - } - - if(state_machine->active_request && state_machine->active_request->start_line.method_id == RECOGNIZER_STOP) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Ignore RECOGNITION-COMPLETE Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]: waiting for STOP response", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - return FALSE; - } - - if(mrcp_resource_header_property_check(message,RECOGNIZER_HEADER_COMPLETION_CAUSE) != TRUE) { - mrcp_recog_header_t *recog_header = mrcp_resource_header_prepare(message); - recog_header->completion_cause = RECOGNIZER_COMPLETION_CAUSE_SUCCESS; - mrcp_resource_header_property_add(message,RECOGNIZER_HEADER_COMPLETION_CAUSE); - } - recog_state_change(state_machine,RECOGNIZER_STATE_RECOGNIZED,message); - recog_event_dispatch(state_machine,message); - - /* process pending RECOGNIZE requests */ - pending_request = apt_list_pop_front(state_machine->queue); - if(pending_request) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process Pending RECOGNIZE Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(pending_request), - pending_request->start_line.request_id); - state_machine->is_pending = TRUE; - recog_request_dispatch(state_machine,pending_request); - } - return TRUE; -} - -static apt_bool_t recog_event_interpretation_complete(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(mrcp_resource_header_property_check(message,RECOGNIZER_HEADER_COMPLETION_CAUSE) != TRUE) { - mrcp_recog_header_t *recog_header = mrcp_resource_header_prepare(message); - recog_header->completion_cause = RECOGNIZER_COMPLETION_CAUSE_SUCCESS; - mrcp_resource_header_property_add(message,RECOGNIZER_HEADER_COMPLETION_CAUSE); - } - return recog_event_dispatch(state_machine,message); -} - -static recog_method_f recog_request_method_array[RECOGNIZER_METHOD_COUNT] = { - recog_request_set_params, - recog_request_get_params, - recog_request_define_grammar, - recog_request_recognize, - recog_request_interpret, - recog_request_get_result, - recog_request_recognition_start_timers, - recog_request_stop -}; - -static recog_method_f recog_response_method_array[RECOGNIZER_METHOD_COUNT] = { - recog_response_set_params, - recog_response_get_params, - recog_response_define_grammar, - recog_response_recognize, - recog_response_interpret, - recog_response_get_result, - recog_response_recognition_start_timers, - recog_response_stop -}; - -static recog_method_f recog_event_method_array[RECOGNIZER_EVENT_COUNT] = { - recog_event_start_of_input, - recog_event_recognition_complete, - recog_event_interpretation_complete -}; - -/** Update state according to received incoming request from MRCP client */ -static apt_bool_t recog_request_state_update(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - recog_method_f method; - if(message->start_line.method_id >= RECOGNIZER_METHOD_COUNT) { - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process %s Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - message->start_line.method_name.buf, - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - method = recog_request_method_array[message->start_line.method_id]; - if(method) { - return method(state_machine,message); - } - return recog_request_dispatch(state_machine,message); -} - -/** Update state according to received outgoing response from recognition engine */ -static apt_bool_t recog_response_state_update(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - recog_method_f method; - if(!state_machine->active_request) { - /* unexpected response, no active request waiting for response */ - return FALSE; - } - if(state_machine->active_request->start_line.request_id != message->start_line.request_id) { - /* unexpected response, request id doesn't match */ - return FALSE; - } - - if(message->start_line.method_id >= RECOGNIZER_METHOD_COUNT) { - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process %s Response "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - message->start_line.method_name.buf, - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - method = recog_response_method_array[message->start_line.method_id]; - if(method) { - return method(state_machine,message); - } - return recog_response_dispatch(state_machine,message); -} - -/** Update state according to received outgoing event from recognition engine */ -static apt_bool_t recog_event_state_update(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - recog_method_f method; - if(message->start_line.method_id >= RECOGNIZER_EVENT_COUNT) { - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process %s Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - message->start_line.method_name.buf, - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - method = recog_event_method_array[message->start_line.method_id]; - if(method) { - return method(state_machine,message); - } - return recog_event_dispatch(state_machine,message); -} - -/** Update state according to request received from MRCP client or response/event received from recognition engine */ -static apt_bool_t recog_state_update(mrcp_state_machine_t *base, mrcp_message_t *message) -{ - mrcp_recog_state_machine_t *state_machine = (mrcp_recog_state_machine_t*)base; - apt_bool_t status = TRUE; - switch(message->start_line.message_type) { - case MRCP_MESSAGE_TYPE_REQUEST: - status = recog_request_state_update(state_machine,message); - break; - case MRCP_MESSAGE_TYPE_RESPONSE: - status = recog_response_state_update(state_machine,message); - break; - case MRCP_MESSAGE_TYPE_EVENT: - status = recog_event_state_update(state_machine,message); - break; - default: - status = FALSE; - break; - } - return status; -} - -/** Deactivate state machine */ -static apt_bool_t recog_state_deactivate(mrcp_state_machine_t *base) -{ - mrcp_recog_state_machine_t *state_machine = (mrcp_recog_state_machine_t*)base; - mrcp_message_t *message; - mrcp_message_t *source; - if(state_machine->state != RECOGNIZER_STATE_RECOGNIZING) { - /* no in-progress RECOGNIZE request to deactivate */ - return FALSE; - } - source = state_machine->recog; - if(!source) { - return FALSE; - } - - /* create internal STOP request */ - message = mrcp_request_create( - source->resource, - source->start_line.version, - RECOGNIZER_STOP, - source->pool); - message->channel_id = source->channel_id; - message->start_line.request_id = source->start_line.request_id + 1; - apt_string_set(&message->start_line.method_name,"DEACTIVATE"); /* informative only */ - message->header = source->header; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create and Process STOP Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - return recog_request_dispatch(state_machine,message); -} - -/** Create MRCP recognizer state machine */ -mrcp_state_machine_t* mrcp_recog_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool) -{ - mrcp_recog_state_machine_t *state_machine = apr_palloc(pool,sizeof(mrcp_recog_state_machine_t)); - mrcp_state_machine_init(&state_machine->base,obj); - state_machine->base.update = recog_state_update; - state_machine->base.deactivate = recog_state_deactivate; - state_machine->state = RECOGNIZER_STATE_IDLE; - state_machine->is_pending = FALSE; - state_machine->active_request = NULL; - state_machine->recog = NULL; - state_machine->queue = apt_list_create(pool); - state_machine->properties = mrcp_message_header_create( - mrcp_generic_header_vtable_get(version), - mrcp_recog_header_vtable_get(version), - pool); - return &state_machine->base; -} diff --git a/libs/unimrcp/libs/mrcp-engine/src/mrcp_recorder_state_machine.c b/libs/unimrcp/libs/mrcp-engine/src/mrcp_recorder_state_machine.c deleted file mode 100644 index ad7bd7b1b6..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/src/mrcp_recorder_state_machine.c +++ /dev/null @@ -1,389 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_recorder_state_machine.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "apt_obj_list.h" -#include "apt_log.h" -#include "mrcp_recorder_state_machine.h" -#include "mrcp_generic_header.h" -#include "mrcp_recorder_header.h" -#include "mrcp_recorder_resource.h" -#include "mrcp_message.h" - -/** MRCP recorder states */ -typedef enum { - RECORDER_STATE_IDLE, - RECORDER_STATE_RECORDING, - - RECORDER_STATE_COUNT -} mrcp_recorder_state_e; - -static const char * state_names[RECORDER_STATE_COUNT] = { - "IDLE", - "RECORDING", -}; - -typedef struct mrcp_recorder_state_machine_t mrcp_recorder_state_machine_t; - -struct mrcp_recorder_state_machine_t { - /** state machine base */ - mrcp_state_machine_t base; - /** recorder state */ - mrcp_recorder_state_e state; - /** request sent to recorder engine and waiting for the response to be received */ - mrcp_message_t *active_request; - /** in-progress record request */ - mrcp_message_t *record; - /** properties used in set/get params */ - mrcp_message_header_t *properties; -}; - -typedef apt_bool_t (*recorder_method_f)(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message); - -static APR_INLINE apt_bool_t recorder_request_dispatch(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message) -{ - state_machine->active_request = message; - return state_machine->base.on_dispatch(&state_machine->base,message); -} - -static APR_INLINE apt_bool_t recorder_response_dispatch(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message) -{ - state_machine->active_request = NULL; - if(state_machine->base.active == FALSE) { - /* this is the response to deactivation (STOP) request */ - return state_machine->base.on_deactivate(&state_machine->base); - } - return state_machine->base.on_dispatch(&state_machine->base,message); -} - -static APR_INLINE apt_bool_t recorder_event_dispatch(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(state_machine->base.active == FALSE) { - /* do nothing, state machine has already been deactivated */ - return FALSE; - } - return state_machine->base.on_dispatch(&state_machine->base,message); -} - -static APR_INLINE void recorder_state_change(mrcp_recorder_state_machine_t *state_machine, mrcp_recorder_state_e state, mrcp_message_t *message) -{ - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"State Transition %s -> %s "APT_SIDRES_FMT, - state_names[state_machine->state], - state_names[state], - MRCP_MESSAGE_SIDRES(message)); - state_machine->state = state; - if(state == RECORDER_STATE_IDLE) { - state_machine->record = NULL; - } -} - - -static apt_bool_t recorder_request_set_params(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_header_fields_set(state_machine->properties,&message->header,message->pool); - return recorder_request_dispatch(state_machine,message); -} - -static apt_bool_t recorder_response_set_params(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message) -{ - return recorder_response_dispatch(state_machine,message); -} - -static apt_bool_t recorder_request_get_params(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message) -{ - return recorder_request_dispatch(state_machine,message); -} - -static apt_bool_t recorder_response_get_params(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_header_fields_get(&message->header,state_machine->properties,&state_machine->active_request->header,message->pool); - return recorder_response_dispatch(state_machine,message); -} - -static apt_bool_t recorder_request_record(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_header_fields_inherit(&message->header,state_machine->properties,message->pool); - if(state_machine->state == RECORDER_STATE_RECORDING) { - mrcp_message_t *response; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Reject RECORD Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - - /* there is in-progress request, reject this one */ - response = mrcp_response_create(message,message->pool); - response->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID; - return recorder_response_dispatch(state_machine,response); - } - - return recorder_request_dispatch(state_machine,message); -} - -static apt_bool_t recorder_response_record(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(message->start_line.request_state == MRCP_REQUEST_STATE_INPROGRESS) { - state_machine->record = state_machine->active_request; - recorder_state_change(state_machine,RECORDER_STATE_RECORDING,message); - } - return recorder_response_dispatch(state_machine,message); -} - -static apt_bool_t recorder_request_stop(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_message_t *response; - if(state_machine->state == RECORDER_STATE_RECORDING) { - /* found in-progress RECORDER request, stop it */ - return recorder_request_dispatch(state_machine,message); - } - - /* found no in-progress RECORDER request, sending immediate response */ - response = mrcp_response_create(message,message->pool); - return recorder_response_dispatch(state_machine,response); -} - -static apt_bool_t recorder_response_stop(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_generic_header_t *generic_header = mrcp_generic_header_prepare(message); - /* append active id list */ - active_request_id_list_append(generic_header,state_machine->record->start_line.request_id); - mrcp_generic_header_property_add(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST); - recorder_state_change(state_machine,RECORDER_STATE_IDLE,message); - return recorder_response_dispatch(state_machine,message); -} - -static apt_bool_t recorder_request_start_timers(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_message_t *response; - if(state_machine->state == RECORDER_STATE_RECORDING) { - /* found in-progress request */ - return recorder_request_dispatch(state_machine,message); - } - - /* found no in-progress request */ - response = mrcp_response_create(message,message->pool); - response->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID; - return recorder_response_dispatch(state_machine,response); -} - -static apt_bool_t recorder_response_start_timers(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message) -{ - return recorder_response_dispatch(state_machine,message); -} - -static apt_bool_t recorder_event_start_of_input(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(!state_machine->record) { - /* unexpected event, no in-progress record request */ - return FALSE; - } - - if(state_machine->record->start_line.request_id != message->start_line.request_id) { - /* unexpected event */ - return FALSE; - } - - message->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS; - return recorder_event_dispatch(state_machine,message); -} - -static apt_bool_t recorder_event_record_complete(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(!state_machine->record) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Unexpected RECORD-COMPLETE Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - return FALSE; - } - - if(state_machine->record->start_line.request_id != message->start_line.request_id) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Unexpected RECORD-COMPLETE Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - return FALSE; - } - - if(state_machine->active_request && state_machine->active_request->start_line.method_id == RECORDER_STOP) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Ignore RECORD-COMPLETE Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]: waiting for STOP response", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - return FALSE; - } - - if(mrcp_resource_header_property_check(message,RECORDER_HEADER_COMPLETION_CAUSE) != TRUE) { - mrcp_recorder_header_t *recorder_header = mrcp_resource_header_prepare(message); - recorder_header->completion_cause = RECORDER_COMPLETION_CAUSE_SUCCESS_SILENCE; - mrcp_resource_header_property_add(message,RECORDER_HEADER_COMPLETION_CAUSE); - } - recorder_state_change(state_machine,RECORDER_STATE_IDLE,message); - return recorder_event_dispatch(state_machine,message); -} - -static recorder_method_f recorder_request_method_array[RECORDER_METHOD_COUNT] = { - recorder_request_set_params, - recorder_request_get_params, - recorder_request_record, - recorder_request_stop, - recorder_request_start_timers -}; - -static recorder_method_f recorder_response_method_array[RECORDER_METHOD_COUNT] = { - recorder_response_set_params, - recorder_response_get_params, - recorder_response_record, - recorder_response_stop, - recorder_response_start_timers -}; - -static recorder_method_f recorder_event_method_array[RECORDER_EVENT_COUNT] = { - recorder_event_start_of_input, - recorder_event_record_complete -}; - -/** Update state according to received incoming request from MRCP client */ -static apt_bool_t recorder_request_state_update(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message) -{ - recorder_method_f method; - if(message->start_line.method_id >= RECORDER_METHOD_COUNT) { - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process %s Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - message->start_line.method_name.buf, - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - method = recorder_request_method_array[message->start_line.method_id]; - if(method) { - return method(state_machine,message); - } - return recorder_request_dispatch(state_machine,message); -} - -/** Update state according to received outgoing response from recorder engine */ -static apt_bool_t recorder_response_state_update(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message) -{ - recorder_method_f method; - if(!state_machine->active_request) { - /* unexpected response, no active request waiting for response */ - return FALSE; - } - if(state_machine->active_request->start_line.request_id != message->start_line.request_id) { - /* unexpected response, request id doesn't match */ - return FALSE; - } - - if(message->start_line.method_id >= RECORDER_METHOD_COUNT) { - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process %s Response "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - message->start_line.method_name.buf, - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - method = recorder_response_method_array[message->start_line.method_id]; - if(method) { - return method(state_machine,message); - } - return recorder_response_dispatch(state_machine,message); -} - -/** Update state according to received outgoing event from recorder engine */ -static apt_bool_t recorder_event_state_update(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message) -{ - recorder_method_f method; - if(message->start_line.method_id >= RECORDER_EVENT_COUNT) { - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process %s Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - message->start_line.method_name.buf, - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - method = recorder_event_method_array[message->start_line.method_id]; - if(method) { - return method(state_machine,message); - } - return recorder_event_dispatch(state_machine,message); -} - -/** Update state according to request received from MRCP client or response/event received from recorder engine */ -static apt_bool_t recorder_state_update(mrcp_state_machine_t *base, mrcp_message_t *message) -{ - mrcp_recorder_state_machine_t *state_machine = (mrcp_recorder_state_machine_t*)base; - apt_bool_t status = TRUE; - switch(message->start_line.message_type) { - case MRCP_MESSAGE_TYPE_REQUEST: - status = recorder_request_state_update(state_machine,message); - break; - case MRCP_MESSAGE_TYPE_RESPONSE: - status = recorder_response_state_update(state_machine,message); - break; - case MRCP_MESSAGE_TYPE_EVENT: - status = recorder_event_state_update(state_machine,message); - break; - default: - status = FALSE; - break; - } - return status; -} - -/** Deactivate state machine */ -static apt_bool_t recorder_state_deactivate(mrcp_state_machine_t *base) -{ - mrcp_recorder_state_machine_t *state_machine = (mrcp_recorder_state_machine_t*)base; - mrcp_message_t *message; - mrcp_message_t *source; - if(state_machine->state != RECORDER_STATE_RECORDING) { - /* no in-progress RECORD request to deactivate */ - return FALSE; - } - source = state_machine->record; - if(!source) { - return FALSE; - } - - /* create internal STOP request */ - message = mrcp_request_create( - source->resource, - source->start_line.version, - RECORDER_STOP, - source->pool); - message->channel_id = source->channel_id; - message->start_line.request_id = source->start_line.request_id + 1; - apt_string_set(&message->start_line.method_name,"DEACTIVATE"); /* informative only */ - message->header = source->header; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create and Process STOP Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - return recorder_request_dispatch(state_machine,message); -} - -/** Create MRCP recorder state machine */ -mrcp_state_machine_t* mrcp_recorder_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool) -{ - mrcp_recorder_state_machine_t *state_machine = apr_palloc(pool,sizeof(mrcp_recorder_state_machine_t)); - mrcp_state_machine_init(&state_machine->base,obj); - state_machine->base.update = recorder_state_update; - state_machine->base.deactivate = recorder_state_deactivate; - state_machine->state = RECORDER_STATE_IDLE; - state_machine->active_request = NULL; - state_machine->record = NULL; - state_machine->properties = mrcp_message_header_create( - mrcp_generic_header_vtable_get(version), - mrcp_recorder_header_vtable_get(version), - pool); - return &state_machine->base; -} diff --git a/libs/unimrcp/libs/mrcp-engine/src/mrcp_synth_state_machine.c b/libs/unimrcp/libs/mrcp-engine/src/mrcp_synth_state_machine.c deleted file mode 100644 index 205f39c0bf..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/src/mrcp_synth_state_machine.c +++ /dev/null @@ -1,612 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_synth_state_machine.c 2228 2014-11-12 01:18:27Z achaloyan@gmail.com $ - */ - -#include "apt_obj_list.h" -#include "apt_log.h" -#include "mrcp_state_machine.h" -#include "mrcp_synth_state_machine.h" -#include "mrcp_synth_header.h" -#include "mrcp_generic_header.h" -#include "mrcp_synth_resource.h" -#include "mrcp_message.h" - -/** MRCP synthesizer states */ -typedef enum { - SYNTHESIZER_STATE_IDLE, - SYNTHESIZER_STATE_SPEAKING, - SYNTHESIZER_STATE_PAUSED, - - SYNTHESIZER_STATE_COUNT -} mrcp_synth_state_e; - -static const char * state_names[SYNTHESIZER_STATE_COUNT] = { - "IDLE", - "SPEAKING", - "PAUSED" -}; - -typedef struct mrcp_synth_state_machine_t mrcp_synth_state_machine_t; -struct mrcp_synth_state_machine_t { - /** state machine base */ - mrcp_state_machine_t base; - /** synthesizer state */ - mrcp_synth_state_e state; - /** indicate whether active_request was processed from pending request queue */ - apt_bool_t is_pending; - /** request sent to synthesizer engine and waiting for the response to be received */ - mrcp_message_t *active_request; - /** in-progress speak request */ - mrcp_message_t *speaker; - /** queue of pending speak requests */ - apt_obj_list_t *queue; - /** properties used in set/get params */ - mrcp_message_header_t *properties; -}; - -typedef apt_bool_t (*synth_method_f)(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message); - -static APR_INLINE apt_bool_t synth_request_dispatch(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - state_machine->active_request = message; - return state_machine->base.on_dispatch(&state_machine->base,message); -} - -static APR_INLINE apt_bool_t synth_response_dispatch(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - state_machine->active_request = NULL; - if(state_machine->base.active == FALSE) { - /* this is the response to deactivation (STOP) request */ - return state_machine->base.on_deactivate(&state_machine->base); - } - return state_machine->base.on_dispatch(&state_machine->base,message); -} - -static APR_INLINE apt_bool_t synth_event_dispatch(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(state_machine->base.active == FALSE) { - /* do nothing, state machine has already been deactivated */ - return FALSE; - } - return state_machine->base.on_dispatch(&state_machine->base,message); -} - -static APR_INLINE void synth_state_change(mrcp_synth_state_machine_t *state_machine, mrcp_synth_state_e state, mrcp_message_t *message) -{ - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"State Transition %s -> %s "APT_SIDRES_FMT, - state_names[state_machine->state], - state_names[state], - MRCP_MESSAGE_SIDRES(message)); - state_machine->state = state; - if(state == SYNTHESIZER_STATE_IDLE) { - state_machine->speaker = NULL; - } -} - - -static apt_bool_t synth_request_set_params(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_header_fields_set(state_machine->properties,&message->header,message->pool); - return synth_request_dispatch(state_machine,message); -} - -static apt_bool_t synth_response_set_params(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - return synth_response_dispatch(state_machine,message); -} - -static apt_bool_t synth_request_get_params(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - return synth_request_dispatch(state_machine,message); -} - -static apt_bool_t synth_response_get_params(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_header_fields_get(&message->header,state_machine->properties,&state_machine->active_request->header,message->pool); - return synth_response_dispatch(state_machine,message); -} - -static apt_bool_t synth_request_speak(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_header_fields_inherit(&message->header,state_machine->properties,message->pool); - if(state_machine->speaker) { - mrcp_message_t *response; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Queue Up SPEAK Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - message->start_line.request_state = MRCP_REQUEST_STATE_PENDING; - apt_list_push_back(state_machine->queue,message,message->pool); - - response = mrcp_response_create(message,message->pool); - response->start_line.request_state = MRCP_REQUEST_STATE_PENDING; - return synth_response_dispatch(state_machine,response); - } - - return synth_request_dispatch(state_machine,message); -} - -static apt_bool_t synth_response_speak(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(message->start_line.request_state == MRCP_REQUEST_STATE_INPROGRESS) { - state_machine->speaker = state_machine->active_request; - synth_state_change(state_machine,SYNTHESIZER_STATE_SPEAKING,message); - } - if(state_machine->is_pending == TRUE) { - mrcp_message_t *event_message = mrcp_event_create( - state_machine->active_request, - SYNTHESIZER_SPEECH_MARKER, - state_machine->active_request->pool); - event_message->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS; - state_machine->is_pending = FALSE; - /* not to send the response for pending request, instead send SPEECH-MARKER event */ - return synth_event_dispatch(state_machine,event_message); - } - return synth_response_dispatch(state_machine,message); -} - -static apt_bool_t synth_pending_requests_remove(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *request_message, mrcp_message_t *response_message) -{ - apt_list_elem_t *elem; - mrcp_message_t *pending_message; - mrcp_request_id_list_t *request_id_list = NULL; - mrcp_generic_header_t *generic_header = mrcp_generic_header_get(request_message); - mrcp_generic_header_t *response_generic_header = mrcp_generic_header_prepare(response_message); - if(generic_header && mrcp_generic_header_property_check(request_message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST) == TRUE) { - if(generic_header->active_request_id_list.count) { - /* selective STOP request */ - request_id_list = &generic_header->active_request_id_list; - } - } - - elem = apt_list_first_elem_get(state_machine->queue); - while(elem) { - pending_message = apt_list_elem_object_get(elem); - if(!request_id_list || active_request_id_list_find(generic_header,pending_message->start_line.request_id) == TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove Pending SPEAK Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(pending_message), - pending_message->start_line.request_id); - elem = apt_list_elem_remove(state_machine->queue,elem); - /* append active id list */ - active_request_id_list_append(response_generic_header,pending_message->start_line.request_id); - } - else { - /* speak request remains in the queue, just proceed to the next one */ - elem = apt_list_next_elem_get(state_machine->queue,elem); - } - } - if(response_generic_header->active_request_id_list.count) { - mrcp_generic_header_property_add(response_message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST); - } - return TRUE; -} - -static apt_bool_t synth_request_stop(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_message_t *response_message; - if(state_machine->speaker) { - mrcp_request_id_list_t *request_id_list = NULL; - mrcp_generic_header_t *generic_header = mrcp_generic_header_get(message); - if(generic_header && mrcp_generic_header_property_check(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST) == TRUE) { - if(generic_header->active_request_id_list.count) { - /* selective STOP request */ - request_id_list = &generic_header->active_request_id_list; - } - } - - if(!request_id_list || active_request_id_list_find(generic_header,state_machine->speaker->start_line.request_id) == TRUE) { - /* found in-progress SPEAK request, stop it */ - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Found IN-PROGRESS SPEAK Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - return synth_request_dispatch(state_machine,message); - } - } - - /* found no in-progress SPEAK request, sending immediate response */ - response_message = mrcp_response_create(message,message->pool); - synth_pending_requests_remove(state_machine,message,response_message); - return synth_response_dispatch(state_machine,response_message); -} - -static apt_bool_t synth_response_stop(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_message_t *pending_request; - mrcp_generic_header_t *generic_header = mrcp_generic_header_prepare(message); - /* append active id list */ - active_request_id_list_append(generic_header,state_machine->speaker->start_line.request_id); - mrcp_generic_header_property_add(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST); - synth_pending_requests_remove(state_machine,state_machine->active_request,message); - synth_state_change(state_machine,SYNTHESIZER_STATE_IDLE,message); - pending_request = apt_list_pop_front(state_machine->queue); - synth_response_dispatch(state_machine,message); - - /* process pending SPEAK requests / if any */ - if(pending_request) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process Pending SPEAK Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(message), - pending_request->start_line.request_id); - state_machine->is_pending = TRUE; - synth_request_dispatch(state_machine,pending_request); - } - return TRUE; -} - -static apt_bool_t synth_request_pause(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(state_machine->speaker) { - /* speaking or paused state */ - if(state_machine->state == SYNTHESIZER_STATE_SPEAKING) { - synth_request_dispatch(state_machine,message); - } - else { - /* paused state */ - mrcp_message_t *response_message = mrcp_response_create(message,message->pool); - synth_response_dispatch(state_machine,response_message); - } - } - else { - /* idle state */ - mrcp_message_t *response_message = mrcp_response_create(message,message->pool); - response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID; - synth_response_dispatch(state_machine,response_message); - } - return TRUE; -} - -static apt_bool_t synth_response_pause(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(message->start_line.status_code == MRCP_STATUS_CODE_SUCCESS) { - mrcp_generic_header_t *generic_header = mrcp_generic_header_prepare(message); - /* append active id list */ - active_request_id_list_append(generic_header,state_machine->speaker->start_line.request_id); - mrcp_generic_header_property_add(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST); - synth_state_change(state_machine,SYNTHESIZER_STATE_PAUSED,message); - } - synth_response_dispatch(state_machine,message); - return TRUE; -} - -static apt_bool_t synth_request_resume(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(state_machine->speaker) { - /* speaking or paused state */ - if(state_machine->state == SYNTHESIZER_STATE_PAUSED) { - synth_request_dispatch(state_machine,message); - } - else { - /* speaking state */ - mrcp_message_t *response_message = mrcp_response_create(message,message->pool); - synth_response_dispatch(state_machine,response_message); - } - } - else { - /* idle state */ - mrcp_message_t *response_message = mrcp_response_create(message,message->pool); - response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID; - synth_response_dispatch(state_machine,response_message); - } - return TRUE; -} - -static apt_bool_t synth_response_resume(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(message->start_line.status_code == MRCP_STATUS_CODE_SUCCESS) { - mrcp_generic_header_t *generic_header = mrcp_generic_header_prepare(message); - /* append active id list */ - active_request_id_list_append(generic_header,state_machine->speaker->start_line.request_id); - mrcp_generic_header_property_add(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST); - synth_state_change(state_machine,SYNTHESIZER_STATE_SPEAKING,message); - } - synth_response_dispatch(state_machine,message); - return TRUE; -} - -static apt_bool_t synth_request_barge_in_occurred(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_message_t *response_message; - if(state_machine->speaker) { - apt_bool_t kill_on_barge_in = TRUE; - mrcp_synth_header_t *synth_header = mrcp_resource_header_get(message); - if(synth_header) { - if(mrcp_resource_header_property_check(message,SYNTHESIZER_HEADER_KILL_ON_BARGE_IN) == TRUE) { - kill_on_barge_in = synth_header->kill_on_barge_in; - } - } - - if(kill_on_barge_in == TRUE) { - return synth_request_dispatch(state_machine,message); - } - } - - /* found no kill-on-bargein enabled in-progress SPEAK request, sending immediate response */ - response_message = mrcp_response_create(message,message->pool); - return synth_response_dispatch(state_machine,response_message); -} - -static apt_bool_t synth_response_barge_in_occurred(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_generic_header_t *generic_header = mrcp_generic_header_prepare(message); - /* append active id list */ - active_request_id_list_append(generic_header,state_machine->speaker->start_line.request_id); - mrcp_generic_header_property_add(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST); - synth_pending_requests_remove(state_machine,state_machine->active_request,message); - synth_state_change(state_machine,SYNTHESIZER_STATE_IDLE,message); - return synth_response_dispatch(state_machine,message); -} - -static apt_bool_t synth_request_control(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_message_t *response_message; - if(state_machine->state == SYNTHESIZER_STATE_SPEAKING) { - return synth_request_dispatch(state_machine,message); - } - - /* found no in-progress SPEAK request, sending immediate response */ - response_message = mrcp_response_create(message,message->pool); - return synth_response_dispatch(state_machine,response_message); -} - -static apt_bool_t synth_response_control(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_generic_header_t *generic_header = mrcp_generic_header_prepare(message); - /* append active id list */ - active_request_id_list_append(generic_header,state_machine->speaker->start_line.request_id); - mrcp_generic_header_property_add(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST); - return synth_response_dispatch(state_machine,message); -} - -static apt_bool_t synth_request_define_lexicon(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_message_t *response_message; - if(state_machine->state == SYNTHESIZER_STATE_IDLE) { - return synth_request_dispatch(state_machine,message); - } - - /* sending failure response */ - response_message = mrcp_response_create(message,message->pool); - response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID; - return synth_response_dispatch(state_machine,response_message); -} - -static apt_bool_t synth_response_define_lexicon(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - return synth_response_dispatch(state_machine,message); -} - -static apt_bool_t synth_event_speech_marker(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(!state_machine->speaker) { - /* unexpected event, no in-progress speak request */ - return FALSE; - } - - if(state_machine->speaker->start_line.request_id != message->start_line.request_id) { - /* unexpected event */ - return FALSE; - } - - message->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS; - return synth_event_dispatch(state_machine,message); -} - -static apt_bool_t synth_event_speak_complete(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_message_t *pending_request; - if(!state_machine->speaker) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Unexpected SPEAK-COMPLETE Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - return FALSE; - } - - if(state_machine->speaker->start_line.request_id != message->start_line.request_id) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Unexpected SPEAK-COMPLETE Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - return FALSE; - } - - if(state_machine->active_request && state_machine->active_request->start_line.method_id == SYNTHESIZER_STOP) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Ignore SPEAK-COMPLETE Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]: waiting for STOP response", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - return FALSE; - } - - if(mrcp_resource_header_property_check(message,SYNTHESIZER_HEADER_COMPLETION_CAUSE) != TRUE) { - mrcp_synth_header_t *synth_header = mrcp_resource_header_prepare(message); - synth_header->completion_cause = SYNTHESIZER_COMPLETION_CAUSE_NORMAL; - mrcp_resource_header_property_add(message,SYNTHESIZER_HEADER_COMPLETION_CAUSE); - } - synth_state_change(state_machine,SYNTHESIZER_STATE_IDLE,message); - synth_event_dispatch(state_machine,message); - - /* process pending SPEAK requests */ - pending_request = apt_list_pop_front(state_machine->queue); - if(pending_request) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process Pending SPEAK Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(pending_request), - pending_request->start_line.request_id); - state_machine->is_pending = TRUE; - synth_request_dispatch(state_machine,pending_request); - } - return TRUE; -} - -static synth_method_f synth_request_method_array[SYNTHESIZER_METHOD_COUNT] = { - synth_request_set_params, - synth_request_get_params, - synth_request_speak, - synth_request_stop, - synth_request_pause, - synth_request_resume, - synth_request_barge_in_occurred, - synth_request_control, - synth_request_define_lexicon -}; - -static synth_method_f synth_response_method_array[SYNTHESIZER_METHOD_COUNT] = { - synth_response_set_params, - synth_response_get_params, - synth_response_speak, - synth_response_stop, - synth_response_pause, - synth_response_resume, - synth_response_barge_in_occurred, - synth_response_control, - synth_response_define_lexicon, -}; - -static synth_method_f synth_event_method_array[SYNTHESIZER_EVENT_COUNT] = { - synth_event_speech_marker, - synth_event_speak_complete -}; - -/** Update state according to received incoming request from MRCP client */ -static apt_bool_t synth_request_state_update(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - synth_method_f method; - if(message->start_line.method_id >= SYNTHESIZER_METHOD_COUNT) { - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process %s Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - message->start_line.method_name.buf, - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - method = synth_request_method_array[message->start_line.method_id]; - if(method) { - return method(state_machine,message); - } - return synth_request_dispatch(state_machine,message); -} - -/** Update state according to received outgoing response from synthesizer engine */ -static apt_bool_t synth_response_state_update(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - synth_method_f method; - if(!state_machine->active_request) { - /* unexpected response, no active request waiting for response */ - return FALSE; - } - if(state_machine->active_request->start_line.request_id != message->start_line.request_id) { - /* unexpected response, request id doesn't match */ - return FALSE; - } - - if(message->start_line.method_id >= SYNTHESIZER_METHOD_COUNT) { - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process %s Response "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - message->start_line.method_name.buf, - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - method = synth_response_method_array[message->start_line.method_id]; - if(method) { - return method(state_machine,message); - } - return synth_response_dispatch(state_machine,message); -} - -/** Update state according to received outgoing event from synthesizer engine */ -static apt_bool_t synth_event_state_update(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - synth_method_f method; - if(message->start_line.method_id >= SYNTHESIZER_EVENT_COUNT) { - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process %s Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - message->start_line.method_name.buf, - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - method = synth_event_method_array[message->start_line.method_id]; - if(method) { - return method(state_machine,message); - } - return synth_event_dispatch(state_machine,message); -} - -/** Update state according to request received from MRCP client or response/event received from synthesizer engine */ -static apt_bool_t synth_state_update(mrcp_state_machine_t *base, mrcp_message_t *message) -{ - mrcp_synth_state_machine_t *synth_state_machine = (mrcp_synth_state_machine_t*)base; - apt_bool_t status = TRUE; - switch(message->start_line.message_type) { - case MRCP_MESSAGE_TYPE_REQUEST: - status = synth_request_state_update(synth_state_machine,message); - break; - case MRCP_MESSAGE_TYPE_RESPONSE: - status = synth_response_state_update(synth_state_machine,message); - break; - case MRCP_MESSAGE_TYPE_EVENT: - status = synth_event_state_update(synth_state_machine,message); - break; - default: - status = FALSE; - break; - } - return status; -} - -/** Deactivate state machine */ -static apt_bool_t synth_state_deactivate(mrcp_state_machine_t *base) -{ - mrcp_synth_state_machine_t *state_machine = (mrcp_synth_state_machine_t*)base; - mrcp_message_t *message; - mrcp_message_t *source; - if(!state_machine->speaker) { - /* no in-progress SPEAK request to deactivate */ - return FALSE; - } - source = state_machine->speaker; - - /* create internal STOP request */ - message = mrcp_request_create( - source->resource, - source->start_line.version, - SYNTHESIZER_STOP, - source->pool); - message->channel_id = source->channel_id; - message->start_line.request_id = source->start_line.request_id + 1; - apt_string_set(&message->start_line.method_name,"DEACTIVATE"); /* informative only */ - message->header = source->header; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create and Process STOP Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - return synth_request_dispatch(state_machine,message); -} - -/** Create MRCP synthesizer state machine */ -mrcp_state_machine_t* mrcp_synth_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool) -{ - mrcp_synth_state_machine_t *state_machine = apr_palloc(pool,sizeof(mrcp_synth_state_machine_t)); - mrcp_state_machine_init(&state_machine->base,obj); - state_machine->base.update = synth_state_update; - state_machine->base.deactivate = synth_state_deactivate; - state_machine->state = SYNTHESIZER_STATE_IDLE; - state_machine->is_pending = FALSE; - state_machine->active_request = NULL; - state_machine->speaker = NULL; - state_machine->queue = apt_list_create(pool); - state_machine->properties = mrcp_message_header_create( - mrcp_generic_header_vtable_get(version), - mrcp_synth_header_vtable_get(version), - pool); - return &state_machine->base; -} diff --git a/libs/unimrcp/libs/mrcp-engine/src/mrcp_verifier_state_machine.c b/libs/unimrcp/libs/mrcp-engine/src/mrcp_verifier_state_machine.c deleted file mode 100644 index 6ca313e51c..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/src/mrcp_verifier_state_machine.c +++ /dev/null @@ -1,524 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_verifier_state_machine.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "apt_obj_list.h" -#include "apt_log.h" -#include "mrcp_verifier_state_machine.h" -#include "mrcp_generic_header.h" -#include "mrcp_verifier_header.h" -#include "mrcp_verifier_resource.h" -#include "mrcp_message.h" - -/** MRCP verifier states */ -typedef enum { - VERIFIER_STATE_IDLE, - VERIFIER_STATE_OPENED, - VERIFIER_STATE_VERIFYING, - - VERIFIER_STATE_COUNT -} mrcp_verifier_state_e; - -static const char * state_names[VERIFIER_STATE_COUNT] = { - "IDLE", - "OPENED", - "VERIFYING" -}; - -typedef struct mrcp_verifier_state_machine_t mrcp_verifier_state_machine_t; - -struct mrcp_verifier_state_machine_t { - /** state machine base */ - mrcp_state_machine_t base; - /** verifier state */ - mrcp_verifier_state_e state; - /** request sent to verification engine and waiting for the response to be received */ - mrcp_message_t *active_request; - /** in-progress verify request */ - mrcp_message_t *verify; - /** properties used in set/get params */ - mrcp_message_header_t *properties; -}; - -typedef apt_bool_t (*verifier_method_f)(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message); - -static APR_INLINE apt_bool_t verifier_request_dispatch(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - state_machine->active_request = message; - return state_machine->base.on_dispatch(&state_machine->base,message); -} - -static APR_INLINE apt_bool_t verifier_response_dispatch(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - state_machine->active_request = NULL; - if(state_machine->base.active == FALSE) { - /* this is the response to deactivation (STOP) request */ - return state_machine->base.on_deactivate(&state_machine->base); - } - return state_machine->base.on_dispatch(&state_machine->base,message); -} - -static APR_INLINE apt_bool_t verifier_event_dispatch(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(state_machine->base.active == FALSE) { - /* do nothing, state machine has already been deactivated */ - return FALSE; - } - return state_machine->base.on_dispatch(&state_machine->base,message); -} - -static APR_INLINE void verifier_state_change(mrcp_verifier_state_machine_t *state_machine, mrcp_verifier_state_e state, mrcp_message_t *message) -{ - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"State Transition %s -> %s "APT_SIDRES_FMT, - state_names[state_machine->state], - state_names[state], - MRCP_MESSAGE_SIDRES(message)); - state_machine->state = state; - if(state == VERIFIER_STATE_IDLE) { - state_machine->verify = NULL; - } -} - - -static apt_bool_t verifier_request_set_params(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_header_fields_set(state_machine->properties,&message->header,message->pool); - return verifier_request_dispatch(state_machine,message); -} - -static apt_bool_t verifier_response_set_params(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - return verifier_response_dispatch(state_machine,message); -} - -static apt_bool_t verifier_request_get_params(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - return verifier_request_dispatch(state_machine,message); -} - -static apt_bool_t verifier_response_get_params(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_header_fields_get(&message->header,state_machine->properties,&state_machine->active_request->header,message->pool); - return verifier_response_dispatch(state_machine,message); -} - -static apt_bool_t verifier_request_start_session(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(state_machine->state == VERIFIER_STATE_VERIFYING) { - mrcp_message_t *response_message = mrcp_response_create(message,message->pool); - response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID; - return verifier_response_dispatch(state_machine,response_message); - } - - return verifier_request_dispatch(state_machine,message); -} - -static apt_bool_t verifier_response_start_session(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - verifier_state_change(state_machine,VERIFIER_STATE_OPENED,message); - - return verifier_response_dispatch(state_machine,message); -} - -static apt_bool_t verifier_request_end_session(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(state_machine->state == VERIFIER_STATE_IDLE) { - mrcp_message_t *response_message = mrcp_response_create(message,message->pool); - response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID; - return verifier_response_dispatch(state_machine,response_message); - } - - return verifier_request_dispatch(state_machine,message); -} - -static apt_bool_t verifier_response_end_session(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - verifier_state_change(state_machine,VERIFIER_STATE_IDLE,message); - - return verifier_response_dispatch(state_machine,message); -} - -static apt_bool_t verifier_request_query_voiceprint(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(state_machine->state == VERIFIER_STATE_IDLE) { - mrcp_message_t *response_message = mrcp_response_create(message,message->pool); - response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID; - return verifier_response_dispatch(state_machine,response_message); - } - - return verifier_request_dispatch(state_machine,message); -} - -static apt_bool_t verifier_response_query_voiceprint(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - - return verifier_response_dispatch(state_machine,message); -} - -static apt_bool_t verifier_request_delete_voiceprint(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(state_machine->state == VERIFIER_STATE_IDLE) { - mrcp_message_t *response_message = mrcp_response_create(message,message->pool); - response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID; - return verifier_response_dispatch(state_machine,response_message); - } - - return verifier_request_dispatch(state_machine,message); -} - -static apt_bool_t verifier_response_delete_voiceprint(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - return verifier_response_dispatch(state_machine,message); -} - -static apt_bool_t verifier_request_verify(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(state_machine->state == VERIFIER_STATE_IDLE || state_machine->state == VERIFIER_STATE_VERIFYING) { - mrcp_message_t *response_message = mrcp_response_create(message,message->pool); - response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID; - return verifier_response_dispatch(state_machine,response_message); - } - - state_machine->verify = message; - return verifier_request_dispatch(state_machine,message); -} - -static apt_bool_t verifier_response_verify(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - verifier_state_change(state_machine,VERIFIER_STATE_VERIFYING,message); - - return verifier_response_dispatch(state_machine,message); -} - -static apt_bool_t verifier_request_verify_from_buffer(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(state_machine->state == VERIFIER_STATE_IDLE || state_machine->state == VERIFIER_STATE_VERIFYING) { - mrcp_message_t *response_message = mrcp_response_create(message,message->pool); - response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID; - return verifier_response_dispatch(state_machine,response_message); - } - - state_machine->verify = message; - return verifier_request_dispatch(state_machine,message); -} - -static apt_bool_t verifier_response_verify_from_buffer(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - verifier_state_change(state_machine,VERIFIER_STATE_VERIFYING,message); - - return verifier_response_dispatch(state_machine,message); -} - -static apt_bool_t verifier_request_verify_rollback(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - return verifier_request_dispatch(state_machine,message); -} - -static apt_bool_t verifier_response_verify_rollback(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - return verifier_response_dispatch(state_machine,message); -} - -static apt_bool_t verifier_request_stop(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(state_machine->state == VERIFIER_STATE_IDLE) { - mrcp_message_t *response_message = mrcp_response_create(message,message->pool); - response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID; - return verifier_response_dispatch(state_machine,response_message); - } - - if(state_machine->state == VERIFIER_STATE_OPENED) { - /* no in-progress VERIFY request, sending immediate response */ - mrcp_message_t *response_message = mrcp_response_create(message,message->pool); - return verifier_response_dispatch(state_machine,response_message); - } - - return verifier_request_dispatch(state_machine,message); -} - -static apt_bool_t verifier_response_stop(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_generic_header_t *generic_header = mrcp_generic_header_prepare(message); - /* append active id list */ - active_request_id_list_append(generic_header,state_machine->verify->start_line.request_id); - mrcp_generic_header_property_add(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST); - verifier_state_change(state_machine,VERIFIER_STATE_OPENED,message); - return verifier_response_dispatch(state_machine,message); -} - -static apt_bool_t verifier_request_clear_buffer(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - return verifier_request_dispatch(state_machine,message); -} - -static apt_bool_t verifier_response_clear_buffer(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - return verifier_response_dispatch(state_machine,message); -} - -static apt_bool_t verifier_request_start_input_timers(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(state_machine->state == VERIFIER_STATE_IDLE || state_machine->state == VERIFIER_STATE_VERIFYING) { - mrcp_message_t *response_message = mrcp_response_create(message,message->pool); - response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID; - return verifier_response_dispatch(state_machine,response_message); - } - - return verifier_request_dispatch(state_machine,message); -} - -static apt_bool_t verifier_response_start_input_timers(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - return verifier_response_dispatch(state_machine,message); -} - -static apt_bool_t verifier_request_get_intermidiate_result(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(state_machine->state != VERIFIER_STATE_VERIFYING) { - mrcp_message_t *response_message = mrcp_response_create(message,message->pool); - response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID; - return verifier_response_dispatch(state_machine,response_message); - } - return verifier_request_dispatch(state_machine,message); -} - -static apt_bool_t verifier_response_get_intermidiate_result(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - return verifier_response_dispatch(state_machine,message); -} - - -static apt_bool_t verifier_event_start_of_input(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(!state_machine->verify) { - /* unexpected event, no in-progress verify request */ - return FALSE; - } - - if(state_machine->verify->start_line.request_id != message->start_line.request_id) { - /* unexpected event */ - return FALSE; - } - - message->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS; - return verifier_event_dispatch(state_machine,message); -} - -static apt_bool_t verifier_event_verification_complete(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(!state_machine->verify) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Unexpected VERIFICATION-COMPLETE Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - return FALSE; - } - - if(state_machine->verify->start_line.request_id != message->start_line.request_id) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Unexpected VERIFICATION-COMPLETE Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - return FALSE; - } - - if(state_machine->active_request && state_machine->active_request->start_line.method_id == VERIFIER_STOP) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Ignore VERIFICATION-COMPLETE Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]: waiting for STOP response", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - return FALSE; - } - - if(mrcp_resource_header_property_check(message,VERIFIER_HEADER_COMPLETION_CAUSE) != TRUE) { - mrcp_verifier_header_t *verifier_header = mrcp_resource_header_prepare(message); - verifier_header->completion_cause = VERIFIER_COMPLETION_CAUSE_SUCCESS; - mrcp_resource_header_property_add(message,VERIFIER_HEADER_COMPLETION_CAUSE); - } - verifier_state_change(state_machine,VERIFIER_STATE_OPENED,message); - return verifier_event_dispatch(state_machine,message); -} - -static verifier_method_f verifier_request_method_array[VERIFIER_METHOD_COUNT] = { - verifier_request_set_params, - verifier_request_get_params, - verifier_request_start_session, - verifier_request_end_session, - verifier_request_query_voiceprint, - verifier_request_delete_voiceprint, - verifier_request_verify, - verifier_request_verify_from_buffer, - verifier_request_verify_rollback, - verifier_request_stop, - verifier_request_clear_buffer, - verifier_request_start_input_timers, - verifier_request_get_intermidiate_result -}; - -static verifier_method_f verifier_response_method_array[VERIFIER_METHOD_COUNT] = { - verifier_response_set_params, - verifier_response_get_params, - verifier_response_start_session, - verifier_response_end_session, - verifier_response_query_voiceprint, - verifier_response_delete_voiceprint, - verifier_response_verify, - verifier_response_verify_from_buffer, - verifier_response_verify_rollback, - verifier_response_stop, - verifier_response_clear_buffer, - verifier_response_start_input_timers, - verifier_response_get_intermidiate_result -}; - -static verifier_method_f verifier_event_method_array[VERIFIER_EVENT_COUNT] = { - verifier_event_start_of_input, - verifier_event_verification_complete -}; - -/** Update state according to received incoming request from MRCP client */ -static apt_bool_t verifier_request_state_update(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - verifier_method_f method; - if(message->start_line.method_id >= VERIFIER_METHOD_COUNT) { - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process %s Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - message->start_line.method_name.buf, - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - method = verifier_request_method_array[message->start_line.method_id]; - if(method) { - return method(state_machine,message); - } - return verifier_request_dispatch(state_machine,message); -} - -/** Update state according to received outgoing response from verification engine */ -static apt_bool_t verifier_response_state_update(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - verifier_method_f method; - if(!state_machine->active_request) { - /* unexpected response, no active request waiting for response */ - return FALSE; - } - if(state_machine->active_request->start_line.request_id != message->start_line.request_id) { - /* unexpected response, request id doesn't match */ - return FALSE; - } - - if(message->start_line.method_id >= VERIFIER_METHOD_COUNT) { - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process %s Response "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - message->start_line.method_name.buf, - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - method = verifier_response_method_array[message->start_line.method_id]; - if(method) { - return method(state_machine,message); - } - return verifier_response_dispatch(state_machine,message); -} - -/** Update state according to received outgoing event from verification engine */ -static apt_bool_t verifier_event_state_update(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - verifier_method_f method; - if(message->start_line.method_id >= VERIFIER_EVENT_COUNT) { - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process %s Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - message->start_line.method_name.buf, - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - method = verifier_event_method_array[message->start_line.method_id]; - if(method) { - return method(state_machine,message); - } - return verifier_event_dispatch(state_machine,message); -} - -/** Update state according to request received from MRCP client or response/event received from verification engine */ -static apt_bool_t verifier_state_update(mrcp_state_machine_t *base, mrcp_message_t *message) -{ - mrcp_verifier_state_machine_t *state_machine = (mrcp_verifier_state_machine_t*)base; - apt_bool_t status = TRUE; - switch(message->start_line.message_type) { - case MRCP_MESSAGE_TYPE_REQUEST: - status = verifier_request_state_update(state_machine,message); - break; - case MRCP_MESSAGE_TYPE_RESPONSE: - status = verifier_response_state_update(state_machine,message); - break; - case MRCP_MESSAGE_TYPE_EVENT: - status = verifier_event_state_update(state_machine,message); - break; - default: - status = FALSE; - break; - } - return status; -} - -/** Deactivate state machine */ -static apt_bool_t verifier_state_deactivate(mrcp_state_machine_t *base) -{ - mrcp_verifier_state_machine_t *state_machine = (mrcp_verifier_state_machine_t*)base; - mrcp_message_t *message; - mrcp_message_t *source; - if(state_machine->state != VERIFIER_STATE_VERIFYING) { - /* no in-progress VERIFY request to deactivate */ - return FALSE; - } - source = state_machine->verify; - if(!source) { - return FALSE; - } - - /* create internal STOP request */ - message = mrcp_request_create( - source->resource, - source->start_line.version, - VERIFIER_STOP, - source->pool); - message->channel_id = source->channel_id; - message->start_line.request_id = source->start_line.request_id + 1; - apt_string_set(&message->start_line.method_name,"DEACTIVATE"); /* informative only */ - message->header = source->header; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create and Process STOP Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - return verifier_request_dispatch(state_machine,message); -} - -/** Create MRCP verification state machine */ -mrcp_state_machine_t* mrcp_verifier_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool) -{ - mrcp_verifier_state_machine_t *state_machine = apr_palloc(pool,sizeof(mrcp_verifier_state_machine_t)); - mrcp_state_machine_init(&state_machine->base,obj); - state_machine->base.update = verifier_state_update; - state_machine->base.deactivate = verifier_state_deactivate; - state_machine->state = VERIFIER_STATE_IDLE; - state_machine->active_request = NULL; - state_machine->verify = NULL; - state_machine->properties = mrcp_message_header_create( - mrcp_generic_header_vtable_get(version), - mrcp_verifier_header_vtable_get(version), - pool); - return &state_machine->base; -} diff --git a/libs/unimrcp/libs/mrcp-server/Makefile.am b/libs/unimrcp/libs/mrcp-server/Makefile.am deleted file mode 100644 index 0ebf90cab0..0000000000 --- a/libs/unimrcp/libs/mrcp-server/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -AM_CPPFLAGS = -I$(top_srcdir)/libs/mrcp-server/include \ - -I$(top_srcdir)/libs/mrcp-engine/include \ - -I$(top_srcdir)/libs/mrcp-signaling/include \ - -I$(top_srcdir)/libs/mrcpv2-transport/include \ - -I$(top_srcdir)/libs/mrcp/include \ - -I$(top_srcdir)/libs/mrcp/message/include \ - -I$(top_srcdir)/libs/mrcp/control/include \ - -I$(top_srcdir)/libs/mrcp/resources/include \ - -I$(top_srcdir)/libs/mpf/include \ - -I$(top_srcdir)/libs/apr-toolkit/include \ - $(UNIMRCP_APR_INCLUDES) - -noinst_LTLIBRARIES = libmrcpserver.la - -include_HEADERS = include/mrcp_server_types.h \ - include/mrcp_server.h \ - include/mrcp_server_session.h - -libmrcpserver_la_SOURCES = src/mrcp_server.c \ - src/mrcp_server_session.c diff --git a/libs/unimrcp/libs/mrcp-server/include/mrcp_server.h b/libs/unimrcp/libs/mrcp-server/include/mrcp_server.h deleted file mode 100644 index a51186dd88..0000000000 --- a/libs/unimrcp/libs/mrcp-server/include/mrcp_server.h +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_server.h 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_SERVER_H -#define MRCP_SERVER_H - -/** - * @file mrcp_server.h - * @brief MRCP Server - */ - -#include "mrcp_server_types.h" -#include "mrcp_engine_iface.h" -#include "mpf_rtp_descriptor.h" -#include "apt_task.h" - -APT_BEGIN_EXTERN_C - -/** - * Create MRCP server instance. - * @return the created server instance - */ -MRCP_DECLARE(mrcp_server_t*) mrcp_server_create(apt_dir_layout_t *dir_layout); - -/** - * Start message processing loop. - * @param server the MRCP server to start - * @return the created server instance - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_start(mrcp_server_t *server); - -/** - * Shutdown message processing loop. - * @param server the MRCP server to shutdown - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_shutdown(mrcp_server_t *server); - -/** - * Destroy MRCP server. - * @param server the MRCP server to destroy - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_destroy(mrcp_server_t *server); - - -/** - * Register MRCP resource factory. - * @param server the MRCP server to set resource factory for - * @param resource_factory the resource factory to set - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_resource_factory_register( - mrcp_server_t *server, - mrcp_resource_factory_t *resource_factory); - -/** - * Register MRCP engine. - * @param server the MRCP server to set engine for - * @param engine the engine to set - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_engine_register( - mrcp_server_t *server, - mrcp_engine_t *engine); - -/** - * Register codec manager. - * @param server the MRCP server to set codec manager for - * @param codec_manager the codec manager to set - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_codec_manager_register(mrcp_server_t *server, mpf_codec_manager_t *codec_manager); - -/** - * Get registered codec manager. - * @param server the MRCP server to get codec manager from - */ -MRCP_DECLARE(const mpf_codec_manager_t*) mrcp_server_codec_manager_get(const mrcp_server_t *server); - -/** - * Register media engine. - * @param server the MRCP server to set media engine for - * @param media_engine the media engine to set - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_media_engine_register( - mrcp_server_t *server, - mpf_engine_t *media_engine); - -/** - * Register RTP termination factory. - * @param server the MRCP server to set termination factory for - * @param rtp_termination_factory the termination factory - * @param name the name of the factory - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_rtp_factory_register( - mrcp_server_t *server, - mpf_termination_factory_t *rtp_termination_factory, - const char *name); - -/** - * Register RTP settings. - * @param server the MRCP server to set RTP settings for - * @param rtp_settings the settings to set - * @param name the name of the settings - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_rtp_settings_register( - mrcp_server_t *server, - mpf_rtp_settings_t *rtp_settings, - const char *name); - -/** - * Register MRCP signaling agent. - * @param server the MRCP server to set signaling agent for - * @param signaling_agent the signaling agent to set - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_signaling_agent_register( - mrcp_server_t *server, - mrcp_sig_agent_t *signaling_agent); - -/** - * Register MRCP connection agent (MRCPv2 only). - * @param server the MRCP server to set connection agent for - * @param connection_agent the connection agent to set - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_connection_agent_register( - mrcp_server_t *server, - mrcp_connection_agent_t *connection_agent); - -/** Create MRCP profile */ -MRCP_DECLARE(mrcp_server_profile_t*) mrcp_server_profile_create( - const char *id, - mrcp_version_e mrcp_version, - mrcp_resource_factory_t *resource_factory, - mrcp_sig_agent_t *signaling_agent, - mrcp_connection_agent_t *connection_agent, - mpf_engine_t *media_engine, - mpf_termination_factory_t *rtp_factory, - mpf_rtp_settings_t *rtp_settings, - apr_pool_t *pool); - -/** - * Register MRCP profile. - * @param server the MRCP server to set profile for - * @param profile the profile to set - * @param plugin_map the map of engines (plugins) - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_profile_register( - mrcp_server_t *server, - mrcp_server_profile_t *profile, - apr_table_t *plugin_map); - -/** - * Load MRCP engine as a plugin. - * @param server the MRCP server to use - * @param id the identifier of the plugin - * @param path the path to the plugin to load - * @param config the config of the engine - */ -MRCP_DECLARE(mrcp_engine_t*) mrcp_server_engine_load( - mrcp_server_t *server, - const char *id, - const char *path, - mrcp_engine_config_t *config); - -/** - * Get memory pool. - * @param server the MRCP server to get memory pool from - */ -MRCP_DECLARE(apr_pool_t*) mrcp_server_memory_pool_get(const mrcp_server_t *server); - -/** - * Get media engine by name. - * @param server the MRCP server to get media engine from - * @param name the name of the media engine to lookup - */ -MRCP_DECLARE(mpf_engine_t*) mrcp_server_media_engine_get(const mrcp_server_t *server, const char *name); - -/** - * Get RTP termination factory by name. - * @param server the MRCP server to get from - * @param name the name to lookup - */ -MRCP_DECLARE(mpf_termination_factory_t*) mrcp_server_rtp_factory_get(const mrcp_server_t *server, const char *name); - -/** - * Get RTP settings by name - * @param server the MRCP server to get from - * @param name the name to lookup - */ -MRCP_DECLARE(mpf_rtp_settings_t*) mrcp_server_rtp_settings_get(const mrcp_server_t *server, const char *name); - -/** - * Get signaling agent by name. - * @param server the MRCP server to get from - * @param name the name to lookup - */ -MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_server_signaling_agent_get(const mrcp_server_t *server, const char *name); - -/** - * Get connection agent by name. - * @param server the MRCP server to get from - * @param name the name to lookup - */ -MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_server_connection_agent_get(const mrcp_server_t *server, const char *name); - -/** - * Get profile by name. - * @param server the MRCP client to get from - * @param name the name to lookup - */ -MRCP_DECLARE(mrcp_server_profile_t*) mrcp_server_profile_get(const mrcp_server_t *server, const char *name); - -APT_END_EXTERN_C - -#endif /* MRCP_SERVER_H */ diff --git a/libs/unimrcp/libs/mrcp-server/include/mrcp_server_session.h b/libs/unimrcp/libs/mrcp-server/include/mrcp_server_session.h deleted file mode 100644 index af456a021a..0000000000 --- a/libs/unimrcp/libs/mrcp-server/include/mrcp_server_session.h +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_server_session.h 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_SERVER_SESSION_H -#define MRCP_SERVER_SESSION_H - -/** - * @file mrcp_server_session.h - * @brief MRCP Server Session - */ - -#include -#include "mrcp_session.h" -#include "mpf_engine.h" -#include "apt_task.h" -#include "apt_obj_list.h" - - -APT_BEGIN_EXTERN_C - -/** Opaque MRCP channel declaration */ -typedef struct mrcp_channel_t mrcp_channel_t; -/** MRCP server session declaration */ -typedef struct mrcp_server_session_t mrcp_server_session_t; -/** MRCP signaling message declaration */ -typedef struct mrcp_signaling_message_t mrcp_signaling_message_t; - -/** Enumeration of signaling task messages */ -typedef enum { - SIGNALING_MESSAGE_OFFER, - SIGNALING_MESSAGE_CONTROL, - SIGNALING_MESSAGE_TERMINATE, -} mrcp_signaling_message_type_e; - -/** MRCP signaling message */ -struct mrcp_signaling_message_t { - /** Signaling message type */ - mrcp_signaling_message_type_e type; - - /** Session */ - mrcp_server_session_t *session; - /** Descriptor */ - mrcp_session_descriptor_t *descriptor; - - /** Channel */ - mrcp_channel_t *channel; - /** MRCP message */ - mrcp_message_t *message; -}; - -/** Server session states */ -typedef enum { - SESSION_STATE_NONE, /**< initial state */ - SESSION_STATE_GENERATING_ANSWER, /**< received offer, generating answer now */ - SESSION_STATE_INITIALIZING, /**< answer is ready, finally initializing channels now */ - SESSION_STATE_DEACTIVATING, /**< received session termination request, deinitializing channels now */ - SESSION_STATE_TERMINATING /**< finally terminating session */ -} mrcp_server_session_state_e; - - -/** MRCP server session */ -struct mrcp_server_session_t { - /** Session base */ - mrcp_session_t base; - /** MRCP server */ - mrcp_server_t *server; - /** MRCP profile */ - mrcp_server_profile_t *profile; - - /** Media context */ - mpf_context_t *context; - - /** Media termination array */ - apr_array_header_t *terminations; - /** MRCP control channel array */ - apr_array_header_t *channels; - - /** In-progress signaling request */ - mrcp_signaling_message_t *active_request; - /** Signaling request queue */ - apt_obj_list_t *request_queue; - - /** In-progress offer */ - mrcp_session_descriptor_t *offer; - /** In-progres answer */ - mrcp_session_descriptor_t *answer; - - /** MPF task message, which construction is in progress */ - mpf_task_msg_t *mpf_task_msg; - - /** Session state */ - mrcp_server_session_state_e state; - /** Number of in-progress sub requests */ - apr_size_t subrequest_count; -}; - -/** MRCP server profile */ -struct mrcp_server_profile_t { - /** Identifier of the profile */ - const char *id; - /** MRCP version */ - mrcp_version_e mrcp_version; - /** Table of engines (mrcp_engine_t*) */ - apr_hash_t *engine_table; - /** MRCP resource factory */ - mrcp_resource_factory_t *resource_factory; - /** Media processing engine */ - mpf_engine_t *media_engine; - /** RTP termination factory */ - mpf_termination_factory_t *rtp_termination_factory; - /** RTP settings */ - mpf_rtp_settings_t *rtp_settings; - /** Signaling agent */ - mrcp_sig_agent_t *signaling_agent; - /** Connection agent */ - mrcp_connection_agent_t *connection_agent; -}; - -/** Create server session */ -mrcp_server_session_t* mrcp_server_session_create(void); - -/** Process signaling message */ -apt_bool_t mrcp_server_signaling_message_process(mrcp_signaling_message_t *signaling_message); -/** Process MPF message */ -apt_bool_t mrcp_server_mpf_message_process(mpf_message_container_t *mpf_message_container); - -/** Process channel modify event */ -apt_bool_t mrcp_server_on_channel_modify(mrcp_channel_t *channel, mrcp_control_descriptor_t *answer, apt_bool_t status); -/** Process channel remove event */ -apt_bool_t mrcp_server_on_channel_remove(mrcp_channel_t *channel, apt_bool_t status); -/** Process channel message receive */ -apt_bool_t mrcp_server_on_channel_message(mrcp_channel_t *channel, mrcp_message_t *message); -/** Process connection disconnect event */ -apt_bool_t mrcp_server_on_disconnect(mrcp_channel_t *channel); - -/** Process channel open event */ -apt_bool_t mrcp_server_on_engine_channel_open(mrcp_channel_t *channel, apt_bool_t status); -/** Process channel close event */ -apt_bool_t mrcp_server_on_engine_channel_close(mrcp_channel_t *channel); -/** Process message receive event */ -apt_bool_t mrcp_server_on_engine_channel_message(mrcp_channel_t *channel, mrcp_message_t *message); - -/** Get session by channel */ -mrcp_session_t* mrcp_server_channel_session_get(mrcp_channel_t *channel); - -APT_END_EXTERN_C - -#endif /* MRCP_SERVER_SESSION_H */ diff --git a/libs/unimrcp/libs/mrcp-server/include/mrcp_server_types.h b/libs/unimrcp/libs/mrcp-server/include/mrcp_server_types.h deleted file mode 100644 index 99c0b615ae..0000000000 --- a/libs/unimrcp/libs/mrcp-server/include/mrcp_server_types.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_server_types.h 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_SERVER_TYPES_H -#define MRCP_SERVER_TYPES_H - -/** - * @file mrcp_server_types.h - * @brief MRCP Server Types - */ - -#include "mrcp_sig_types.h" -#include "mrcp_connection_types.h" -#include "mpf_types.h" - -APT_BEGIN_EXTERN_C - -/** Opaque MRCP server declaration */ -typedef struct mrcp_server_t mrcp_server_t; - -/** Opaque MRCP server profile declaration */ -typedef struct mrcp_server_profile_t mrcp_server_profile_t; - - -APT_END_EXTERN_C - -#endif /* MRCP_SERVER_TYPES_H */ diff --git a/libs/unimrcp/libs/mrcp-server/mrcpserver.vcproj b/libs/unimrcp/libs/mrcp-server/mrcpserver.vcproj deleted file mode 100644 index da47c522b9..0000000000 --- a/libs/unimrcp/libs/mrcp-server/mrcpserver.vcproj +++ /dev/null @@ -1,272 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/libs/mrcp-server/mrcpserver.vcxproj b/libs/unimrcp/libs/mrcp-server/mrcpserver.vcxproj deleted file mode 100644 index 1d3fff21bc..0000000000 --- a/libs/unimrcp/libs/mrcp-server/mrcpserver.vcxproj +++ /dev/null @@ -1,127 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {18B1F35A-10F8-4287-9B37-2D10501B0B38} - mrcpserver - Win32Proj - - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - X64 - - - ProgramDatabase - - - - - X64 - - - - - - - - - - - - - - {843425be-9a9a-44f4-a4e3-4b57d6abd53c} - false - - - {12a49562-bab9-43a3-a21d-15b60bbb4c31} - false - - - {a9edac04-6a5f-4ba7-bc0d-cce7b255b6ea} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp-server/mrcpserver.vcxproj.filters b/libs/unimrcp/libs/mrcp-server/mrcpserver.vcxproj.filters deleted file mode 100644 index 866a6dfbbc..0000000000 --- a/libs/unimrcp/libs/mrcp-server/mrcpserver.vcxproj.filters +++ /dev/null @@ -1,32 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {4557fd27-79b0-442d-809b-82996c7da820} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - include - - - include - - - include - - - - - src - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp-server/src/mrcp_server.c b/libs/unimrcp/libs/mrcp-server/src/mrcp_server.c deleted file mode 100644 index d37528917e..0000000000 --- a/libs/unimrcp/libs/mrcp-server/src/mrcp_server.c +++ /dev/null @@ -1,999 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_server.c 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $ - */ - -#include "mrcp_server.h" -#include "mrcp_server_session.h" -#include "mrcp_message.h" -#include "mrcp_resource_factory.h" -#include "mrcp_resource.h" -#include "mrcp_engine_factory.h" -#include "mrcp_engine_loader.h" -#include "mrcp_sig_agent.h" -#include "mrcp_server_connection.h" -#include "mpf_termination_factory.h" -#include "apt_pool.h" -#include "apt_consumer_task.h" -#include "apt_obj_list.h" -#include "apt_log.h" - -#define SERVER_TASK_NAME "MRCP Server" - -/** MRCP server */ -struct mrcp_server_t { - /** Main message processing task */ - apt_consumer_task_t *task; - - /** MRCP resource factory */ - mrcp_resource_factory_t *resource_factory; - /** MRCP engine factory */ - mrcp_engine_factory_t *engine_factory; - /** Loader of plugins for MRCP engines */ - mrcp_engine_loader_t *engine_loader; - - /** Codec manager */ - mpf_codec_manager_t *codec_manager; - /** Table of media processing engines (mpf_engine_t*) */ - apr_hash_t *media_engine_table; - /** Table of RTP termination factories (mpf_termination_factory_t*) */ - apr_hash_t *rtp_factory_table; - /** Table of signaling agents (mrcp_sig_agent_t*) */ - apr_hash_t *sig_agent_table; - /** Table of connection agents (mrcp_connection_agent_t*) */ - apr_hash_t *cnt_agent_table; - /** Table of RTP settings (mpf_rtp_settings_t*) */ - apr_hash_t *rtp_settings_table; - /** Table of profiles (mrcp_server_profile_t*) */ - apr_hash_t *profile_table; - - /** Table of sessions */ - apr_hash_t *session_table; - - /** Connection task message pool */ - apt_task_msg_pool_t *connection_msg_pool; - /** Engine task message pool */ - apt_task_msg_pool_t *engine_msg_pool; - - /** Dir layout structure */ - apt_dir_layout_t *dir_layout; - /** Time server started at */ - apr_time_t start_time; - /** Memory pool */ - apr_pool_t *pool; -}; - - -typedef enum { - MRCP_SERVER_SIGNALING_TASK_MSG = TASK_MSG_USER, - MRCP_SERVER_CONNECTION_TASK_MSG, - MRCP_SERVER_ENGINE_TASK_MSG, - MRCP_SERVER_MEDIA_TASK_MSG -} mrcp_server_task_msg_type_e; - - -static apt_bool_t mrcp_server_offer_signal(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor); -static apt_bool_t mrcp_server_terminate_signal(mrcp_session_t *session); -static apt_bool_t mrcp_server_control_signal(mrcp_session_t *session, mrcp_message_t *message); - -static const mrcp_session_request_vtable_t session_request_vtable = { - mrcp_server_offer_signal, - mrcp_server_terminate_signal, - mrcp_server_control_signal, - NULL /* mrcp_server_discover_signal */ -}; - - -/* Connection agent interface */ -typedef enum { - CONNECTION_AGENT_TASK_MSG_ADD_CHANNEL, - CONNECTION_AGENT_TASK_MSG_MODIFY_CHANNEL, - CONNECTION_AGENT_TASK_MSG_REMOVE_CHANNEL, - CONNECTION_AGENT_TASK_MSG_RECEIVE_MESSAGE, - CONNECTION_AGENT_TASK_MSG_DISCONNECT -} connection_agent_task_msg_type_e; - -typedef struct connection_agent_task_msg_data_t connection_agent_task_msg_data_t; -struct connection_agent_task_msg_data_t { - mrcp_channel_t *channel; - mrcp_control_descriptor_t *descriptor; - mrcp_message_t *message; - apt_bool_t status; -}; - -static apt_bool_t mrcp_server_channel_add_signal(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status); -static apt_bool_t mrcp_server_channel_modify_signal(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status); -static apt_bool_t mrcp_server_channel_remove_signal(mrcp_control_channel_t *channel, apt_bool_t status); -static apt_bool_t mrcp_server_message_signal(mrcp_control_channel_t *channel, mrcp_message_t *message); -static apt_bool_t mrcp_server_disconnect_signal(mrcp_control_channel_t *channel); - -static const mrcp_connection_event_vtable_t connection_method_vtable = { - mrcp_server_channel_add_signal, - mrcp_server_channel_modify_signal, - mrcp_server_channel_remove_signal, - mrcp_server_message_signal, - mrcp_server_disconnect_signal -}; - - -/* MRCP engine interface */ -typedef enum { - ENGINE_TASK_MSG_OPEN_ENGINE, - ENGINE_TASK_MSG_CLOSE_ENGINE, - ENGINE_TASK_MSG_OPEN_CHANNEL, - ENGINE_TASK_MSG_CLOSE_CHANNEL, - ENGINE_TASK_MSG_MESSAGE -} engine_task_msg_type_e; - -typedef struct engine_task_msg_data_t engine_task_msg_data_t; -struct engine_task_msg_data_t { - mrcp_engine_t *engine; - mrcp_channel_t *channel; - apt_bool_t status; - mrcp_message_t *mrcp_message; -}; - -static apt_bool_t mrcp_server_engine_open_signal(mrcp_engine_t *engine, apt_bool_t status); -static apt_bool_t mrcp_server_engine_close_signal(mrcp_engine_t *engine); - -const mrcp_engine_event_vtable_t engine_vtable = { - mrcp_server_engine_open_signal, - mrcp_server_engine_close_signal, -}; - -static apt_bool_t mrcp_server_channel_open_signal(mrcp_engine_channel_t *channel, apt_bool_t status); -static apt_bool_t mrcp_server_channel_close_signal(mrcp_engine_channel_t *channel); -static apt_bool_t mrcp_server_channel_message_signal(mrcp_engine_channel_t *channel, mrcp_message_t *message); - -const mrcp_engine_channel_event_vtable_t engine_channel_vtable = { - mrcp_server_channel_open_signal, - mrcp_server_channel_close_signal, - mrcp_server_channel_message_signal -}; - -/* Task interface */ -static apt_bool_t mrcp_server_msg_process(apt_task_t *task, apt_task_msg_t *msg); -static apt_bool_t mrcp_server_start_request_process(apt_task_t *task); -static apt_bool_t mrcp_server_terminate_request_process(apt_task_t *task); -static void mrcp_server_on_start_complete(apt_task_t *task); -static void mrcp_server_on_terminate_complete(apt_task_t *task); - -static mrcp_session_t* mrcp_server_sig_agent_session_create(mrcp_sig_agent_t *signaling_agent); - - -/** Create MRCP server instance */ -MRCP_DECLARE(mrcp_server_t*) mrcp_server_create(apt_dir_layout_t *dir_layout) -{ - mrcp_server_t *server; - apr_pool_t *pool; - apt_task_t *task; - apt_task_vtable_t *vtable; - apt_task_msg_pool_t *msg_pool; - - pool = apt_pool_create(); - if(!pool) { - return NULL; - } - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create "SERVER_TASK_NAME); - server = apr_palloc(pool,sizeof(mrcp_server_t)); - server->pool = pool; - server->dir_layout = dir_layout; - server->resource_factory = NULL; - server->engine_factory = NULL; - server->engine_loader = NULL; - server->media_engine_table = NULL; - server->rtp_factory_table = NULL; - server->sig_agent_table = NULL; - server->cnt_agent_table = NULL; - server->rtp_settings_table = NULL; - server->profile_table = NULL; - server->session_table = NULL; - server->connection_msg_pool = NULL; - server->engine_msg_pool = NULL; - - msg_pool = apt_task_msg_pool_create_dynamic(0,pool); - - server->task = apt_consumer_task_create(server,msg_pool,pool); - if(!server->task) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Server Task"); - return NULL; - } - task = apt_consumer_task_base_get(server->task); - apt_task_name_set(task,SERVER_TASK_NAME); - vtable = apt_task_vtable_get(task); - if(vtable) { - vtable->process_msg = mrcp_server_msg_process; - vtable->process_start = mrcp_server_start_request_process; - vtable->process_terminate = mrcp_server_terminate_request_process; - vtable->on_start_complete = mrcp_server_on_start_complete; - vtable->on_terminate_complete = mrcp_server_on_terminate_complete; - } - - server->engine_factory = mrcp_engine_factory_create(server->pool); - server->engine_loader = mrcp_engine_loader_create(server->pool); - - server->media_engine_table = apr_hash_make(server->pool); - server->rtp_factory_table = apr_hash_make(server->pool); - server->rtp_settings_table = apr_hash_make(server->pool); - server->sig_agent_table = apr_hash_make(server->pool); - server->cnt_agent_table = apr_hash_make(server->pool); - - server->profile_table = apr_hash_make(server->pool); - - server->session_table = apr_hash_make(server->pool); - return server; -} - -/** Start message processing loop */ -MRCP_DECLARE(apt_bool_t) mrcp_server_start(mrcp_server_t *server) -{ - apt_task_t *task; - if(!server || !server->task) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid Server"); - return FALSE; - } - server->start_time = apr_time_now(); - task = apt_consumer_task_base_get(server->task); - if(apt_task_start(task) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Start Server Task"); - return FALSE; - } - return TRUE; -} - -/** Shutdown message processing loop */ -MRCP_DECLARE(apt_bool_t) mrcp_server_shutdown(mrcp_server_t *server) -{ - apt_task_t *task; - apr_time_t uptime; - if(!server || !server->task) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid Server"); - return FALSE; - } - task = apt_consumer_task_base_get(server->task); - if(apt_task_terminate(task,TRUE) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Shutdown Server Task"); - return FALSE; - } - server->session_table = NULL; - uptime = apr_time_now() - server->start_time; - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Server Uptime [%"APR_TIME_T_FMT" sec]", apr_time_sec(uptime)); - return TRUE; -} - -/** Destroy MRCP server */ -MRCP_DECLARE(apt_bool_t) mrcp_server_destroy(mrcp_server_t *server) -{ - apt_task_t *task; - if(!server || !server->task) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid Server"); - return FALSE; - } - - mrcp_engine_factory_destroy(server->engine_factory); - mrcp_engine_loader_destroy(server->engine_loader); - - task = apt_consumer_task_base_get(server->task); - apt_task_destroy(task); - - apr_pool_destroy(server->pool); - return TRUE; -} - -/** Register MRCP resource factory */ -MRCP_DECLARE(apt_bool_t) mrcp_server_resource_factory_register(mrcp_server_t *server, mrcp_resource_factory_t *resource_factory) -{ - if(!resource_factory) { - return FALSE; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Resource Factory"); - server->resource_factory = resource_factory; - return TRUE; -} - -/** Register MRCP engine */ -MRCP_DECLARE(apt_bool_t) mrcp_server_engine_register(mrcp_server_t *server, mrcp_engine_t *engine) -{ - if(!engine || !engine->id) { - return FALSE; - } - - if(!server->engine_msg_pool) { - server->engine_msg_pool = apt_task_msg_pool_create_dynamic(sizeof(engine_task_msg_data_t),server->pool); - } - engine->codec_manager = server->codec_manager; - engine->dir_layout = server->dir_layout; - engine->event_vtable = &engine_vtable; - engine->event_obj = server; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register MRCP Engine [%s]",engine->id); - return mrcp_engine_factory_engine_register(server->engine_factory,engine); -} - -/** Register codec manager */ -MRCP_DECLARE(apt_bool_t) mrcp_server_codec_manager_register(mrcp_server_t *server, mpf_codec_manager_t *codec_manager) -{ - if(!codec_manager) { - return FALSE; - } - server->codec_manager = codec_manager; - return TRUE; -} - -/** Get registered codec manager */ -MRCP_DECLARE(const mpf_codec_manager_t*) mrcp_server_codec_manager_get(const mrcp_server_t *server) -{ - return server->codec_manager; -} - -/** Register media engine */ -MRCP_DECLARE(apt_bool_t) mrcp_server_media_engine_register(mrcp_server_t *server, mpf_engine_t *media_engine) -{ - const char *id; - if(!media_engine) { - return FALSE; - } - id = mpf_engine_id_get(media_engine); - if(!id) { - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Media Engine [%s]",id); - mpf_engine_codec_manager_register(media_engine,server->codec_manager); - apr_hash_set(server->media_engine_table,id,APR_HASH_KEY_STRING,media_engine); - mpf_engine_task_msg_type_set(media_engine,MRCP_SERVER_MEDIA_TASK_MSG); - if(server->task) { - apt_task_t *media_task = mpf_task_get(media_engine); - apt_task_t *task = apt_consumer_task_base_get(server->task); - apt_task_add(task,media_task); - } - return TRUE; -} - -/** Get media engine by name */ -MRCP_DECLARE(mpf_engine_t*) mrcp_server_media_engine_get(const mrcp_server_t *server, const char *name) -{ - return apr_hash_get(server->media_engine_table,name,APR_HASH_KEY_STRING); -} - -/** Register RTP termination factory */ -MRCP_DECLARE(apt_bool_t) mrcp_server_rtp_factory_register(mrcp_server_t *server, mpf_termination_factory_t *rtp_termination_factory, const char *name) -{ - if(!rtp_termination_factory || !name) { - return FALSE; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register RTP Termination Factory [%s]",name); - apr_hash_set(server->rtp_factory_table,name,APR_HASH_KEY_STRING,rtp_termination_factory); - return TRUE; -} - -/** Get RTP termination factory by name */ -MRCP_DECLARE(mpf_termination_factory_t*) mrcp_server_rtp_factory_get(const mrcp_server_t *server, const char *name) -{ - return apr_hash_get(server->rtp_factory_table,name,APR_HASH_KEY_STRING); -} - -/** Register RTP settings */ -MRCP_DECLARE(apt_bool_t) mrcp_server_rtp_settings_register(mrcp_server_t *server, mpf_rtp_settings_t *rtp_settings, const char *name) -{ - if(!rtp_settings || !name) { - return FALSE; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register RTP Settings [%s]",name); - apr_hash_set(server->rtp_settings_table,name,APR_HASH_KEY_STRING,rtp_settings); - return TRUE; -} - -/** Get RTP settings by name */ -MRCP_DECLARE(mpf_rtp_settings_t*) mrcp_server_rtp_settings_get(const mrcp_server_t *server, const char *name) -{ - return apr_hash_get(server->rtp_settings_table,name,APR_HASH_KEY_STRING); -} - -/** Register MRCP signaling agent */ -MRCP_DECLARE(apt_bool_t) mrcp_server_signaling_agent_register(mrcp_server_t *server, mrcp_sig_agent_t *signaling_agent) -{ - if(!signaling_agent || !signaling_agent->id) { - return FALSE; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Signaling Agent [%s]",signaling_agent->id); - signaling_agent->parent = server; - signaling_agent->resource_factory = server->resource_factory; - signaling_agent->create_server_session = mrcp_server_sig_agent_session_create; - signaling_agent->msg_pool = apt_task_msg_pool_create_dynamic(sizeof(mrcp_signaling_message_t*),server->pool); - apr_hash_set(server->sig_agent_table,signaling_agent->id,APR_HASH_KEY_STRING,signaling_agent); - if(server->task) { - apt_task_t *task = apt_consumer_task_base_get(server->task); - apt_task_add(task,signaling_agent->task); - } - return TRUE; -} - -/** Get signaling agent by name */ -MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_server_signaling_agent_get(const mrcp_server_t *server, const char *name) -{ - return apr_hash_get(server->sig_agent_table,name,APR_HASH_KEY_STRING); -} - -/** Register MRCP connection agent (MRCPv2 only) */ -MRCP_DECLARE(apt_bool_t) mrcp_server_connection_agent_register(mrcp_server_t *server, mrcp_connection_agent_t *connection_agent) -{ - const char *id; - if(!connection_agent) { - return FALSE; - } - id = mrcp_server_connection_agent_id_get(connection_agent); - if(!id) { - return FALSE; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Connection Agent [%s]",id); - mrcp_server_connection_resource_factory_set(connection_agent,server->resource_factory); - mrcp_server_connection_agent_handler_set(connection_agent,server,&connection_method_vtable); - server->connection_msg_pool = apt_task_msg_pool_create_dynamic(sizeof(connection_agent_task_msg_data_t),server->pool); - apr_hash_set(server->cnt_agent_table,id,APR_HASH_KEY_STRING,connection_agent); - if(server->task) { - apt_task_t *task = apt_consumer_task_base_get(server->task); - apt_task_t *connection_task = mrcp_server_connection_agent_task_get(connection_agent); - apt_task_add(task,connection_task); - } - return TRUE; -} - -/** Get connection agent by name */ -MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_server_connection_agent_get(const mrcp_server_t *server, const char *name) -{ - return apr_hash_get(server->cnt_agent_table,name,APR_HASH_KEY_STRING); -} - -/** Create MRCP profile */ -MRCP_DECLARE(mrcp_server_profile_t*) mrcp_server_profile_create( - const char *id, - mrcp_version_e mrcp_version, - mrcp_resource_factory_t *resource_factory, - mrcp_sig_agent_t *signaling_agent, - mrcp_connection_agent_t *connection_agent, - mpf_engine_t *media_engine, - mpf_termination_factory_t *rtp_factory, - mpf_rtp_settings_t *rtp_settings, - apr_pool_t *pool) -{ - mrcp_server_profile_t *profile = apr_palloc(pool,sizeof(mrcp_server_profile_t)); - profile->id = id; - profile->mrcp_version = mrcp_version; - profile->resource_factory = resource_factory; - profile->engine_table = NULL; - profile->media_engine = media_engine; - profile->rtp_termination_factory = rtp_factory; - profile->rtp_settings = rtp_settings; - profile->signaling_agent = signaling_agent; - profile->connection_agent = connection_agent; - - mpf_termination_factory_engine_assign(rtp_factory,media_engine); - return profile; -} - -static apt_bool_t mrcp_server_engine_table_make(mrcp_server_t *server, mrcp_server_profile_t *profile, apr_table_t *plugin_map) -{ - int i; - mrcp_resource_t *resource; - const char *plugin_name = NULL; - mrcp_engine_t *engine; - - profile->engine_table = apr_hash_make(server->pool); - for(i=0; iresource_factory,i); - if(!resource) continue; - - engine = NULL; - /* first, try to find engine by name specified in plugin map (if available) */ - if(plugin_map) { - plugin_name = apr_table_get(plugin_map,resource->name.buf); - if(plugin_name) { - engine = mrcp_engine_factory_engine_get(server->engine_factory,plugin_name); - } - } - - /* next, if no engine found or specified, try to find the first available one */ - if(!engine) { - engine = mrcp_engine_factory_engine_find(server->engine_factory,i); - } - - if(engine) { - if(engine->id) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Assign MRCP Engine [%s] [%s]",resource->name.buf,engine->id); - } - apr_hash_set(profile->engine_table,resource->name.buf,resource->name.length,engine); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No MRCP Engine Available [%s]",resource->name.buf); - } - } - - return TRUE; -} - -/** Register MRCP profile */ -MRCP_DECLARE(apt_bool_t) mrcp_server_profile_register( - mrcp_server_t *server, - mrcp_server_profile_t *profile, - apr_table_t *plugin_map) -{ - if(!profile || !profile->id) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile: no name"); - return FALSE; - } - if(!profile->resource_factory) { - if(!server->resource_factory) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile [%s]: missing resource factory",profile->id); - return FALSE; - } - profile->resource_factory = server->resource_factory; - } - mrcp_server_engine_table_make(server,profile,plugin_map); - - if(!profile->signaling_agent) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile [%s]: missing signaling agent",profile->id); - return FALSE; - } - if(profile->mrcp_version == MRCP_VERSION_2 && - !profile->connection_agent) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile [%s]: missing connection agent",profile->id); - return FALSE; - } - if(!profile->media_engine) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile [%s]: missing media engine",profile->id); - return FALSE; - } - if(!profile->rtp_termination_factory) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile [%s]: missing RTP factory",profile->id); - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Profile [%s]",profile->id); - apr_hash_set(server->profile_table,profile->id,APR_HASH_KEY_STRING,profile); - return TRUE; -} - -/** Get profile by name */ -MRCP_DECLARE(mrcp_server_profile_t*) mrcp_server_profile_get(const mrcp_server_t *server, const char *name) -{ - return apr_hash_get(server->profile_table,name,APR_HASH_KEY_STRING); -} - -/** Load MRCP engine */ -MRCP_DECLARE(mrcp_engine_t*) mrcp_server_engine_load( - mrcp_server_t *server, - const char *id, - const char *path, - mrcp_engine_config_t *config) -{ - mrcp_engine_t *engine; - if(!id || !path || !config) { - return FALSE; - } - - engine = mrcp_engine_loader_plugin_load(server->engine_loader,id,path,config); - if(!engine) { - return FALSE; - } - - return engine; -} - -MRCP_DECLARE(apr_pool_t*) mrcp_server_memory_pool_get(const mrcp_server_t *server) -{ - return server->pool; -} - -void mrcp_server_session_add(mrcp_server_session_t *session) -{ - if(session->base.id.buf) { - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Add Session "APT_SID_FMT,MRCP_SESSION_SID(&session->base)); - apr_hash_set(session->server->session_table,session->base.id.buf,session->base.id.length,session); - } -} - -void mrcp_server_session_remove(mrcp_server_session_t *session) -{ - if(session->base.id.buf) { - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Remove Session "APT_SID_FMT,MRCP_SESSION_SID(&session->base)); - apr_hash_set(session->server->session_table,session->base.id.buf,session->base.id.length,NULL); - } -} - -static APR_INLINE mrcp_server_session_t* mrcp_server_session_find(mrcp_server_t *server, const apt_str_t *session_id) -{ - return apr_hash_get(server->session_table,session_id->buf,session_id->length); -} - -static apt_bool_t mrcp_server_start_request_process(apt_task_t *task) -{ - apt_consumer_task_t *consumer_task = apt_task_object_get(task); - mrcp_server_t *server = apt_consumer_task_object_get(consumer_task); - - mrcp_engine_t *engine; - apr_hash_index_t *it; - void *val; - it = mrcp_engine_factory_engine_first(server->engine_factory); - for(; it; it = apr_hash_next(it)) { - apr_hash_this(it,NULL,NULL,&val); - engine = val; - if(engine) { - if(mrcp_engine_virtual_open(engine) == TRUE) { - apt_task_start_request_add(task); - } - } - } - - return apt_task_start_request_process(task); -} - -static apt_bool_t mrcp_server_terminate_request_process(apt_task_t *task) -{ - apt_consumer_task_t *consumer_task = apt_task_object_get(task); - mrcp_server_t *server = apt_consumer_task_object_get(consumer_task); - - mrcp_engine_t *engine; - apr_hash_index_t *it; - void *val; - it = mrcp_engine_factory_engine_first(server->engine_factory); - for(; it; it = apr_hash_next(it)) { - apr_hash_this(it,NULL,NULL,&val); - engine = val; - if(engine) { - if(mrcp_engine_virtual_close(engine) == TRUE) { - apt_task_terminate_request_add(task); - } - } - } - - return apt_task_terminate_request_process(task); -} - -static void mrcp_server_on_start_complete(apt_task_t *task) -{ - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,SERVER_TASK_NAME" Started"); -} - -static void mrcp_server_on_terminate_complete(apt_task_t *task) -{ - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,SERVER_TASK_NAME" Terminated"); -} - -static apt_bool_t mrcp_server_msg_process(apt_task_t *task, apt_task_msg_t *msg) -{ - switch(msg->type) { - case MRCP_SERVER_SIGNALING_TASK_MSG: - { - mrcp_signaling_message_t **signaling_message = (mrcp_signaling_message_t**) msg->data; - mrcp_server_signaling_message_process(*signaling_message); - break; - } - case MRCP_SERVER_CONNECTION_TASK_MSG: - { - const connection_agent_task_msg_data_t *connection_message = (const connection_agent_task_msg_data_t*)msg->data; - switch(msg->sub_type) { - case CONNECTION_AGENT_TASK_MSG_ADD_CHANNEL: - { - mrcp_server_on_channel_modify(connection_message->channel,connection_message->descriptor,connection_message->status); - break; - } - case CONNECTION_AGENT_TASK_MSG_MODIFY_CHANNEL: - { - mrcp_server_on_channel_modify(connection_message->channel,connection_message->descriptor,connection_message->status); - break; - } - case CONNECTION_AGENT_TASK_MSG_REMOVE_CHANNEL: - { - mrcp_server_on_channel_remove(connection_message->channel,connection_message->status); - break; - } - case CONNECTION_AGENT_TASK_MSG_RECEIVE_MESSAGE: - { - mrcp_server_on_channel_message(connection_message->channel, connection_message->message); - break; - } - case CONNECTION_AGENT_TASK_MSG_DISCONNECT: - { - mrcp_server_on_channel_message(connection_message->channel, connection_message->message); - break; - } - default: - break; - } - break; - } - case MRCP_SERVER_ENGINE_TASK_MSG: - { - engine_task_msg_data_t *data = (engine_task_msg_data_t*)msg->data; - switch(msg->sub_type) { - case ENGINE_TASK_MSG_OPEN_ENGINE: - mrcp_engine_on_open(data->engine,data->status); - apt_task_start_request_remove(task); - break; - case ENGINE_TASK_MSG_CLOSE_ENGINE: - mrcp_engine_on_close(data->engine); - apt_task_terminate_request_remove(task); - break; - case ENGINE_TASK_MSG_OPEN_CHANNEL: - mrcp_server_on_engine_channel_open(data->channel,data->status); - break; - case ENGINE_TASK_MSG_CLOSE_CHANNEL: - mrcp_server_on_engine_channel_close(data->channel); - break; - case ENGINE_TASK_MSG_MESSAGE: - mrcp_server_on_engine_channel_message(data->channel,data->mrcp_message); - break; - default: - break; - } - break; - } - case MRCP_SERVER_MEDIA_TASK_MSG: - { - mpf_message_container_t *mpf_message_container = (mpf_message_container_t*) msg->data; - mrcp_server_mpf_message_process(mpf_message_container); - break; - } - default: - { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Task Message Received [%d;%d]", msg->type,msg->sub_type); - break; - } - } - return TRUE; -} - -static apt_bool_t mrcp_server_signaling_task_msg_signal(mrcp_signaling_message_type_e type, mrcp_session_t *session, mrcp_session_descriptor_t *descriptor, mrcp_message_t *message) -{ - mrcp_signaling_message_t *signaling_message; - apt_task_msg_t *task_msg = apt_task_msg_acquire(session->signaling_agent->msg_pool); - mrcp_signaling_message_t **slot = ((mrcp_signaling_message_t**)task_msg->data); - task_msg->type = MRCP_SERVER_SIGNALING_TASK_MSG; - task_msg->sub_type = type; - - signaling_message = apr_palloc(session->pool,sizeof(mrcp_signaling_message_t)); - signaling_message->type = type; - signaling_message->session = (mrcp_server_session_t*)session; - signaling_message->descriptor = descriptor; - signaling_message->channel = NULL; - signaling_message->message = message; - *slot = signaling_message; - - return apt_task_msg_parent_signal(session->signaling_agent->task,task_msg); -} - -static apt_bool_t mrcp_server_connection_task_msg_signal( - connection_agent_task_msg_type_e type, - mrcp_connection_agent_t *agent, - mrcp_control_channel_t *channel, - mrcp_control_descriptor_t *descriptor, - mrcp_message_t *message, - apt_bool_t status) -{ - mrcp_server_t *server = mrcp_server_connection_agent_object_get(agent); - apt_task_t *task = apt_consumer_task_base_get(server->task); - connection_agent_task_msg_data_t *data; - apt_task_msg_t *task_msg = apt_task_msg_acquire(server->connection_msg_pool); - task_msg->type = MRCP_SERVER_CONNECTION_TASK_MSG; - task_msg->sub_type = type; - data = (connection_agent_task_msg_data_t*) task_msg->data; - data->channel = channel ? channel->obj : NULL; - data->descriptor = descriptor; - data->message = message; - data->status = status; - - return apt_task_msg_signal(task,task_msg); -} - -static apt_bool_t mrcp_server_engine_task_msg_signal( - engine_task_msg_type_e type, - mrcp_engine_t *engine, - apt_bool_t status) -{ - mrcp_server_t *server = engine->event_obj; - apt_task_t *task = apt_consumer_task_base_get(server->task); - engine_task_msg_data_t *data; - apt_task_msg_t *task_msg = apt_task_msg_acquire(server->engine_msg_pool); - task_msg->type = MRCP_SERVER_ENGINE_TASK_MSG; - task_msg->sub_type = type; - data = (engine_task_msg_data_t*) task_msg->data; - data->engine = engine; - data->channel = NULL; - data->status = status; - data->mrcp_message = NULL; - - return apt_task_msg_signal(task,task_msg); -} - -static apt_bool_t mrcp_server_channel_task_msg_signal( - engine_task_msg_type_e type, - mrcp_engine_channel_t *engine_channel, - apt_bool_t status, - mrcp_message_t *message) -{ - mrcp_channel_t *channel = engine_channel->event_obj; - mrcp_session_t *session = mrcp_server_channel_session_get(channel); - mrcp_server_t *server = session->signaling_agent->parent; - apt_task_t *task = apt_consumer_task_base_get(server->task); - engine_task_msg_data_t *data; - apt_task_msg_t *task_msg = apt_task_msg_acquire(server->engine_msg_pool); - task_msg->type = MRCP_SERVER_ENGINE_TASK_MSG; - task_msg->sub_type = type; - data = (engine_task_msg_data_t*) task_msg->data; - data->engine = engine_channel->engine; - data->channel = channel; - data->status = status; - data->mrcp_message = message; - - return apt_task_msg_signal(task,task_msg); -} - -static mrcp_server_profile_t* mrcp_server_profile_get_by_agent(mrcp_server_t *server, mrcp_server_session_t *session, const mrcp_sig_agent_t *signaling_agent) -{ - mrcp_server_profile_t *profile; - apr_hash_index_t *it; - void *val; - it = apr_hash_first(session->base.pool,server->profile_table); - for(; it; it = apr_hash_next(it)) { - apr_hash_this(it,NULL,NULL,&val); - profile = val; - if(profile && profile->signaling_agent == signaling_agent) { - return profile; - } - } - return NULL; -} - -static mrcp_session_t* mrcp_server_sig_agent_session_create(mrcp_sig_agent_t *signaling_agent) -{ - mrcp_server_t *server = signaling_agent->parent; - mrcp_server_session_t *session = mrcp_server_session_create(); - session->server = server; - session->profile = mrcp_server_profile_get_by_agent(server,session,signaling_agent); - if(!session->profile) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot Find Profile by Agent "APT_NAMESID_FMT, - session->base.name, - MRCP_SESSION_SID(&session->base)); - mrcp_session_destroy(&session->base); - return NULL; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create Session "APT_NAMESID_FMT" [%s]", - session->base.name, - MRCP_SESSION_SID(&session->base), - session->profile->id); - session->base.signaling_agent = signaling_agent; - session->base.request_vtable = &session_request_vtable; - return &session->base; -} - -static apt_bool_t mrcp_server_offer_signal(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor) -{ - return mrcp_server_signaling_task_msg_signal(SIGNALING_MESSAGE_OFFER,session,descriptor,NULL); -} - -static apt_bool_t mrcp_server_terminate_signal(mrcp_session_t *session) -{ - return mrcp_server_signaling_task_msg_signal(SIGNALING_MESSAGE_TERMINATE,session,NULL,NULL); -} - -static apt_bool_t mrcp_server_control_signal(mrcp_session_t *session, mrcp_message_t *message) -{ - return mrcp_server_signaling_task_msg_signal(SIGNALING_MESSAGE_CONTROL,session,NULL,message); -} - -static apt_bool_t mrcp_server_channel_add_signal(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status) -{ - mrcp_connection_agent_t *agent = channel->agent; - return mrcp_server_connection_task_msg_signal( - CONNECTION_AGENT_TASK_MSG_ADD_CHANNEL, - agent, - channel, - descriptor, - NULL, - status); -} - -static apt_bool_t mrcp_server_channel_modify_signal(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status) -{ - mrcp_connection_agent_t *agent = channel->agent; - return mrcp_server_connection_task_msg_signal( - CONNECTION_AGENT_TASK_MSG_MODIFY_CHANNEL, - agent, - channel, - descriptor, - NULL, - status); -} - -static apt_bool_t mrcp_server_channel_remove_signal(mrcp_control_channel_t *channel, apt_bool_t status) -{ - mrcp_connection_agent_t *agent = channel->agent; - return mrcp_server_connection_task_msg_signal( - CONNECTION_AGENT_TASK_MSG_REMOVE_CHANNEL, - agent, - channel, - NULL, - NULL, - status); -} - -static apt_bool_t mrcp_server_message_signal(mrcp_control_channel_t *channel, mrcp_message_t *message) -{ - mrcp_connection_agent_t *agent = channel->agent; - return mrcp_server_connection_task_msg_signal( - CONNECTION_AGENT_TASK_MSG_RECEIVE_MESSAGE, - agent, - channel, - NULL, - message, - TRUE); -} - -static apt_bool_t mrcp_server_disconnect_signal(mrcp_control_channel_t *channel) -{ - mrcp_connection_agent_t *agent = channel->agent; - return mrcp_server_connection_task_msg_signal( - CONNECTION_AGENT_TASK_MSG_DISCONNECT, - agent, - channel, - NULL, - NULL, - TRUE); -} - -static apt_bool_t mrcp_server_engine_open_signal(mrcp_engine_t *engine, apt_bool_t status) -{ - return mrcp_server_engine_task_msg_signal( - ENGINE_TASK_MSG_OPEN_ENGINE, - engine, - status); -} - -static apt_bool_t mrcp_server_engine_close_signal(mrcp_engine_t *engine) -{ - return mrcp_server_engine_task_msg_signal( - ENGINE_TASK_MSG_CLOSE_ENGINE, - engine, - TRUE); -} - -static apt_bool_t mrcp_server_channel_open_signal(mrcp_engine_channel_t *channel, apt_bool_t status) -{ - return mrcp_server_channel_task_msg_signal( - ENGINE_TASK_MSG_OPEN_CHANNEL, - channel, - status, - NULL); -} - -static apt_bool_t mrcp_server_channel_close_signal(mrcp_engine_channel_t *channel) -{ - return mrcp_server_channel_task_msg_signal( - ENGINE_TASK_MSG_CLOSE_CHANNEL, - channel, - TRUE, - NULL); -} - -static apt_bool_t mrcp_server_channel_message_signal(mrcp_engine_channel_t *channel, mrcp_message_t *message) -{ - return mrcp_server_channel_task_msg_signal( - ENGINE_TASK_MSG_MESSAGE, - channel, - TRUE, - message); -} diff --git a/libs/unimrcp/libs/mrcp-server/src/mrcp_server_session.c b/libs/unimrcp/libs/mrcp-server/src/mrcp_server_session.c deleted file mode 100644 index c2dfb0b98f..0000000000 --- a/libs/unimrcp/libs/mrcp-server/src/mrcp_server_session.c +++ /dev/null @@ -1,1191 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_server_session.c 2237 2014-11-12 01:48:46Z achaloyan@gmail.com $ - */ - -#include "mrcp_server.h" -#include "mrcp_server_session.h" -#include "mrcp_resource.h" -#include "mrcp_resource_factory.h" -#include "mrcp_engine_iface.h" -#include "mrcp_sig_agent.h" -#include "mrcp_server_connection.h" -#include "mrcp_session_descriptor.h" -#include "mrcp_control_descriptor.h" -#include "mrcp_state_machine.h" -#include "mrcp_message.h" -#include "mpf_termination_factory.h" -#include "mpf_stream.h" -#include "apt_consumer_task.h" -#include "apt_log.h" - -/** Macro to log session name and identifier */ -#define MRCP_SESSION_NAMESID(session) \ - session->base.name, MRCP_SESSION_SID(&session->base) - -#define MRCP_SESSION_ID_HEX_STRING_LENGTH 16 - -struct mrcp_channel_t { - /** Memory pool */ - apr_pool_t *pool; - /** MRCP resource */ - mrcp_resource_t *resource; - /** MRCP session entire channel belongs to */ - mrcp_session_t *session; - /** MRCP control channel */ - mrcp_control_channel_t *control_channel; - /** MRCP engine channel */ - mrcp_engine_channel_t *engine_channel; - /** MRCP resource state machine */ - mrcp_state_machine_t *state_machine; - /** media descriptor id (position in session descriptor) */ - apr_size_t id; - /** array of cmid attributes (used for resource grouping) */ - apr_array_header_t *cmid_arr; - /** waiting state of control media */ - apt_bool_t waiting_for_channel; - /** waiting state of media termination */ - apt_bool_t waiting_for_termination; -}; - -typedef struct mrcp_termination_slot_t mrcp_termination_slot_t; - -struct mrcp_termination_slot_t { - /** RTP termination */ - mpf_termination_t *termination; - /** media descriptor id (position in SDP message) */ - apr_size_t id; - /** media id (used for resource grouping) */ - apr_size_t mid; - /** Array of associated MRCP channels (mrcp_channel_t*) */ - apr_array_header_t *channels; - - /** waiting state */ - apt_bool_t waiting; -}; - -extern const mrcp_engine_channel_event_vtable_t engine_channel_vtable; - -void mrcp_server_session_add(mrcp_server_session_t *session); -void mrcp_server_session_remove(mrcp_server_session_t *session); - -static apt_bool_t mrcp_server_signaling_message_dispatch(mrcp_server_session_t *session, mrcp_signaling_message_t *signaling_message); - -static apt_bool_t mrcp_server_resource_offer_process(mrcp_server_session_t *session, mrcp_session_descriptor_t *descriptor); -static apt_bool_t mrcp_server_control_media_offer_process(mrcp_server_session_t *session, mrcp_session_descriptor_t *descriptor); -static apt_bool_t mrcp_server_av_media_offer_process(mrcp_server_session_t *session, mrcp_session_descriptor_t *descriptor); - -static apt_bool_t mrcp_server_engine_channels_update(mrcp_server_session_t *session); -static apt_bool_t mrcp_server_session_answer_send(mrcp_server_session_t *session); -static apt_bool_t mrcp_server_session_terminate_process(mrcp_server_session_t *session); -static apt_bool_t mrcp_server_session_terminate_send(mrcp_server_session_t *session); - -static mrcp_channel_t* mrcp_server_channel_find(mrcp_server_session_t *session, const apt_str_t *resource_name); - -static apt_bool_t state_machine_on_message_dispatch(mrcp_state_machine_t *state_machine, mrcp_message_t *message); -static apt_bool_t state_machine_on_deactivate(mrcp_state_machine_t *state_machine); - - -mrcp_server_session_t* mrcp_server_session_create() -{ - mrcp_server_session_t *session = (mrcp_server_session_t*) mrcp_session_create(sizeof(mrcp_server_session_t)-sizeof(mrcp_session_t)); - session->context = NULL; - session->terminations = apr_array_make(session->base.pool,2,sizeof(mrcp_termination_slot_t)); - session->channels = apr_array_make(session->base.pool,2,sizeof(mrcp_channel_t*)); - session->active_request = NULL; - session->request_queue = apt_list_create(session->base.pool); - session->offer = NULL; - session->answer = NULL; - session->mpf_task_msg = NULL; - session->subrequest_count = 0; - session->state = SESSION_STATE_NONE; - session->base.name = apr_psprintf(session->base.pool,"0x%pp",session); - return session; -} - -static APR_INLINE mrcp_version_e mrcp_session_version_get(mrcp_server_session_t *session) -{ - return session->profile->mrcp_version; -} - -static mrcp_engine_channel_t* mrcp_server_engine_channel_create( - mrcp_server_session_t *session, - mrcp_channel_t *channel, - const apt_str_t *resource_name) -{ - mrcp_engine_t *engine = apr_hash_get( - session->profile->engine_table, - resource_name->buf, - resource_name->length); - if(!engine) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Find MRCP Engine "APT_NAMESID_FMT" [%s]", - MRCP_SESSION_NAMESID(session), - resource_name->buf); - return NULL; - } - - channel->state_machine = engine->create_state_machine( - channel, - mrcp_session_version_get(session), - channel->pool); - if(channel->state_machine) { - channel->state_machine->on_dispatch = state_machine_on_message_dispatch; - channel->state_machine->on_deactivate = state_machine_on_deactivate; - } - - return mrcp_engine_channel_virtual_create(engine,mrcp_session_version_get(session),session->base.pool); -} - -static mrcp_channel_t* mrcp_server_channel_create(mrcp_server_session_t *session, const apt_str_t *resource_name, apr_size_t id, apr_array_header_t *cmid_arr) -{ - mrcp_channel_t *channel; - apr_pool_t *pool = session->base.pool; - - channel = apr_palloc(pool,sizeof(mrcp_channel_t)); - channel->pool = pool; - channel->session = &session->base; - channel->resource = NULL; - channel->control_channel = NULL; - channel->state_machine = NULL; - channel->engine_channel = NULL; - channel->id = id; - channel->cmid_arr = cmid_arr; - channel->waiting_for_channel = FALSE; - channel->waiting_for_termination = FALSE; - - if(resource_name && resource_name->buf) { - mrcp_resource_t *resource; - mrcp_engine_channel_t *engine_channel; - resource = mrcp_resource_find(session->profile->resource_factory,resource_name); - if(resource) { - channel->resource = resource; - if(mrcp_session_version_get(session) == MRCP_VERSION_2) { - channel->control_channel = mrcp_server_control_channel_create( - session->profile->connection_agent, - channel, - pool); - } - engine_channel = mrcp_server_engine_channel_create(session,channel,resource_name); - if(engine_channel) { - engine_channel->id = session->base.id; - engine_channel->event_obj = channel; - engine_channel->event_vtable = &engine_channel_vtable; - channel->engine_channel = engine_channel; - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Engine Channel "APT_NAMESID_FMT" [%s]", - MRCP_SESSION_NAMESID(session), - resource_name->buf); - session->answer->status = MRCP_SESSION_STATUS_UNACCEPTABLE_RESOURCE; - } - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Such Resource "APT_NAMESID_FMT" [%s]", - MRCP_SESSION_NAMESID(session), - resource_name->buf); - session->answer->status = MRCP_SESSION_STATUS_NO_SUCH_RESOURCE; - } - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid Resource Identifier "APT_NAMESID_FMT, - MRCP_SESSION_NAMESID(session)); - session->answer->status = MRCP_SESSION_STATUS_NO_SUCH_RESOURCE; - } - - return channel; -} - -static APR_INLINE void mrcp_server_session_state_set(mrcp_server_session_t *session, mrcp_server_session_state_e state) -{ - if(session->subrequest_count != 0) { - /* error case */ - session->subrequest_count = 0; - } - session->state = state; -} - -static APR_INLINE void mrcp_server_session_subrequest_add(mrcp_server_session_t *session) -{ - session->subrequest_count++; -} - -static void mrcp_server_session_subrequest_remove(mrcp_server_session_t *session) -{ - if(!session->subrequest_count) { - /* error case */ - return; - } - session->subrequest_count--; - if(!session->subrequest_count) { - switch(session->state) { - case SESSION_STATE_GENERATING_ANSWER: - mrcp_server_engine_channels_update(session); - break; - case SESSION_STATE_INITIALIZING: - /* send answer to client */ - mrcp_server_session_answer_send(session); - break; - case SESSION_STATE_DEACTIVATING: - mrcp_server_session_terminate_process(session); - break; - case SESSION_STATE_TERMINATING: - mrcp_server_session_terminate_send(session); - break; - default: - break; - } - } -} - -mrcp_session_t* mrcp_server_channel_session_get(mrcp_channel_t *channel) -{ - return channel->session; -} - -apt_bool_t mrcp_server_signaling_message_process(mrcp_signaling_message_t *signaling_message) -{ - mrcp_server_session_t *session = signaling_message->session; - if(session->active_request) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Push Request to Queue "APT_NAMESID_FMT, - MRCP_SESSION_NAMESID(session)); - apt_list_push_back(session->request_queue,signaling_message,session->base.pool); - } - else { - session->active_request = signaling_message; - mrcp_server_signaling_message_dispatch(session,signaling_message); - } - return TRUE; -} - -apt_bool_t mrcp_server_on_channel_modify(mrcp_channel_t *channel, mrcp_control_descriptor_t *answer, apt_bool_t status) -{ - mrcp_server_session_t *session = (mrcp_server_session_t*)channel->session; - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Control Channel Modified "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - channel->resource->name.buf); - if(!answer) { - return FALSE; - } - if(!channel->waiting_for_channel) { - return FALSE; - } - channel->waiting_for_channel = FALSE; - answer->session_id = session->base.id; - mrcp_session_control_media_set(session->answer,channel->id,answer); - mrcp_server_session_subrequest_remove(session); - return TRUE; -} - -apt_bool_t mrcp_server_on_channel_remove(mrcp_channel_t *channel, apt_bool_t status) -{ - mrcp_server_session_t *session = (mrcp_server_session_t*)channel->session; - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Control Channel Removed "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - channel->resource->name.buf); - if(!channel->waiting_for_channel) { - return FALSE; - } - channel->waiting_for_channel = FALSE; - mrcp_server_session_subrequest_remove(session); - return TRUE; -} - -apt_bool_t mrcp_server_on_channel_message(mrcp_channel_t *channel, mrcp_message_t *message) -{ - mrcp_server_session_t *session = (mrcp_server_session_t*)channel->session; - mrcp_signaling_message_t *signaling_message; - signaling_message = apr_palloc(session->base.pool,sizeof(mrcp_signaling_message_t)); - signaling_message->type = SIGNALING_MESSAGE_CONTROL; - signaling_message->session = session; - signaling_message->descriptor = NULL; - signaling_message->channel = channel; - signaling_message->message = message; - return mrcp_server_signaling_message_process(signaling_message); -} - -apt_bool_t mrcp_server_on_disconnect(mrcp_channel_t *channel) -{ - /* to be processed */ - return TRUE; -} - -apt_bool_t mrcp_server_on_engine_channel_open(mrcp_channel_t *channel, apt_bool_t status) -{ - mrcp_server_session_t *session = (mrcp_server_session_t*)channel->session; - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Engine Channel Opened "APT_NAMESIDRES_FMT" [%s]", - MRCP_SESSION_NAMESID(session), - channel->resource->name.buf, - status == TRUE ? "OK" : "Failed"); - if(status == FALSE) { - session->answer->status = MRCP_SESSION_STATUS_UNAVAILABLE_RESOURCE; - } - mrcp_server_session_subrequest_remove(session); - return TRUE; -} - -apt_bool_t mrcp_server_on_engine_channel_close(mrcp_channel_t *channel) -{ - mrcp_server_session_t *session = (mrcp_server_session_t*)channel->session; - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Engine Channel Closed "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - channel->resource->name.buf); - mrcp_server_session_subrequest_remove(session); - return TRUE; -} - -apt_bool_t mrcp_server_on_engine_channel_message(mrcp_channel_t *channel, mrcp_message_t *message) -{ - if(!channel->state_machine) { - return FALSE; - } - /* update state machine */ - return mrcp_state_machine_update(channel->state_machine,message); -} - - -static mrcp_session_descriptor_t* mrcp_session_answer_create(mrcp_session_descriptor_t *offer, apr_pool_t *pool) -{ - int i; - mrcp_session_descriptor_t *answer = apr_palloc(pool,sizeof(mrcp_session_descriptor_t)); - apt_string_reset(&answer->origin); - apt_string_reset(&answer->ip); - apt_string_reset(&answer->ext_ip); - answer->resource_name = offer->resource_name; - answer->resource_state = offer->resource_state; - answer->status = offer->status; - answer->control_media_arr = apr_array_make(pool,offer->control_media_arr->nelts,sizeof(void*)); - for(i=0; icontrol_media_arr->nelts; i++) { - APR_ARRAY_PUSH(answer->control_media_arr,void*) = NULL; - } - answer->audio_media_arr = apr_array_make(pool,offer->audio_media_arr->nelts,sizeof(mpf_rtp_media_descriptor_t*)); - for(i=0; iaudio_media_arr->nelts; i++) { - APR_ARRAY_PUSH(answer->audio_media_arr,mpf_rtp_media_descriptor_t*) = NULL; - } - answer->video_media_arr = apr_array_make(pool,offer->video_media_arr->nelts,sizeof(mpf_rtp_media_descriptor_t*)); - for(i=0; ivideo_media_arr->nelts; i++) { - APR_ARRAY_PUSH(answer->video_media_arr,mpf_rtp_media_descriptor_t*) = NULL; - } - return answer; -} - -static apt_bool_t mrcp_server_session_offer_process(mrcp_server_session_t *session, mrcp_session_descriptor_t *descriptor) -{ - if(!session->context) { - /* initial offer received, generate session id and add to session's table */ - if(!session->base.id.length) { - apt_unique_id_generate(&session->base.id,MRCP_SESSION_ID_HEX_STRING_LENGTH,session->base.pool); - } - mrcp_server_session_add(session); - - session->context = mpf_engine_context_create( - session->profile->media_engine, - session->base.name, - session,5,session->base.pool); - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive Offer "APT_NAMESID_FMT" [c:%d a:%d v:%d]", - MRCP_SESSION_NAMESID(session), - descriptor->control_media_arr->nelts, - descriptor->audio_media_arr->nelts, - descriptor->video_media_arr->nelts); - - /* store received offer */ - session->offer = descriptor; - session->answer = mrcp_session_answer_create(descriptor,session->base.pool); - - mrcp_server_session_state_set(session,SESSION_STATE_GENERATING_ANSWER); - - /* first, reset/destroy existing associations and topology */ - if(mpf_engine_topology_message_add( - session->profile->media_engine, - MPF_RESET_ASSOCIATIONS,session->context, - &session->mpf_task_msg) == TRUE){ - mrcp_server_session_subrequest_add(session); - } - - if(mrcp_session_version_get(session) == MRCP_VERSION_1) { - if(mrcp_server_resource_offer_process(session,descriptor) == TRUE) { - mrcp_server_av_media_offer_process(session,descriptor); - } - else { - session->answer->resource_state = FALSE; - } - } - else { - mrcp_server_control_media_offer_process(session,descriptor); - mrcp_server_av_media_offer_process(session,descriptor); - } - - /* apply topology based on assigned associations */ - if(mpf_engine_topology_message_add( - session->profile->media_engine, - MPF_APPLY_TOPOLOGY,session->context, - &session->mpf_task_msg) == TRUE) { - mrcp_server_session_subrequest_add(session); - } - mpf_engine_message_send(session->profile->media_engine,&session->mpf_task_msg); - - if(!session->subrequest_count) { - /* send answer to client */ - mrcp_server_session_answer_send(session); - } - return TRUE; -} - -static apt_bool_t mrcp_server_session_terminate_process(mrcp_server_session_t *session) -{ - mrcp_channel_t *channel; - mrcp_termination_slot_t *slot; - int i; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Terminate Session "APT_NAMESID_FMT,MRCP_SESSION_NAMESID(session)); - - mrcp_server_session_state_set(session,SESSION_STATE_TERMINATING); - - if(session->context) { - /* first, destroy existing topology */ - if(mpf_engine_topology_message_add( - session->profile->media_engine, - MPF_RESET_ASSOCIATIONS,session->context, - &session->mpf_task_msg) == TRUE){ - mrcp_server_session_subrequest_add(session); - } - } - - for(i=0; ichannels->nelts; i++) { - channel = APR_ARRAY_IDX(session->channels,i,mrcp_channel_t*); - if(!channel) continue; - - /* send remove channel request */ - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Remove Control Channel "APT_NAMESIDRES_FMT" [%d]", - MRCP_SESSION_NAMESID(session), - channel->resource->name.buf, - i); - if(channel->control_channel) { - if(mrcp_server_control_channel_remove(channel->control_channel) == TRUE) { - channel->waiting_for_channel = TRUE; - mrcp_server_session_subrequest_add(session); - } - } - - if(channel->engine_channel) { - mpf_termination_t *termination = channel->engine_channel->termination; - /* send subtract termination request */ - if(termination) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Subtract Media Termination "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - mpf_termination_name_get(termination)); - if(mpf_engine_termination_message_add( - session->profile->media_engine, - MPF_SUBTRACT_TERMINATION,session->context,termination,NULL, - &session->mpf_task_msg) == TRUE) { - channel->waiting_for_termination = TRUE; - mrcp_server_session_subrequest_add(session); - } - } - - /* close engine channel */ - if(mrcp_engine_channel_virtual_close(channel->engine_channel) == TRUE) { - mrcp_server_session_subrequest_add(session); - } - } - } - for(i=0; iterminations->nelts; i++) { - /* get existing termination */ - slot = &APR_ARRAY_IDX(session->terminations,i,mrcp_termination_slot_t); - if(!slot->termination) continue; - - /* send subtract termination request */ - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Subtract Media Termination "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - mpf_termination_name_get(slot->termination)); - if(mpf_engine_termination_message_add( - session->profile->media_engine, - MPF_SUBTRACT_TERMINATION,session->context,slot->termination,NULL, - &session->mpf_task_msg) == TRUE) { - slot->waiting = TRUE; - mrcp_server_session_subrequest_add(session); - } - } - - if(session->context) { - mpf_engine_message_send(session->profile->media_engine,&session->mpf_task_msg); - } - - mrcp_server_session_remove(session); - - if(!session->subrequest_count) { - mrcp_server_session_terminate_send(session); - } - - return TRUE; -} - -static apt_bool_t mrcp_server_session_deactivate(mrcp_server_session_t *session) -{ - mrcp_channel_t *channel; - int i; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Deactivate Session "APT_NAMESID_FMT,MRCP_SESSION_NAMESID(session)); - mrcp_server_session_state_set(session,SESSION_STATE_DEACTIVATING); - for(i=0; ichannels->nelts; i++) { - channel = APR_ARRAY_IDX(session->channels,i,mrcp_channel_t*); - if(!channel || !channel->state_machine) continue; - - if(mrcp_state_machine_deactivate(channel->state_machine) == TRUE) { - mrcp_server_session_subrequest_add(session); - } - } - - if(!session->subrequest_count) { - mrcp_server_session_terminate_process(session); - } - - return TRUE; -} - -static apt_bool_t mrcp_server_on_message_receive(mrcp_server_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message) -{ - if(!channel) { - channel = mrcp_server_channel_find(session,&message->channel_id.resource_name); - if(!channel) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Such Channel "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - message->channel_id.resource_name.buf); - return FALSE; - } - } - if(!channel->resource || !channel->state_machine) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Missing Resource "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - message->channel_id.resource_name.buf); - return FALSE; - } - - /* update state machine */ - return mrcp_state_machine_update(channel->state_machine,message); -} - -static apt_bool_t mrcp_server_signaling_message_dispatch(mrcp_server_session_t *session, mrcp_signaling_message_t *signaling_message) -{ - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Dispatch Signaling Message [%d]",signaling_message->type); - switch(signaling_message->type) { - case SIGNALING_MESSAGE_OFFER: - mrcp_server_session_offer_process(signaling_message->session,signaling_message->descriptor); - break; - case SIGNALING_MESSAGE_CONTROL: - mrcp_server_on_message_receive(signaling_message->session,signaling_message->channel,signaling_message->message); - break; - case SIGNALING_MESSAGE_TERMINATE: - mrcp_server_session_deactivate(signaling_message->session); - break; - default: - break; - } - return TRUE; -} - -static apt_bool_t mrcp_server_engine_channels_update(mrcp_server_session_t *session) -{ - mrcp_channel_t *channel; - mrcp_session_descriptor_t *descriptor = session->offer; - if(!descriptor) { - return FALSE; - } - - mrcp_server_session_state_set(session,SESSION_STATE_INITIALIZING); - - if(mrcp_session_version_get(session) == MRCP_VERSION_1) { - if(session->offer) { - channel = mrcp_server_channel_find(session,&descriptor->resource_name); - if(channel && channel->engine_channel) { - /* open engine channel */ - if(mrcp_engine_channel_virtual_open(channel->engine_channel) == TRUE) { - mrcp_server_session_subrequest_add(session); - } - } - } - } - else { - int i; - mrcp_control_descriptor_t *control_descriptor; - for(i=0; ichannels->nelts; i++) { - channel = APR_ARRAY_IDX(session->channels,i,mrcp_channel_t*); - if(!channel || !channel->engine_channel) continue; - - control_descriptor = mrcp_session_control_media_get(descriptor,i); - if(!control_descriptor) continue; - - if(control_descriptor->port) { - /* open engine channel */ - if(mrcp_engine_channel_virtual_open(channel->engine_channel) == TRUE) { - mrcp_server_session_subrequest_add(session); - } - } - else { - /* close engine channel */ - if(mrcp_engine_channel_virtual_close(channel->engine_channel) == TRUE) { - mrcp_server_session_subrequest_add(session); - } - } - } - } - - if(!session->subrequest_count) { - mrcp_server_session_answer_send(session); - } - return TRUE; -} - -static apt_bool_t mrcp_server_resource_offer_process(mrcp_server_session_t *session, mrcp_session_descriptor_t *descriptor) -{ - if(descriptor->resource_state == TRUE) { - /* setup */ - mrcp_channel_t *channel; - int count = session->channels->nelts; - channel = mrcp_server_channel_find(session,&descriptor->resource_name); - if(channel) { - /* channel already exists */ - return TRUE; - } - /* create new MRCP channel instance */ - channel = mrcp_server_channel_create(session,&descriptor->resource_name,count,NULL); - if(!channel || !channel->resource) { - return FALSE; - } - /* add to channel array */ - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Add Control Channel "APT_NAMESIDRES_FMT" [%d]", - MRCP_SESSION_NAMESID(session), - channel->resource->name.buf, - count); - APR_ARRAY_PUSH(session->channels,mrcp_channel_t*) = channel; - if(channel->engine_channel && channel->engine_channel->termination) { - mpf_termination_t *termination = channel->engine_channel->termination; - /* send add termination request (add to media context) */ - if(mpf_engine_termination_message_add( - session->profile->media_engine, - MPF_ADD_TERMINATION,session->context,termination,NULL, - &session->mpf_task_msg) == TRUE) { - channel->waiting_for_termination = TRUE; - mrcp_server_session_subrequest_add(session); - } - } - } - else { - /* teardown */ - } - return TRUE; -} - -static apt_bool_t mrcp_server_control_media_offer_process(mrcp_server_session_t *session, mrcp_session_descriptor_t *descriptor) -{ - mrcp_channel_t *channel; - mrcp_control_descriptor_t *control_descriptor; - int i; - int count = session->channels->nelts; - if(count > descriptor->control_media_arr->nelts) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Number of Control Channels [%d] > Number of Control Media in Offer [%d]", - count,descriptor->control_media_arr->nelts); - count = descriptor->control_media_arr->nelts; - } - - /* update existing control channels */ - for(i=0; ichannels,i,mrcp_channel_t*); - if(!channel) continue; - - channel->waiting_for_channel = FALSE; - /* get control descriptor */ - control_descriptor = mrcp_session_control_media_get(descriptor,i); - if(!control_descriptor) continue; - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Modify Control Channel "APT_NAMESIDRES_FMT" [%d]", - MRCP_SESSION_NAMESID(session), - channel->resource->name.buf, - i); - if(channel->control_channel) { - /* send offer */ - if(mrcp_server_control_channel_modify(channel->control_channel,control_descriptor) == TRUE) { - channel->waiting_for_channel = TRUE; - mrcp_server_session_subrequest_add(session); - } - } - - if(channel->waiting_for_channel == FALSE) { - mrcp_control_descriptor_t *answer = mrcp_control_answer_create(control_descriptor,channel->pool); - answer->port = 0; - answer->session_id = session->base.id; - mrcp_session_control_media_set(session->answer,channel->id,answer); - } - } - - /* add new control channels */ - for(; icontrol_media_arr->nelts; i++) { - /* get control descriptor */ - control_descriptor = mrcp_session_control_media_get(descriptor,i); - if(!control_descriptor) continue; - - /* create new MRCP channel instance */ - channel = mrcp_server_channel_create(session,&control_descriptor->resource_name,i,control_descriptor->cmid_arr); - if(!channel || !channel->resource) continue; - - control_descriptor->session_id = session->base.id; - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Add Control Channel "APT_NAMESIDRES_FMT" [%d]", - MRCP_SESSION_NAMESID(session), - channel->resource->name.buf, - i); - APR_ARRAY_PUSH(session->channels,mrcp_channel_t*) = channel; - - if(channel->control_channel) { - /* send modify connection request */ - if(mrcp_server_control_channel_add(channel->control_channel,control_descriptor) == TRUE) { - channel->waiting_for_channel = TRUE; - mrcp_server_session_subrequest_add(session); - } - } - - if(channel->waiting_for_channel == FALSE) { - mrcp_control_descriptor_t *answer = mrcp_control_answer_create(control_descriptor,channel->pool); - answer->port = 0; - answer->session_id = session->base.id; - mrcp_session_control_media_set(session->answer,channel->id,answer); - } - - if(channel->engine_channel && channel->engine_channel->termination) { - mpf_termination_t *termination = channel->engine_channel->termination; - /* send add termination request (add to media context) */ - if(mpf_engine_termination_message_add( - session->profile->media_engine, - MPF_ADD_TERMINATION,session->context,termination,NULL, - &session->mpf_task_msg) == TRUE) { - channel->waiting_for_termination = TRUE; - mrcp_server_session_subrequest_add(session); - } - } - } - - return TRUE; -} - -static mpf_rtp_termination_descriptor_t* mrcp_server_associations_build(mrcp_server_session_t *session, mrcp_session_descriptor_t *descriptor, mrcp_termination_slot_t *slot) -{ - int i; - mrcp_channel_t *channel; - mpf_audio_stream_t *audio_stream; - mpf_stream_capabilities_t *capabilities = NULL; - mpf_rtp_termination_descriptor_t *rtp_descriptor; - mpf_rtp_media_descriptor_t *media_descriptor = mrcp_session_audio_media_get(descriptor,slot->id); - if(!media_descriptor) { - return NULL; - } - /* construct termination descriptor */ - rtp_descriptor = apr_palloc(session->base.pool,sizeof(mpf_rtp_termination_descriptor_t)); - mpf_rtp_termination_descriptor_init(rtp_descriptor); - rtp_descriptor->audio.local = NULL; - rtp_descriptor->audio.remote = media_descriptor; - rtp_descriptor->audio.settings = session->profile->rtp_settings; - - slot->mid = media_descriptor->mid; - slot->channels = apr_array_make(session->base.pool,1,sizeof(mrcp_channel_t*)); - for(i=0; ichannels->nelts; i++) { - channel = APR_ARRAY_IDX(session->channels,i,mrcp_channel_t*); - if(!channel) continue; - - if(session->terminations->nelts == 1 || (!channel->cmid_arr || mrcp_cmid_find(channel->cmid_arr,slot->mid) == TRUE)) { - APR_ARRAY_PUSH(slot->channels, mrcp_channel_t*) = channel; - - audio_stream = NULL; - if(channel->engine_channel && channel->engine_channel->termination) { - audio_stream = mpf_termination_audio_stream_get(channel->engine_channel->termination); - } - if(!audio_stream) continue; - - if(audio_stream->capabilities) { - /* set descriptor according to media termination(s) - of associated control channel(s) */ - if(capabilities) { - mpf_stream_capabilities_merge( - capabilities, - audio_stream->capabilities, - session->base.pool); - } - else { - capabilities = mpf_stream_capabilities_clone( - audio_stream->capabilities, - session->base.pool); - } - } - - if(mrcp_session_version_get(session) == MRCP_VERSION_1) { - mpf_stream_direction_e direction = audio_stream->direction; - /* implicitly modify the descriptor, if needed */ - if(media_descriptor->direction == STREAM_DIRECTION_NONE && mpf_codec_list_is_empty(&media_descriptor->codec_list) == TRUE) { - /* this is the case when SETUP contains no SDP, assume all the available codecs are offered */ - if(mpf_codec_list_is_empty(&session->profile->rtp_settings->codec_list) == FALSE) { - mpf_codec_list_copy(&media_descriptor->codec_list, - &session->profile->rtp_settings->codec_list, - session->base.pool); - } - } - - media_descriptor->direction |= direction; - if(media_descriptor->state == MPF_MEDIA_DISABLED) { - media_descriptor->state = MPF_MEDIA_ENABLED; - } - } - } - } - if(capabilities) { - capabilities->direction = mpf_stream_reverse_direction_get(capabilities->direction); - rtp_descriptor->audio.capabilities = capabilities; - } - return rtp_descriptor; -} - -static apt_bool_t mrcp_server_associations_set(mrcp_server_session_t *session, mrcp_session_descriptor_t *descriptor, mrcp_termination_slot_t *slot) -{ - int i; - mrcp_channel_t *channel; - for(i=0; ichannels->nelts; i++) { - channel = ((mrcp_channel_t**)slot->channels->elts)[i]; - if(!channel || !channel->engine_channel) continue; - - if(mpf_engine_assoc_message_add( - session->profile->media_engine, - MPF_ADD_ASSOCIATION,session->context,slot->termination,channel->engine_channel->termination, - &session->mpf_task_msg) == TRUE) { - mrcp_server_session_subrequest_add(session); - } - } - return TRUE; -} - -static apt_bool_t mrcp_server_av_media_offer_process(mrcp_server_session_t *session, mrcp_session_descriptor_t *descriptor) -{ - mpf_rtp_termination_descriptor_t *rtp_descriptor; - mrcp_termination_slot_t *slot; - int i; - int count = session->terminations->nelts; - if(!descriptor->audio_media_arr->nelts) { - /* no media to process */ - return TRUE; - } - if(count > descriptor->audio_media_arr->nelts) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Number of Terminations [%d] > Number of Audio Media in Offer [%d]", - count,descriptor->audio_media_arr->nelts); - count = descriptor->audio_media_arr->nelts; - } - - /* update existing terminations */ - for(i=0; iterminations,i,mrcp_termination_slot_t); - if(!slot->termination) continue; - - /* build associations between specified RTP termination and control channels */ - rtp_descriptor = mrcp_server_associations_build(session,descriptor,slot); - if(!rtp_descriptor) continue; - - /* send modify termination request */ - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Modify Media Termination "APT_NAMESIDRES_FMT" [%d]", - MRCP_SESSION_NAMESID(session), - mpf_termination_name_get(slot->termination), - i); - if(mpf_engine_termination_message_add( - session->profile->media_engine, - MPF_MODIFY_TERMINATION,session->context,slot->termination,rtp_descriptor, - &session->mpf_task_msg) == TRUE) { - slot->waiting = TRUE; - mrcp_server_session_subrequest_add(session); - } - - /* set built associations */ - mrcp_server_associations_set(session,descriptor,slot); - } - - /* add new terminations */ - for(; iaudio_media_arr->nelts; i++) { - mpf_termination_t *termination; - /* create new RTP termination instance */ - termination = mpf_termination_create(session->profile->rtp_termination_factory,session,session->base.pool); - /* add to termination array */ - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Add Media Termination "APT_NAMESIDRES_FMT" [%d]", - MRCP_SESSION_NAMESID(session), - mpf_termination_name_get(termination), - i); - slot = apr_array_push(session->terminations); - slot->id = i; - slot->mid = 0; - slot->waiting = FALSE; - slot->termination = termination; - slot->channels = NULL; - - /* build associations between specified RTP termination and control channels */ - rtp_descriptor = mrcp_server_associations_build(session,descriptor,slot); - if(!rtp_descriptor) continue; - - /* send add termination request (add to media context) */ - if(mpf_engine_termination_message_add( - session->profile->media_engine, - MPF_ADD_TERMINATION,session->context,termination,rtp_descriptor, - &session->mpf_task_msg) == TRUE) { - slot->waiting = TRUE; - mrcp_server_session_subrequest_add(session); - } - - /* set built associations */ - mrcp_server_associations_set(session,descriptor,slot); - } - return TRUE; -} - -static apt_bool_t mrcp_server_session_answer_send(mrcp_server_session_t *session) -{ - apt_bool_t status; - mrcp_session_descriptor_t *descriptor = session->answer; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Send Answer "APT_NAMESID_FMT" [c:%d a:%d v:%d] Status %s", - MRCP_SESSION_NAMESID(session), - descriptor->control_media_arr->nelts, - descriptor->audio_media_arr->nelts, - descriptor->video_media_arr->nelts, - mrcp_session_status_phrase_get(descriptor->status)); - status = mrcp_session_answer(&session->base,descriptor); - session->offer = NULL; - session->answer = NULL; - - session->active_request = apt_list_pop_front(session->request_queue); - if(session->active_request) { - mrcp_server_signaling_message_dispatch(session,session->active_request); - } - return status; -} - -static apt_bool_t mrcp_server_session_terminate_send(mrcp_server_session_t *session) -{ - int i; - mrcp_channel_t *channel; - for(i=0; ichannels->nelts; i++) { - channel = APR_ARRAY_IDX(session->channels,i,mrcp_channel_t*); - if(!channel) continue; - - if(channel->control_channel) { - mrcp_server_control_channel_destroy(channel->control_channel); - channel->control_channel = NULL; - } - if(channel->engine_channel) { - mrcp_engine_channel_virtual_destroy(channel->engine_channel); - channel->engine_channel = NULL; - } - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Session Terminated "APT_NAMESID_FMT,MRCP_SESSION_NAMESID(session)); - mrcp_session_terminate_response(&session->base); - return TRUE; -} - - -static mrcp_termination_slot_t* mrcp_server_rtp_termination_find(mrcp_server_session_t *session, mpf_termination_t *termination) -{ - int i; - mrcp_termination_slot_t *slot; - for(i=0; iterminations->nelts; i++) { - slot = &APR_ARRAY_IDX(session->terminations,i,mrcp_termination_slot_t); - if(slot->termination == termination) { - return slot; - } - } - return NULL; -} - -static mrcp_channel_t* mrcp_server_channel_termination_find(mrcp_server_session_t *session, mpf_termination_t *termination) -{ - int i; - mrcp_channel_t *channel; - for(i=0; ichannels->nelts; i++) { - channel = APR_ARRAY_IDX(session->channels,i,mrcp_channel_t*); - if(!channel) continue; - - if(channel->engine_channel && channel->engine_channel->termination == termination) { - return channel; - } - } - return NULL; -} - -static mrcp_channel_t* mrcp_server_channel_find(mrcp_server_session_t *session, const apt_str_t *resource_name) -{ - int i; - mrcp_channel_t *channel; - for(i=0; ichannels->nelts; i++) { - channel = APR_ARRAY_IDX(session->channels,i,mrcp_channel_t*); - if(!channel) continue; - - if(apt_string_compare(&channel->resource->name,resource_name) == TRUE) { - return channel; - } - } - return NULL; -} - -static apt_bool_t mrcp_server_on_termination_modify(mrcp_server_session_t *session, const mpf_message_t *mpf_message) -{ - mrcp_termination_slot_t *termination_slot; - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Media Termination Modified "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - mpf_termination_name_get(mpf_message->termination)); - termination_slot = mrcp_server_rtp_termination_find(session,mpf_message->termination); - if(termination_slot) { - /* rtp termination */ - mpf_rtp_termination_descriptor_t *rtp_descriptor; - if(termination_slot->waiting == FALSE) { - return FALSE; - } - termination_slot->waiting = FALSE; - rtp_descriptor = mpf_message->descriptor; - if(rtp_descriptor->audio.local) { - session->answer->ip = rtp_descriptor->audio.local->ip; - session->answer->ext_ip = rtp_descriptor->audio.local->ext_ip; - mrcp_session_audio_media_set(session->answer,termination_slot->id,rtp_descriptor->audio.local); - } - mrcp_server_session_subrequest_remove(session); - } - else { - /* engine channel termination */ - mrcp_channel_t *channel = mrcp_server_channel_termination_find(session,mpf_message->termination); - if(channel && channel->waiting_for_termination == TRUE) { - channel->waiting_for_termination = FALSE; - mrcp_server_session_subrequest_remove(session); - } - } - return TRUE; -} - -static apt_bool_t mrcp_server_on_termination_subtract(mrcp_server_session_t *session, const mpf_message_t *mpf_message) -{ - mrcp_termination_slot_t *termination_slot; - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Media Termination Subtracted "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - mpf_termination_name_get(mpf_message->termination)); - termination_slot = mrcp_server_rtp_termination_find(session,mpf_message->termination); - if(termination_slot) { - /* rtp termination */ - if(termination_slot->waiting == FALSE) { - return FALSE; - } - termination_slot->waiting = FALSE; - mrcp_server_session_subrequest_remove(session); - } - else { - /* engine channel termination */ - mrcp_channel_t *channel = mrcp_server_channel_termination_find(session,mpf_message->termination); - if(channel && channel->waiting_for_termination == TRUE) { - channel->waiting_for_termination = FALSE; - mrcp_server_session_subrequest_remove(session); - } - } - return TRUE; -} - -apt_bool_t mrcp_server_mpf_message_process(mpf_message_container_t *mpf_message_container) -{ - apr_size_t i; - mrcp_server_session_t *session; - const mpf_message_t *mpf_message; - for(i=0; icount; i++) { - mpf_message = &mpf_message_container->messages[i]; - if(mpf_message->context) { - session = mpf_engine_context_object_get(mpf_message->context); - } - else { - session = NULL; - } - if(!session) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Received MPF Message: NULL session"); - continue; - } - if(mpf_message->message_type == MPF_MESSAGE_TYPE_RESPONSE) { - switch(mpf_message->command_id) { - case MPF_ADD_TERMINATION: - mrcp_server_on_termination_modify(session,mpf_message); - break; - case MPF_MODIFY_TERMINATION: - mrcp_server_on_termination_modify(session,mpf_message); - break; - case MPF_SUBTRACT_TERMINATION: - mrcp_server_on_termination_subtract(session,mpf_message); - break; - case MPF_ADD_ASSOCIATION: - case MPF_REMOVE_ASSOCIATION: - case MPF_RESET_ASSOCIATIONS: - case MPF_APPLY_TOPOLOGY: - case MPF_DESTROY_TOPOLOGY: - mrcp_server_session_subrequest_remove(session); - break; - default: - break; - } - } - else if(mpf_message->message_type == MPF_MESSAGE_TYPE_EVENT) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Process MPF Event"); - } - } - return TRUE; -} - -static apt_bool_t state_machine_on_message_dispatch(mrcp_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_channel_t *channel = state_machine->obj; - - if(message->start_line.message_type == MRCP_MESSAGE_TYPE_REQUEST) { - /* send request message to engine for actual processing */ - if(channel->engine_channel) { - mrcp_engine_channel_request_process(channel->engine_channel,message); - } - } - else if(message->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) { - mrcp_server_session_t *session = (mrcp_server_session_t*)channel->session; - /* send response message to client */ - if(channel->control_channel) { - /* MRCPv2 */ - mrcp_server_control_message_send(channel->control_channel,message); - } - else { - /* MRCPv1 */ - mrcp_session_control_response(channel->session,message); - } - - session->active_request = apt_list_pop_front(session->request_queue); - if(session->active_request) { - mrcp_server_signaling_message_dispatch(session,session->active_request); - } - } - else { - /* send event message to client */ - if(channel->control_channel) { - /* MRCPv2 */ - mrcp_server_control_message_send(channel->control_channel,message); - } - else { - /* MRCPv1 */ - mrcp_session_control_response(channel->session,message); - } - } - return TRUE; -} - -static apt_bool_t state_machine_on_deactivate(mrcp_state_machine_t *state_machine) -{ - mrcp_channel_t *channel = state_machine->obj; - mrcp_server_session_t *session = (mrcp_server_session_t*)channel->session; - mrcp_server_session_subrequest_remove(session); - return TRUE; -} diff --git a/libs/unimrcp/libs/mrcp-signaling/Makefile.am b/libs/unimrcp/libs/mrcp-signaling/Makefile.am deleted file mode 100644 index e274f1ce83..0000000000 --- a/libs/unimrcp/libs/mrcp-signaling/Makefile.am +++ /dev/null @@ -1,17 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -AM_CPPFLAGS = -I$(top_srcdir)/libs/mrcp-signaling/include \ - -I$(top_srcdir)/libs/mrcp/include \ - -I$(top_srcdir)/libs/mpf/include \ - -I$(top_srcdir)/libs/apr-toolkit/include \ - $(UNIMRCP_APR_INCLUDES) - -noinst_LTLIBRARIES = libmrcpsignaling.la - -include_HEADERS = include/mrcp_sig_types.h \ - include/mrcp_sig_agent.h \ - include/mrcp_session.h \ - include/mrcp_session_descriptor.h - -libmrcpsignaling_la_SOURCES = src/mrcp_sig_agent.c \ - src/mrcp_session_descriptor.c \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp-signaling/include/mrcp_session.h b/libs/unimrcp/libs/mrcp-signaling/include/mrcp_session.h deleted file mode 100644 index f4b9ebcc96..0000000000 --- a/libs/unimrcp/libs/mrcp-signaling/include/mrcp_session.h +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_session.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_SESSION_H -#define MRCP_SESSION_H - -/** - * @file mrcp_session.h - * @brief Abstract MRCP Session - */ - -#include "mrcp_sig_types.h" -#include "mpf_types.h" -#include "apt_string.h" - -APT_BEGIN_EXTERN_C - -/** Macro to log session pointers */ -#define MRCP_SESSION_PTR(session) (session) -/** Macro to log session string identifiers */ -#define MRCP_SESSION_SID(session) \ - (session)->id.buf ? (session)->id.buf : "new" - -/** Macro to log session pointers and string identifiers */ -#define MRCP_SESSION_PTRSID(session) \ - MRCP_SESSION_PTR(session), MRCP_SESSION_SID(session) - -/** MRCP session request vtable declaration */ -typedef struct mrcp_session_request_vtable_t mrcp_session_request_vtable_t; -/** MRCP session response vtable declaration */ -typedef struct mrcp_session_response_vtable_t mrcp_session_response_vtable_t; -/** MRCP session event vtable declaration */ -typedef struct mrcp_session_event_vtable_t mrcp_session_event_vtable_t; - - -/** MRCP session */ -struct mrcp_session_t { - /** Memory pool to allocate memory from */ - apr_pool_t *pool; - /** External object associated with session */ - void *obj; - /** External logger object associated with session */ - void *log_obj; - /** Informative name of the session used for debugging */ - const char *name; - - /** Signaling (session managment) agent */ - mrcp_sig_agent_t *signaling_agent; - /** MRCPv2 connection agent, if any */ - void *connection_agent; - /** Media processing engine */ - mpf_engine_t *media_engine; - /** RTP termination factory */ - mpf_termination_factory_t *rtp_factory; - - /** Session identifier */ - apt_str_t id; - /** Last request identifier sent for client, received for server */ - mrcp_request_id last_request_id; - - /** Virtual request methods */ - const mrcp_session_request_vtable_t *request_vtable; - /** Virtual response methods */ - const mrcp_session_response_vtable_t *response_vtable; - /** Virtual event methods */ - const mrcp_session_event_vtable_t *event_vtable; -}; - - -/** MRCP session request vtable */ -struct mrcp_session_request_vtable_t { - /** Offer session descriptor */ - apt_bool_t (*offer)(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor); - /** Terminate session */ - apt_bool_t (*terminate)(mrcp_session_t *session); - /** Control session (MRCPv1 only) */ - apt_bool_t (*control)(mrcp_session_t *session, mrcp_message_t *message); - /** Discover resources */ - apt_bool_t (*discover)(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor); -}; - -/** MRCP session response vtable */ -struct mrcp_session_response_vtable_t { - /** Answer with remote session descriptor */ - apt_bool_t (*on_answer)(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor); - /** Session terminated */ - apt_bool_t (*on_terminate)(mrcp_session_t *session); - /** Control session (MRCPv1 only) */ - apt_bool_t (*on_control)(mrcp_session_t *session, mrcp_message_t *message); - /** Response to resource discovery request */ - apt_bool_t (*on_discover)(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor); -}; - -/** MRCP session event vtable */ -struct mrcp_session_event_vtable_t { - /** Received session termination event without appropriate request */ - apt_bool_t (*on_terminate)(mrcp_session_t *session); -}; - - -/** Create new memory pool and allocate session object from the pool. */ -MRCP_DECLARE(mrcp_session_t*) mrcp_session_create(apr_size_t padding); - -/** Destroy session and assosiated memory pool. */ -MRCP_DECLARE(void) mrcp_session_destroy(mrcp_session_t *session); - - -/** Offer */ -static APR_INLINE apt_bool_t mrcp_session_offer(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor) -{ - if(session->request_vtable->offer) { - return session->request_vtable->offer(session,descriptor); - } - return FALSE; -} - -/** Terminate */ -static APR_INLINE apt_bool_t mrcp_session_terminate_request(mrcp_session_t *session) -{ - if(session->request_vtable->terminate) { - return session->request_vtable->terminate(session); - } - return FALSE; -} - -/** Answer */ -static APR_INLINE apt_bool_t mrcp_session_answer(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor) -{ - if(session->response_vtable->on_answer) { - return session->response_vtable->on_answer(session,descriptor); - } - return FALSE; -} - -/** On terminate response */ -static APR_INLINE apt_bool_t mrcp_session_terminate_response(mrcp_session_t *session) -{ - if(session->response_vtable->on_terminate) { - return session->response_vtable->on_terminate(session); - } - return FALSE; -} - -/** On terminate event */ -static APR_INLINE apt_bool_t mrcp_session_terminate_event(mrcp_session_t *session) -{ - if(session->event_vtable->on_terminate) { - return session->event_vtable->on_terminate(session); - } - return FALSE; -} - -/** Control request */ -static APR_INLINE apt_bool_t mrcp_session_control_request(mrcp_session_t *session, mrcp_message_t *message) -{ - if(session->request_vtable->control) { - return session->request_vtable->control(session,message); - } - return FALSE; -} - -/** On control response/event */ -static APR_INLINE apt_bool_t mrcp_session_control_response(mrcp_session_t *session, mrcp_message_t *message) -{ - if(session->response_vtable->on_control) { - return session->response_vtable->on_control(session,message); - } - return FALSE; -} - -/** Resource discovery request */ -static APR_INLINE apt_bool_t mrcp_session_discover_request(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor) -{ - if(session->request_vtable->discover) { - return session->request_vtable->discover(session,descriptor); - } - return FALSE; -} - -/** On resource discovery response */ -static APR_INLINE apt_bool_t mrcp_session_discover_response(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor) -{ - if(session->response_vtable->on_discover) { - return session->response_vtable->on_discover(session,descriptor); - } - return FALSE; -} - -APT_END_EXTERN_C - -#endif /* MRCP_SESSION_H */ diff --git a/libs/unimrcp/libs/mrcp-signaling/include/mrcp_session_descriptor.h b/libs/unimrcp/libs/mrcp-signaling/include/mrcp_session_descriptor.h deleted file mode 100644 index e1e9b48448..0000000000 --- a/libs/unimrcp/libs/mrcp-signaling/include/mrcp_session_descriptor.h +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_session_descriptor.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_SESSION_DESCRIPTOR_H -#define MRCP_SESSION_DESCRIPTOR_H - -/** - * @file mrcp_session_descriptor.h - * @brief MRCP Session Descriptor - */ - -#include "mpf_rtp_descriptor.h" -#include "mrcp_sig_types.h" - -APT_BEGIN_EXTERN_C - -/** MRCP session status */ -typedef enum { - MRCP_SESSION_STATUS_OK, /**< OK */ - MRCP_SESSION_STATUS_NO_SUCH_RESOURCE, /**< no such resource found */ - MRCP_SESSION_STATUS_UNACCEPTABLE_RESOURCE,/**< resource exists, but no implementation (plugin) found */ - MRCP_SESSION_STATUS_UNAVAILABLE_RESOURCE, /**< resource exists, but is temporary unavailable */ - MRCP_SESSION_STATUS_ERROR /**< internal error occurred */ -} mrcp_session_status_e; - -/** MRCP session descriptor */ -struct mrcp_session_descriptor_t { - /** SDP origin */ - apt_str_t origin; - /** Session level IP address */ - apt_str_t ip; - /** Session level external (NAT) IP address */ - apt_str_t ext_ip; - /** Session level resource name (MRCPv1 only) */ - apt_str_t resource_name; - /** Resource state (MRCPv1 only) */ - apt_bool_t resource_state; - /** Session status */ - mrcp_session_status_e status; - /** Response code (SIP for MRCPv2 and RTSP for MRCPv1) */ - int response_code; - - /** MRCP control media array (mrcp_control_descriptor_t) */ - apr_array_header_t *control_media_arr; - /** Audio media array (mpf_rtp_media_descriptor_t) */ - apr_array_header_t *audio_media_arr; - /** Video media array (mpf_rtp_media_descriptor_t) */ - apr_array_header_t *video_media_arr; -}; - -/** Create session descriptor */ -MRCP_DECLARE(mrcp_session_descriptor_t*) mrcp_session_descriptor_create(apr_pool_t *pool); - -static APR_INLINE apr_size_t mrcp_session_media_count_get(const mrcp_session_descriptor_t *descriptor) -{ - return descriptor->control_media_arr->nelts + descriptor->audio_media_arr->nelts + descriptor->video_media_arr->nelts; -} - -static APR_INLINE apr_size_t mrcp_session_control_media_add(mrcp_session_descriptor_t *descriptor, void *media) -{ - APR_ARRAY_PUSH(descriptor->control_media_arr,void*) = media; - return mrcp_session_media_count_get(descriptor) - 1; -} - -static APR_INLINE void* mrcp_session_control_media_get(const mrcp_session_descriptor_t *descriptor, apr_size_t id) -{ - if((int)id >= descriptor->control_media_arr->nelts) { - return NULL; - } - return APR_ARRAY_IDX(descriptor->control_media_arr,id,void*); -} - -static APR_INLINE apt_bool_t mrcp_session_control_media_set(mrcp_session_descriptor_t *descriptor, apr_size_t id, void *media) -{ - if((int)id >= descriptor->control_media_arr->nelts) { - return FALSE; - } - APR_ARRAY_IDX(descriptor->control_media_arr,id,void*) = media; - return TRUE; -} - - -static APR_INLINE apr_size_t mrcp_session_audio_media_add(mrcp_session_descriptor_t *descriptor, mpf_rtp_media_descriptor_t *media) -{ - APR_ARRAY_PUSH(descriptor->audio_media_arr,mpf_rtp_media_descriptor_t*) = media; - return mrcp_session_media_count_get(descriptor) - 1; -} - -static APR_INLINE mpf_rtp_media_descriptor_t* mrcp_session_audio_media_get(const mrcp_session_descriptor_t *descriptor, apr_size_t id) -{ - if((int)id >= descriptor->audio_media_arr->nelts) { - return NULL; - } - return APR_ARRAY_IDX(descriptor->audio_media_arr,id,mpf_rtp_media_descriptor_t*); -} - -static APR_INLINE apt_bool_t mrcp_session_audio_media_set(const mrcp_session_descriptor_t *descriptor, apr_size_t id, mpf_rtp_media_descriptor_t* media) -{ - if((int)id >= descriptor->audio_media_arr->nelts) { - return FALSE; - } - APR_ARRAY_IDX(descriptor->audio_media_arr,id,mpf_rtp_media_descriptor_t*) = media; - return TRUE; -} - - -static APR_INLINE apr_size_t mrcp_session_video_media_add(mrcp_session_descriptor_t *descriptor, mpf_rtp_media_descriptor_t *media) -{ - APR_ARRAY_PUSH(descriptor->video_media_arr,mpf_rtp_media_descriptor_t*) = media; - return mrcp_session_media_count_get(descriptor) - 1; -} - -static APR_INLINE mpf_rtp_media_descriptor_t* mrcp_session_video_media_get(const mrcp_session_descriptor_t *descriptor, apr_size_t id) -{ - if((int)id >= descriptor->video_media_arr->nelts) { - return NULL; - } - return APR_ARRAY_IDX(descriptor->video_media_arr,id,mpf_rtp_media_descriptor_t*); -} - -static APR_INLINE apt_bool_t mrcp_session_video_media_set(mrcp_session_descriptor_t *descriptor, apr_size_t id, mpf_rtp_media_descriptor_t* media) -{ - if((int)id >= descriptor->video_media_arr->nelts) { - return FALSE; - } - APR_ARRAY_IDX(descriptor->video_media_arr,id,mpf_rtp_media_descriptor_t*) = media; - return TRUE; -} - -/** Get session status phrase */ -MRCP_DECLARE(const char*) mrcp_session_status_phrase_get(mrcp_session_status_e status); - -APT_END_EXTERN_C - -#endif /* MRCP_SESSION_DESCRIPTOR_H */ diff --git a/libs/unimrcp/libs/mrcp-signaling/include/mrcp_sig_agent.h b/libs/unimrcp/libs/mrcp-signaling/include/mrcp_sig_agent.h deleted file mode 100644 index a7595066d5..0000000000 --- a/libs/unimrcp/libs/mrcp-signaling/include/mrcp_sig_agent.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_sig_agent.h 2253 2014-11-21 02:57:19Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_SIG_AGENT_H -#define MRCP_SIG_AGENT_H - -/** - * @file mrcp_sig_agent.h - * @brief Abstract MRCP Signaling Agent - */ - -#include -#include -#include "mrcp_sig_types.h" -#include "apt_task.h" - -APT_BEGIN_EXTERN_C - -/** Signaling settings */ -struct mrcp_sig_settings_t { - /** Server IP address */ - char *server_ip; - /** Server port */ - apr_port_t server_port; - /** Server SIP user name (v2 only) */ - char *user_name; - /** Resource location (v1 only) */ - char *resource_location; - /** Map of the MRCP resource names (v1 only) */ - apr_table_t *resource_map; - /** Force destination IP address. Should be used only in case - SDP contains incorrect connection address (local IP address behind NAT) */ - apt_bool_t force_destination; - /** Optional feature tags */ - char *feature_tags; -}; - -/** MRCP signaling agent */ -struct mrcp_sig_agent_t { - /** Agent identifier */ - const char *id; - /** Memory pool to allocate memory from */ - apr_pool_t *pool; - /** External object associated with agent */ - void *obj; - /** Parent object (client/server) */ - void *parent; - /** MRCP resource factory */ - mrcp_resource_factory_t *resource_factory; - /** Task interface */ - apt_task_t *task; - /** Task message pool used to allocate signaling agent messages */ - apt_task_msg_pool_t *msg_pool; - - /** Virtual create_server_session */ - mrcp_session_t* (*create_server_session)(mrcp_sig_agent_t *signaling_agent); - /** Virtual create_client_session */ - apt_bool_t (*create_client_session)(mrcp_session_t *session, const mrcp_sig_settings_t *settings); -}; - -/** Create signaling agent. */ -MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_signaling_agent_create(const char *id, void *obj, apr_pool_t *pool); - -/** Create factory of signaling agents. */ -MRCP_DECLARE(mrcp_sa_factory_t*) mrcp_sa_factory_create(apr_pool_t *pool); - -/** Add signaling agent to factory. */ -MRCP_DECLARE(apt_bool_t) mrcp_sa_factory_agent_add(mrcp_sa_factory_t *sa_factory, mrcp_sig_agent_t *sig_agent); - -/** Determine whether factory is empty. */ -MRCP_DECLARE(apt_bool_t) mrcp_sa_factory_is_empty(const mrcp_sa_factory_t *sa_factory); - -/** Select next available signaling agent. */ -MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_sa_factory_agent_select(mrcp_sa_factory_t *sa_factory); - -/** Allocate MRCP signaling settings. */ -MRCP_DECLARE(mrcp_sig_settings_t*) mrcp_signaling_settings_alloc(apr_pool_t *pool); - - -APT_END_EXTERN_C - -#endif /* MRCP_SIG_AGENT_H */ diff --git a/libs/unimrcp/libs/mrcp-signaling/include/mrcp_sig_types.h b/libs/unimrcp/libs/mrcp-signaling/include/mrcp_sig_types.h deleted file mode 100644 index 6dc589036e..0000000000 --- a/libs/unimrcp/libs/mrcp-signaling/include/mrcp_sig_types.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_sig_types.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_SIG_TYPES_H -#define MRCP_SIG_TYPES_H - -/** - * @file mrcp_sig_types.h - * @brief MRCP Signaling Types Declaration - */ - -#include "mrcp_types.h" - -APT_BEGIN_EXTERN_C - -/** Opaque MRCP signaling settings declaration */ -typedef struct mrcp_sig_settings_t mrcp_sig_settings_t; - -/** Opaque MRCP signaling agent declaration */ -typedef struct mrcp_sig_agent_t mrcp_sig_agent_t; - -/** Opaque MRCP signaling agent factory declaration */ -typedef struct mrcp_sa_factory_t mrcp_sa_factory_t; - -/** Opaque MRCP session declaration */ -typedef struct mrcp_session_t mrcp_session_t; - -/** Opaque MRCP session descriptor declaration */ -typedef struct mrcp_session_descriptor_t mrcp_session_descriptor_t; - -APT_END_EXTERN_C - -#endif /* MRCP_SIG_TYPES_H */ diff --git a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2010.vcxproj.filters b/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2010.vcxproj.filters deleted file mode 100644 index 4e5d30c3da..0000000000 --- a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2010.vcxproj.filters +++ /dev/null @@ -1,35 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {f3dc550f-1a0f-4b9e-b077-3b6940dc5531} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - include - - - include - - - include - - - include - - - - - src - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2017.vcxproj b/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2017.vcxproj deleted file mode 100644 index d8f8525d72..0000000000 --- a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2017.vcxproj +++ /dev/null @@ -1,130 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - mrcpsignaling - {12A49562-BAB9-43A3-A21D-15B60BBB4C31} - mrcpsignaling - Win32Proj - - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(SolutionDir)$(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(SolutionDir)$(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - - - - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) - - - - - X64 - - - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) - ProgramDatabase - - - - - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) - - - - - X64 - - - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) - - - - - - - - - - - - - - - {f6c55d93-b927-4483-bb69-15aef3dd2dff} - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcproj b/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcproj deleted file mode 100644 index 6aa8163acc..0000000000 --- a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcproj +++ /dev/null @@ -1,276 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcxproj b/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcxproj deleted file mode 100644 index 13a3708693..0000000000 --- a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcxproj +++ /dev/null @@ -1,124 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {12A49562-BAB9-43A3-A21D-15B60BBB4C31} - mrcpsignaling - Win32Proj - - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - X64 - - - ProgramDatabase - - - - - X64 - - - - - - - - - - - - - - - {b5a00bfa-6083-4fae-a097-71642d6473b5} - false - - - {1c320193-46a6-4b34-9c56-8ab584fc1b56} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcxproj.filters b/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcxproj.filters deleted file mode 100644 index 7b9d1aa49b..0000000000 --- a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcxproj.filters +++ /dev/null @@ -1,35 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {38ec7b90-673c-4c54-9c3a-13d5270556a0} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - include - - - include - - - include - - - include - - - - - src - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp-signaling/src/mrcp_session_descriptor.c b/libs/unimrcp/libs/mrcp-signaling/src/mrcp_session_descriptor.c deleted file mode 100644 index a14545708b..0000000000 --- a/libs/unimrcp/libs/mrcp-signaling/src/mrcp_session_descriptor.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_session_descriptor.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mrcp_session_descriptor.h" - -MRCP_DECLARE(mrcp_session_descriptor_t*) mrcp_session_descriptor_create(apr_pool_t *pool) -{ - mrcp_session_descriptor_t *descriptor = apr_palloc(pool,sizeof(mrcp_session_descriptor_t)); - apt_string_reset(&descriptor->origin); - apt_string_reset(&descriptor->ip); - apt_string_reset(&descriptor->ext_ip); - apt_string_reset(&descriptor->resource_name); - descriptor->resource_state = FALSE; - descriptor->status = MRCP_SESSION_STATUS_OK; - descriptor->response_code = 0; - descriptor->control_media_arr = apr_array_make(pool,1,sizeof(void*)); - descriptor->audio_media_arr = apr_array_make(pool,1,sizeof(mpf_rtp_media_descriptor_t*)); - descriptor->video_media_arr = apr_array_make(pool,0,sizeof(mpf_rtp_media_descriptor_t*)); - return descriptor; -} - -MRCP_DECLARE(const char*) mrcp_session_status_phrase_get(mrcp_session_status_e status) -{ - switch(status) { - case MRCP_SESSION_STATUS_OK: - return "OK"; - case MRCP_SESSION_STATUS_NO_SUCH_RESOURCE: - return "Not Found"; - case MRCP_SESSION_STATUS_UNACCEPTABLE_RESOURCE: - return "Not Acceptable"; - case MRCP_SESSION_STATUS_UNAVAILABLE_RESOURCE: - return "Unavailable"; - case MRCP_SESSION_STATUS_ERROR: - return "Error"; - } - return "Unknown"; -} diff --git a/libs/unimrcp/libs/mrcp-signaling/src/mrcp_sig_agent.c b/libs/unimrcp/libs/mrcp-signaling/src/mrcp_sig_agent.c deleted file mode 100644 index dca8de94c3..0000000000 --- a/libs/unimrcp/libs/mrcp-signaling/src/mrcp_sig_agent.c +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_sig_agent.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mrcp_sig_agent.h" -#include "mrcp_session.h" -#include "apt_pool.h" - -/** Factory of MRCP signaling agents */ -struct mrcp_sa_factory_t { - /** Array of pointers to signaling agents */ - apr_array_header_t *agents_arr; - /** Index of the current agent */ - int index; -}; - -/** Create signaling agent */ -MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_signaling_agent_create(const char *id, void *obj, apr_pool_t *pool) -{ - mrcp_sig_agent_t *sig_agent = apr_palloc(pool,sizeof(mrcp_sig_agent_t)); - sig_agent->id = id; - sig_agent->pool = pool; - sig_agent->obj = obj; - sig_agent->resource_factory = NULL; - sig_agent->parent = NULL; - sig_agent->task = NULL; - sig_agent->msg_pool = NULL; - sig_agent->create_server_session = NULL; - sig_agent->create_client_session = NULL; - return sig_agent; -} - -/** Create factory of signaling agents */ -MRCP_DECLARE(mrcp_sa_factory_t*) mrcp_sa_factory_create(apr_pool_t *pool) -{ - mrcp_sa_factory_t *sa_factory = apr_palloc(pool,sizeof(mrcp_sa_factory_t)); - sa_factory->agents_arr = apr_array_make(pool,1,sizeof(mrcp_sig_agent_t*)); - sa_factory->index = 0; - return sa_factory; -} - -/** Add signaling agent to pool */ -MRCP_DECLARE(apt_bool_t) mrcp_sa_factory_agent_add(mrcp_sa_factory_t *sa_factory, mrcp_sig_agent_t *sig_agent) -{ - mrcp_sig_agent_t **slot; - if(!sig_agent) - return FALSE; - - slot = apr_array_push(sa_factory->agents_arr); - *slot = sig_agent; - return TRUE; -} - -/** Determine whether factory is empty. */ -MRCP_DECLARE(apt_bool_t) mrcp_sa_factory_is_empty(const mrcp_sa_factory_t *sa_factory) -{ - return apr_is_empty_array(sa_factory->agents_arr); -} - -/** Select next available signaling agent */ -MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_sa_factory_agent_select(mrcp_sa_factory_t *sa_factory) -{ - mrcp_sig_agent_t *sig_agent = APR_ARRAY_IDX(sa_factory->agents_arr, sa_factory->index, mrcp_sig_agent_t*); - if(++sa_factory->index == sa_factory->agents_arr->nelts) { - sa_factory->index = 0; - } - return sig_agent; -} - -/** Allocate MRCP signaling settings */ -MRCP_DECLARE(mrcp_sig_settings_t*) mrcp_signaling_settings_alloc(apr_pool_t *pool) -{ - mrcp_sig_settings_t *settings = apr_palloc(pool,sizeof(mrcp_sig_settings_t)); - settings->server_ip = NULL; - settings->server_port = 0; - settings->user_name = NULL; - settings->resource_location = NULL; - settings->resource_map = apr_table_make(pool,2); - settings->force_destination = FALSE; - settings->feature_tags = NULL; - return settings; -} - - -MRCP_DECLARE(mrcp_session_t*) mrcp_session_create(apr_size_t padding) -{ - mrcp_session_t *session; - apr_pool_t *pool = apt_pool_create(); - if(!pool) { - return NULL; - } - session = apr_palloc(pool,sizeof(mrcp_session_t)+padding); - session->pool = pool; - session->obj = NULL; - session->log_obj = NULL; - session->name = NULL; - session->signaling_agent = NULL; - session->connection_agent = NULL; - session->media_engine = NULL; - session->rtp_factory = NULL; - session->request_vtable = NULL; - session->response_vtable = NULL; - session->event_vtable = NULL; - apt_string_reset(&session->id); - session->last_request_id = 0; - return session; -} - -MRCP_DECLARE(void) mrcp_session_destroy(mrcp_session_t *session) -{ - if(session->pool) { - apr_pool_destroy(session->pool); - } -} diff --git a/libs/unimrcp/libs/mrcp/Makefile.am b/libs/unimrcp/libs/mrcp/Makefile.am deleted file mode 100644 index 7c893f8dd9..0000000000 --- a/libs/unimrcp/libs/mrcp/Makefile.am +++ /dev/null @@ -1,47 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -AM_CPPFLAGS = -I$(top_srcdir)/libs/mrcp/include \ - -I$(top_srcdir)/libs/mrcp/message/include \ - -I$(top_srcdir)/libs/mrcp/control/include \ - -I$(top_srcdir)/libs/mrcp/resources/include \ - -I$(top_srcdir)/libs/apr-toolkit/include \ - $(UNIMRCP_APR_INCLUDES) - -noinst_LTLIBRARIES = libmrcp.la - -include_HEADERS = include/mrcp.h \ - include/mrcp_types.h \ - message/include/mrcp_start_line.h \ - message/include/mrcp_header_accessor.h \ - message/include/mrcp_generic_header.h \ - message/include/mrcp_header.h \ - message/include/mrcp_message.h \ - control/include/mrcp_resource.h \ - control/include/mrcp_resource_factory.h \ - control/include/mrcp_resource_loader.h \ - control/include/mrcp_stream.h \ - resources/include/mrcp_synth_header.h \ - resources/include/mrcp_synth_resource.h \ - resources/include/mrcp_recog_header.h \ - resources/include/mrcp_recog_resource.h \ - resources/include/mrcp_recorder_header.h \ - resources/include/mrcp_recorder_resource.h \ - resources/include/mrcp_verifier_header.h \ - resources/include/mrcp_verifier_resource.h - -libmrcp_la_SOURCES = message/src/mrcp_start_line.c \ - message/src/mrcp_header_accessor.c \ - message/src/mrcp_generic_header.c \ - message/src/mrcp_header.c \ - message/src/mrcp_message.c \ - control/src/mrcp_resource_factory.c \ - control/src/mrcp_resource_loader.c \ - control/src/mrcp_stream.c \ - resources/src/mrcp_synth_header.c \ - resources/src/mrcp_synth_resource.c \ - resources/src/mrcp_recog_header.c \ - resources/src/mrcp_recog_resource.c \ - resources/src/mrcp_recorder_header.c \ - resources/src/mrcp_recorder_resource.c \ - resources/src/mrcp_verifier_header.c \ - resources/src/mrcp_verifier_resource.c diff --git a/libs/unimrcp/libs/mrcp/control/include/mrcp_resource.h b/libs/unimrcp/libs/mrcp/control/include/mrcp_resource.h deleted file mode 100644 index 9c2910903a..0000000000 --- a/libs/unimrcp/libs/mrcp/control/include/mrcp_resource.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_resource.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_RESOURCE_H -#define MRCP_RESOURCE_H - -/** - * @file mrcp_resource.h - * @brief Abstract MRCP Resource - */ - -#include "mrcp_types.h" -#include "mrcp_header_accessor.h" - -APT_BEGIN_EXTERN_C - - -/** MRCP resource definition */ -struct mrcp_resource_t { - /** MRCP resource identifier */ - mrcp_resource_id id; - /** MRCP resource name */ - apt_str_t name; - - /** Get string table of methods */ - const apt_str_table_item_t* (*get_method_str_table)(mrcp_version_e version); - /** Number of methods */ - apr_size_t method_count; - - /** Get string table of events */ - const apt_str_table_item_t* (*get_event_str_table)(mrcp_version_e version); - /** Number of events */ - apr_size_t event_count; - - /** Get vtable of resource header */ - const mrcp_header_vtable_t* (*get_resource_header_vtable)(mrcp_version_e version); -}; - -/** Initialize MRCP resource */ -static APR_INLINE mrcp_resource_t* mrcp_resource_create(apr_pool_t *pool) -{ - mrcp_resource_t *resource = (mrcp_resource_t*) apr_palloc(pool, sizeof(mrcp_resource_t)); - resource->id = 0; - apt_string_reset(&resource->name); - resource->method_count = 0; - resource->event_count = 0; - resource->get_method_str_table = NULL; - resource->get_event_str_table = NULL; - resource->get_resource_header_vtable = NULL; - return resource; -} - -/** Validate MRCP resource */ -static APR_INLINE apt_bool_t mrcp_resource_validate(mrcp_resource_t *resource) -{ - if(resource->method_count && resource->event_count && - resource->get_method_str_table && resource->get_event_str_table && - resource->get_resource_header_vtable && - resource->name.buf && resource->name.length) { - return TRUE; - } - return FALSE; -} - -APT_END_EXTERN_C - -#endif /* MRCP_RESOURCE_H */ diff --git a/libs/unimrcp/libs/mrcp/control/include/mrcp_resource_factory.h b/libs/unimrcp/libs/mrcp/control/include/mrcp_resource_factory.h deleted file mode 100644 index 0f3c2f6e09..0000000000 --- a/libs/unimrcp/libs/mrcp/control/include/mrcp_resource_factory.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_resource_factory.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_RESOURCE_FACTORY_H -#define MRCP_RESOURCE_FACTORY_H - -/** - * @file mrcp_resource_factory.h - * @brief Aggregation of MRCP Resources - */ - -#include "apt_text_stream.h" -#include "mrcp_types.h" - -APT_BEGIN_EXTERN_C - -/** Create MRCP resource factory */ -MRCP_DECLARE(mrcp_resource_factory_t*) mrcp_resource_factory_create(apr_size_t resource_count, apr_pool_t *pool); - -/** Destroy MRCP resource factory */ -MRCP_DECLARE(apt_bool_t) mrcp_resource_factory_destroy(mrcp_resource_factory_t *resource_factory); - -/** Register MRCP resource */ -MRCP_DECLARE(apt_bool_t) mrcp_resource_register(mrcp_resource_factory_t *resource_factory, mrcp_resource_t *resource); - -/** Get MRCP resource by resource id */ -MRCP_DECLARE(mrcp_resource_t*) mrcp_resource_get(const mrcp_resource_factory_t *resource_factory, mrcp_resource_id resource_id); - -/** Find MRCP resource by resource name */ -MRCP_DECLARE(mrcp_resource_t*) mrcp_resource_find(const mrcp_resource_factory_t *resource_factory, const apt_str_t *name); - - -APT_END_EXTERN_C - -#endif /* MRCP_RESOURCE_FACTORY_H */ diff --git a/libs/unimrcp/libs/mrcp/control/include/mrcp_resource_loader.h b/libs/unimrcp/libs/mrcp/control/include/mrcp_resource_loader.h deleted file mode 100644 index 555b580a6d..0000000000 --- a/libs/unimrcp/libs/mrcp/control/include/mrcp_resource_loader.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_resource_loader.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_RESOURCE_LOADER_H -#define MRCP_RESOURCE_LOADER_H - -/** - * @file mrcp_resource_loader.h - * @brief MRCP Resource Loader - */ - -#include "apt_string.h" -#include "mrcp_types.h" - -APT_BEGIN_EXTERN_C - -/** Opaque resource loader declaration */ -typedef struct mrcp_resource_loader_t mrcp_resource_loader_t; - - -/** Create MRCP resource loader */ -MRCP_DECLARE(mrcp_resource_loader_t*) mrcp_resource_loader_create(apt_bool_t load_all_resources, apr_pool_t *pool); - -/** Load all MRCP resources */ -MRCP_DECLARE(apt_bool_t) mrcp_resources_load(mrcp_resource_loader_t *loader); - -/** Load MRCP resource by resource name */ -MRCP_DECLARE(apt_bool_t) mrcp_resource_load(mrcp_resource_loader_t *loader, const apt_str_t *name); - -/** Load MRCP resource by resource identifier */ -MRCP_DECLARE(apt_bool_t) mrcp_resource_load_by_id(mrcp_resource_loader_t *loader, mrcp_resource_id id); - -/** Get MRCP resource factory */ -MRCP_DECLARE(mrcp_resource_factory_t*) mrcp_resource_factory_get(const mrcp_resource_loader_t *loader); - -APT_END_EXTERN_C - -#endif /* MRCP_RESOURCE_LOADER_H */ diff --git a/libs/unimrcp/libs/mrcp/control/include/mrcp_stream.h b/libs/unimrcp/libs/mrcp/control/include/mrcp_stream.h deleted file mode 100644 index 1389effb42..0000000000 --- a/libs/unimrcp/libs/mrcp/control/include/mrcp_stream.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_stream.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_STREAM_H -#define MRCP_STREAM_H - -/** - * @file mrcp_stream.h - * @brief MRCP Stream Parser and Generator - */ - -#include "apt_text_message.h" -#include "mrcp_types.h" - -APT_BEGIN_EXTERN_C - - -/** Opaque MRCP parser declaration */ -typedef struct mrcp_parser_t mrcp_parser_t; -/** Opaque MRCP generator declaration */ -typedef struct mrcp_generator_t mrcp_generator_t; - - -/** Create MRCP stream parser */ -MRCP_DECLARE(mrcp_parser_t*) mrcp_parser_create(const mrcp_resource_factory_t *resource_factory, apr_pool_t *pool); - -/** Set resource by name to be used for parsing of MRCPv1 messages */ -MRCP_DECLARE(void) mrcp_parser_resource_set(mrcp_parser_t *parser, const apt_str_t *resource_name); - -/** Set verbose mode for the parser */ -MRCP_DECLARE(void) mrcp_parser_verbose_set(mrcp_parser_t *parser, apt_bool_t verbose); - -/** Parse MRCP stream */ -MRCP_DECLARE(apt_message_status_e) mrcp_parser_run(mrcp_parser_t *parser, apt_text_stream_t *stream, mrcp_message_t **message); - - - -/** Create MRCP stream generator */ -MRCP_DECLARE(mrcp_generator_t*) mrcp_generator_create(const mrcp_resource_factory_t *resource_factory, apr_pool_t *pool); - -/** Set verbose mode for the generator */ -MRCP_DECLARE(void) mrcp_generator_verbose_set(mrcp_generator_t *generator, apt_bool_t verbose); - -/** Generate MRCP stream */ -MRCP_DECLARE(apt_message_status_e) mrcp_generator_run(mrcp_generator_t *generator, mrcp_message_t *message, apt_text_stream_t *stream); - - -/** Generate MRCP message (excluding message body) */ -MRCP_DECLARE(apt_bool_t) mrcp_message_generate(const mrcp_resource_factory_t *resource_factory, mrcp_message_t *message, apt_text_stream_t *stream); - - -APT_END_EXTERN_C - -#endif /* MRCP_STREAM_H */ diff --git a/libs/unimrcp/libs/mrcp/control/src/mrcp_resource_factory.c b/libs/unimrcp/libs/mrcp/control/src/mrcp_resource_factory.c deleted file mode 100644 index e0a1124075..0000000000 --- a/libs/unimrcp/libs/mrcp/control/src/mrcp_resource_factory.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_resource_factory.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include "mrcp_resource_factory.h" -#include "mrcp_message.h" -#include "mrcp_resource.h" -#include "mrcp_generic_header.h" - -/** Resource factory definition (aggregation of resources) */ -struct mrcp_resource_factory_t { - /** Array of MRCP resources (reference by id) */ - mrcp_resource_t **resource_array; - /** Number of MRCP resources */ - apr_size_t resource_count; - /** Hash of MRCP resources (reference by name) */ - apr_hash_t *resource_hash; -}; - -/** Create MRCP resource factory */ -MRCP_DECLARE(mrcp_resource_factory_t*) mrcp_resource_factory_create(apr_size_t resource_count, apr_pool_t *pool) -{ - apr_size_t i; - mrcp_resource_factory_t *resource_factory; - if(resource_count == 0) { - return NULL; - } - - resource_factory = apr_palloc(pool,sizeof(mrcp_resource_factory_t)); - resource_factory->resource_count = resource_count; - resource_factory->resource_array = apr_palloc(pool,sizeof(mrcp_resource_t*)*resource_count); - for(i=0; iresource_array[i] = NULL; - } - resource_factory->resource_hash = apr_hash_make(pool); - return resource_factory; -} - -/** Destroy MRCP resource container */ -MRCP_DECLARE(apt_bool_t) mrcp_resource_factory_destroy(mrcp_resource_factory_t *resource_factory) -{ - if(resource_factory->resource_array) { - resource_factory->resource_array = NULL; - } - resource_factory->resource_count = 0; - return TRUE; -} - -/** Register MRCP resource */ -MRCP_DECLARE(apt_bool_t) mrcp_resource_register(mrcp_resource_factory_t *resource_factory, mrcp_resource_t *resource) -{ - if(!resource || resource->id >= resource_factory->resource_count) { - /* invalid params */ - return FALSE; - } - if(resource_factory->resource_array[resource->id]) { - /* resource with specified id already exists */ - return FALSE; - } - if(mrcp_resource_validate(resource) != TRUE) { - /* invalid resource */ - return FALSE; - } - resource_factory->resource_array[resource->id] = resource; - apr_hash_set(resource_factory->resource_hash,resource->name.buf,resource->name.length,resource); - return TRUE; -} - -/** Get MRCP resource by resource id */ -MRCP_DECLARE(mrcp_resource_t*) mrcp_resource_get(const mrcp_resource_factory_t *resource_factory, mrcp_resource_id resource_id) -{ - if(resource_id >= resource_factory->resource_count) { - return NULL; - } - return resource_factory->resource_array[resource_id]; -} - -/** Find MRCP resource by resource name */ -MRCP_DECLARE(mrcp_resource_t*) mrcp_resource_find(const mrcp_resource_factory_t *resource_factory, const apt_str_t *name) -{ - if(!name->buf || !name->length) { - return NULL; - } - - return apr_hash_get(resource_factory->resource_hash,name->buf,name->length); -} diff --git a/libs/unimrcp/libs/mrcp/control/src/mrcp_resource_loader.c b/libs/unimrcp/libs/mrcp/control/src/mrcp_resource_loader.c deleted file mode 100644 index d172bdddb4..0000000000 --- a/libs/unimrcp/libs/mrcp/control/src/mrcp_resource_loader.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_resource_loader.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mrcp_resource_loader.h" -#include "mrcp_resource_factory.h" -#include "mrcp_resource.h" -#include "mrcp_synth_resource.h" -#include "mrcp_recog_resource.h" -#include "mrcp_recorder_resource.h" -#include "mrcp_verifier_resource.h" -#include "apt_log.h" - -/** Resource loader */ -struct mrcp_resource_loader_t { - mrcp_resource_factory_t *factory; - apr_pool_t *pool; -}; - -/** String table of MRCPv2 resources (mrcp_resource_type_e) */ -static const apt_str_table_item_t mrcp_resource_string_table[] = { - {{"speechsynth",11},6}, - {{"speechrecog",11},6}, - {{"recorder", 8},0}, - {{"speakverify",11},3} -}; - -static mrcp_resource_t* mrcp_resource_create_by_id(mrcp_resource_id id, apr_pool_t *pool); - -/** Create default MRCP resource factory */ -MRCP_DECLARE(mrcp_resource_loader_t*) mrcp_resource_loader_create(apt_bool_t load_all_resources, apr_pool_t *pool) -{ - mrcp_resource_loader_t *loader; - mrcp_resource_factory_t *resource_factory; - resource_factory = mrcp_resource_factory_create(MRCP_RESOURCE_TYPE_COUNT,pool); - if(!resource_factory) { - return NULL; - } - - loader = apr_palloc(pool,sizeof(mrcp_resource_loader_t)); - loader->factory = resource_factory; - loader->pool = pool; - - if(load_all_resources == TRUE) { - mrcp_resources_load(loader); - } - - return loader; -} - -/** Load all MRCP resources */ -MRCP_DECLARE(apt_bool_t) mrcp_resources_load(mrcp_resource_loader_t *loader) -{ - mrcp_resource_id id; - for(id=0; idpool); - if(!resource) { - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Failed to Load Resource [%d]",id); - return FALSE; - } - - apt_string_copy(&resource->name,name,loader->pool); - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Register Resource [%s]",name->buf); - return mrcp_resource_register(loader->factory,resource); -} - -/** Load MRCP resource by resource identifier */ -MRCP_DECLARE(apt_bool_t) mrcp_resource_load_by_id(mrcp_resource_loader_t *loader, mrcp_resource_id id) -{ - const apt_str_t *name = apt_string_table_str_get( - mrcp_resource_string_table, - MRCP_RESOURCE_TYPE_COUNT, - id); - mrcp_resource_t *resource = mrcp_resource_create_by_id(id,loader->pool); - if(!resource || !name) { - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Failed to Load Resource [%d]",id); - return FALSE; - } - - resource->name = *name; - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Register Resource [%s]",resource->name.buf); - return mrcp_resource_register(loader->factory,resource); -} - -/** Get MRCP resource factory */ -MRCP_DECLARE(mrcp_resource_factory_t*) mrcp_resource_factory_get(const mrcp_resource_loader_t *loader) -{ - return loader->factory; -} - -static mrcp_resource_t* mrcp_resource_create_by_id(mrcp_resource_id id, apr_pool_t *pool) -{ - mrcp_resource_t *resource = NULL; - switch(id) { - case MRCP_SYNTHESIZER_RESOURCE: - resource = mrcp_synth_resource_create(pool); - break; - case MRCP_RECOGNIZER_RESOURCE: - resource = mrcp_recog_resource_create(pool); - break; - case MRCP_RECORDER_RESOURCE: - resource = mrcp_recorder_resource_create(pool); - break; - case MRCP_VERIFIER_RESOURCE: - resource = mrcp_verifier_resource_create(pool); - break; - } - - if(resource) { - resource->id = id; - } - return resource; -} diff --git a/libs/unimrcp/libs/mrcp/control/src/mrcp_stream.c b/libs/unimrcp/libs/mrcp/control/src/mrcp_stream.c deleted file mode 100644 index 7791764722..0000000000 --- a/libs/unimrcp/libs/mrcp/control/src/mrcp_stream.c +++ /dev/null @@ -1,245 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_stream.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mrcp_stream.h" -#include "mrcp_message.h" -#include "mrcp_resource_factory.h" -#include "mrcp_resource.h" -#include "apt_log.h" - - -/** MRCP parser */ -struct mrcp_parser_t { - apt_message_parser_t *base; - const mrcp_resource_factory_t *resource_factory; - mrcp_resource_t *resource; -}; - -/** MRCP generator */ -struct mrcp_generator_t { - apt_message_generator_t *base; - const mrcp_resource_factory_t *resource_factory; -}; - -/** Create message and read start line */ -static apt_bool_t mrcp_parser_on_start(apt_message_parser_t *parser, apt_message_context_t *context, apt_text_stream_t *stream, apr_pool_t *pool); -/** Header section handler */ -static apt_bool_t mrcp_parser_on_header_complete(apt_message_parser_t *parser, apt_message_context_t *context); - -static const apt_message_parser_vtable_t parser_vtable = { - mrcp_parser_on_start, - mrcp_parser_on_header_complete, - NULL -}; - -/** Start message generation */ -apt_bool_t mrcp_generator_on_start(apt_message_generator_t *generator, apt_message_context_t *context, apt_text_stream_t *stream); -/** Finalize by setting overall message length in start line */ -apt_bool_t mrcp_generator_on_header_complete(apt_message_generator_t *generator, apt_message_context_t *context, apt_text_stream_t *stream); - -static const apt_message_generator_vtable_t generator_vtable = { - mrcp_generator_on_start, - mrcp_generator_on_header_complete, - NULL -}; - - -/** Create MRCP stream parser */ -MRCP_DECLARE(mrcp_parser_t*) mrcp_parser_create(const mrcp_resource_factory_t *resource_factory, apr_pool_t *pool) -{ - mrcp_parser_t *parser = apr_palloc(pool,sizeof(mrcp_parser_t)); - parser->base = apt_message_parser_create(parser,&parser_vtable,pool); - parser->resource_factory = resource_factory; - parser->resource = NULL; - return parser; -} - -/** Set resource by name to be used for parsing of MRCPv1 messages */ -MRCP_DECLARE(void) mrcp_parser_resource_set(mrcp_parser_t *parser, const apt_str_t *resource_name) -{ - if(resource_name) { - parser->resource = mrcp_resource_find(parser->resource_factory,resource_name); - } -} - -/** Set verbose mode for the parser */ -MRCP_DECLARE(void) mrcp_parser_verbose_set(mrcp_parser_t *parser, apt_bool_t verbose) -{ - apt_message_parser_verbose_set(parser->base,verbose); -} - -/** Parse MRCP stream */ -MRCP_DECLARE(apt_message_status_e) mrcp_parser_run(mrcp_parser_t *parser, apt_text_stream_t *stream, mrcp_message_t **message) -{ - return apt_message_parser_run(parser->base,stream,(void**)message); -} - -/** Create message and read start line */ -static apt_bool_t mrcp_parser_on_start(apt_message_parser_t *parser, apt_message_context_t *context, apt_text_stream_t *stream, apr_pool_t *pool) -{ - mrcp_message_t *mrcp_message; - apt_str_t start_line; - /* read start line */ - if(apt_text_line_read(stream,&start_line) == FALSE) { - return FALSE; - } - - /* create new MRCP message */ - mrcp_message = mrcp_message_create(pool); - /* parse start-line */ - if(mrcp_start_line_parse(&mrcp_message->start_line,&start_line,mrcp_message->pool) == FALSE) { - return FALSE; - } - - if(mrcp_message->start_line.version == MRCP_VERSION_1) { - mrcp_parser_t *mrcp_parser = apt_message_parser_object_get(parser); - if(!mrcp_parser->resource) { - return FALSE; - } - apt_string_copy( - &mrcp_message->channel_id.resource_name, - &mrcp_parser->resource->name, - pool); - - if(mrcp_message_resource_set(mrcp_message,mrcp_parser->resource) == FALSE) { - return FALSE; - } - } - - context->message = mrcp_message; - context->header = &mrcp_message->header.header_section; - context->body = &mrcp_message->body; - return TRUE; -} - -/** Header section handler */ -static apt_bool_t mrcp_parser_on_header_complete(apt_message_parser_t *parser, apt_message_context_t *context) -{ - mrcp_message_t *mrcp_message = context->message; - if(mrcp_message->start_line.version == MRCP_VERSION_2) { - mrcp_resource_t *resource; - mrcp_parser_t *mrcp_parser; - if(mrcp_channel_id_parse(&mrcp_message->channel_id,&mrcp_message->header,mrcp_message->pool) == FALSE) { - return FALSE; - } - mrcp_parser = apt_message_parser_object_get(parser); - /* find resource */ - resource = mrcp_resource_find(mrcp_parser->resource_factory,&mrcp_message->channel_id.resource_name); - if(!resource) { - return FALSE; - } - - if(mrcp_message_resource_set(mrcp_message,resource) == FALSE) { - return FALSE; - } - } - - if(mrcp_header_fields_parse(&mrcp_message->header,mrcp_message->pool) == FALSE) { - return FALSE; - } - - if(context->body && mrcp_generic_header_property_check(mrcp_message,GENERIC_HEADER_CONTENT_LENGTH) == TRUE) { - mrcp_generic_header_t *generic_header = mrcp_generic_header_get(mrcp_message); - if(generic_header && generic_header->content_length) { - context->body->length = generic_header->content_length; - } - } - return TRUE; -} - - -/** Create MRCP stream generator */ -MRCP_DECLARE(mrcp_generator_t*) mrcp_generator_create(const mrcp_resource_factory_t *resource_factory, apr_pool_t *pool) -{ - mrcp_generator_t *generator = apr_palloc(pool,sizeof(mrcp_generator_t)); - generator->base = apt_message_generator_create(generator,&generator_vtable,pool); - generator->resource_factory = resource_factory; - return generator; -} - -/** Set verbose mode for the generator */ -MRCP_DECLARE(void) mrcp_generator_verbose_set(mrcp_generator_t *generator, apt_bool_t verbose) -{ - apt_message_generator_verbose_set(generator->base,verbose); -} - -/** Generate MRCP stream */ -MRCP_DECLARE(apt_message_status_e) mrcp_generator_run(mrcp_generator_t *generator, mrcp_message_t *message, apt_text_stream_t *stream) -{ - return apt_message_generator_run(generator->base,message,stream); -} - -/** Initialize by generating message start line and return header section and body */ -apt_bool_t mrcp_generator_on_start(apt_message_generator_t *generator, apt_message_context_t *context, apt_text_stream_t *stream) -{ - mrcp_message_t *mrcp_message = context->message; - /* validate message */ - if(mrcp_message_validate(mrcp_message) == FALSE) { - return FALSE; - } - /* generate start-line */ - if(mrcp_start_line_generate(&mrcp_message->start_line,stream) == FALSE) { - return FALSE; - } - - if(mrcp_message->start_line.version == MRCP_VERSION_2) { - mrcp_channel_id_generate(&mrcp_message->channel_id,stream); - } - - context->header = &mrcp_message->header.header_section; - context->body = &mrcp_message->body; - return TRUE; -} - -/** Finalize by setting overall message length in start line */ -apt_bool_t mrcp_generator_on_header_complete(apt_message_generator_t *generator, apt_message_context_t *context, apt_text_stream_t *stream) -{ - mrcp_message_t *mrcp_message = context->message; - /* finalize start-line generation */ - return mrcp_start_line_finalize(&mrcp_message->start_line,mrcp_message->body.length,stream); -} - -/** Generate MRCP message (excluding message body) */ -MRCP_DECLARE(apt_bool_t) mrcp_message_generate(const mrcp_resource_factory_t *resource_factory, mrcp_message_t *message, apt_text_stream_t *stream) -{ - /* validate message */ - if(mrcp_message_validate(message) == FALSE) { - return FALSE; - } - - /* generate start-line */ - if(mrcp_start_line_generate(&message->start_line,stream) == FALSE) { - return FALSE; - } - - if(message->start_line.version == MRCP_VERSION_2) { - mrcp_channel_id_generate(&message->channel_id,stream); - } - - /* generate header section */ - if(apt_header_section_generate(&message->header.header_section,stream) == FALSE) { - return FALSE; - } - - /* finalize start-line generation */ - if(mrcp_start_line_finalize(&message->start_line,message->body.length,stream) == FALSE) { - return FALSE; - } - - return TRUE; -} diff --git a/libs/unimrcp/libs/mrcp/include/mrcp.h b/libs/unimrcp/libs/mrcp/include/mrcp.h deleted file mode 100644 index 995443e7ee..0000000000 --- a/libs/unimrcp/libs/mrcp/include/mrcp.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_H -#define MRCP_H - -/** - * @file mrcp.h - * @brief MRCP Core Definitions - */ - -#include -#include - -/** Library export/import defines */ -#ifdef WIN32 -#ifdef MRCP_STATIC_LIB -#define MRCP_DECLARE(type) type __stdcall -#else -#ifdef MRCP_LIB_EXPORT -#define MRCP_DECLARE(type) __declspec(dllexport) type __stdcall -#else -#define MRCP_DECLARE(type) __declspec(dllimport) type __stdcall -#endif -#endif -#else -#define MRCP_DECLARE(type) type -#endif - -#endif /* MRCP_H */ diff --git a/libs/unimrcp/libs/mrcp/include/mrcp_types.h b/libs/unimrcp/libs/mrcp/include/mrcp_types.h deleted file mode 100644 index 3f37cb6cfe..0000000000 --- a/libs/unimrcp/libs/mrcp/include/mrcp_types.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_types.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_TYPES_H -#define MRCP_TYPES_H - -/** - * @file mrcp_types.h - * @brief Basic MRCP Types - */ - -#include "mrcp.h" - -APT_BEGIN_EXTERN_C - -/** Protocol version */ -typedef enum { - - MRCP_VERSION_UNKNOWN = 0, /**< Unknown version */ - MRCP_VERSION_1 = 1, /**< MRCPv1 (RFC4463) */ - MRCP_VERSION_2 = 2 /**< MRCPv2 (draft-ietf-speechsc-mrcpv2-20) */ -} mrcp_version_e; - -/** Enumeration of MRCP resource types */ -typedef enum { - MRCP_SYNTHESIZER_RESOURCE, /**< Synthesizer resource */ - MRCP_RECOGNIZER_RESOURCE, /**< Recognizer resource */ - MRCP_RECORDER_RESOURCE, /**< Recorder resource */ - MRCP_VERIFIER_RESOURCE, /**< Verifier resource */ - - MRCP_RESOURCE_TYPE_COUNT /**< Number of resources */ -} mrcp_resource_type_e; - -/* MRCPv2 specifies request-id as 32bit unsigned integer, - * while MRCPv1 doesn't limit this value (1 * DIGIT). - * Some MRCPv1 clients use too long request-id. - * To support them #define TOO_LONG_MRCP_REQUEST_ID - */ -#ifdef TOO_LONG_MRCP_REQUEST_ID -/** MRCP request identifier */ -typedef apr_uint64_t mrcp_request_id; -/** Format to log MRCP request identifier */ -#define MRCP_REQUEST_ID_FMT APR_UINT64_T_FMT -#else -/** MRCP request identifier */ -typedef apr_uint32_t mrcp_request_id; -/** Format to log MRCP request identifier */ -#define MRCP_REQUEST_ID_FMT "d" -#endif - - -/** Method identifier associated with method name */ -typedef apr_size_t mrcp_method_id; -/** Resource identifier associated with resource name */ -typedef apr_size_t mrcp_resource_id; - - -/** Opaque MRCP message declaration */ -typedef struct mrcp_message_t mrcp_message_t; -/** Opaque MRCP resource declaration */ -typedef struct mrcp_resource_t mrcp_resource_t; -/** Opaque MRCP resource factory declaration */ -typedef struct mrcp_resource_factory_t mrcp_resource_factory_t; - - -APT_END_EXTERN_C - -#endif /* MRCP_TYPES_H */ diff --git a/libs/unimrcp/libs/mrcp/message/include/mrcp_generic_header.h b/libs/unimrcp/libs/mrcp/message/include/mrcp_generic_header.h deleted file mode 100644 index af84350da4..0000000000 --- a/libs/unimrcp/libs/mrcp/message/include/mrcp_generic_header.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_generic_header.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_GENERIC_HEADER_H -#define MRCP_GENERIC_HEADER_H - -/** - * @file mrcp_generic_header.h - * @brief MRCP Generic Header - */ - -#include "mrcp_types.h" -#include "mrcp_header_accessor.h" - -APT_BEGIN_EXTERN_C - -/** Enumeration of MRCP generic header fields */ -typedef enum { - GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST, - GENERIC_HEADER_PROXY_SYNC_ID, - GENERIC_HEADER_ACCEPT_CHARSET, - GENERIC_HEADER_CONTENT_TYPE, - GENERIC_HEADER_CONTENT_ID, - GENERIC_HEADER_CONTENT_BASE, - GENERIC_HEADER_CONTENT_ENCODING, - GENERIC_HEADER_CONTENT_LOCATION, - GENERIC_HEADER_CONTENT_LENGTH, - GENERIC_HEADER_CACHE_CONTROL, - GENERIC_HEADER_LOGGING_TAG, - GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS, - - /** Additional header fields for MRCP v2 */ - GENERIC_HEADER_ACCEPT, - GENERIC_HEADER_FETCH_TIMEOUT, - GENERIC_HEADER_SET_COOKIE, - GENERIC_HEADER_SET_COOKIE2, - - GENERIC_HEADER_COUNT -} mrcp_generic_header_id; - -/** MRCP request identifiers list declaration */ -typedef struct mrcp_request_id_list_t mrcp_request_id_list_t; -/** MRCP vendor specific parameter list of pairs */ -typedef struct mrcp_vendor_specific_params_list_t mrcp_vendor_specific_params_list_t; -/** MRCP generic header declaration */ -typedef struct mrcp_generic_header_t mrcp_generic_header_t; - -/** Max number of request ids in active request id list */ -#define MAX_ACTIVE_REQUEST_ID_COUNT 5 -/** List (array) of MRCP request identifiers */ -struct mrcp_request_id_list_t { - /** Array of request identifiers */ - mrcp_request_id ids[MAX_ACTIVE_REQUEST_ID_COUNT]; - /** Number of request identifiers */ - apr_size_t count; -}; - - -/** MRCP generic header */ -struct mrcp_generic_header_t { - /** Indicates the list of request-ids to which it should apply */ - mrcp_request_id_list_t active_request_id_list; - /** Helps the resource receiving the event, proxied by the client, - to decide if this event has been processed through a direct interaction of the resources */ - apt_str_t proxy_sync_id; - /** Specifies the acceptable character set for entities returned in the response or events associated with this request */ - apt_str_t accept_charset; - /** Restricted to speech markup, grammar, recognition results, etc. */ - apt_str_t content_type; - /** Contains an ID or name for the content, by which it can be referred to */ - apt_str_t content_id; - /** May be used to specify the base URI for resolving relative URLs within the entity */ - apt_str_t content_base; - /** Indicates what additional content coding has been applied to the entity-body */ - apt_str_t content_encoding; - /** Statement of the location of the resource corresponding to this particular entity at the time of the request */ - apt_str_t content_location; - /** Contains the length of the content of the message body */ - size_t content_length; - /** Defines the default caching algorithms on the media server for the session or request */ - apt_str_t cache_control; - /** Sets the logging tag for logs generated by the media server */ - apt_str_t logging_tag; - /** Specifies the vendor specific parameters used by the media server */ - apt_pair_arr_t *vendor_specific_params; - - /** Additional header fields for MRCP v2 */ - /** Specifies the acceptable media types set for entities returned in the response or events associated with this request */ - apt_str_t accept; - /** Defines the timeout for content that the server may need to fetch over the network */ - apr_size_t fetch_timeout; - /** Enables to synchronize the cookie store of MRCP v2 client and server */ - apt_str_t set_cookie; - /** Enables to synchronize the cookie store of MRCP v2 client and server */ - apt_str_t set_cookie2; -}; - -/** Get generic header vtable */ -MRCP_DECLARE(const mrcp_header_vtable_t*) mrcp_generic_header_vtable_get(mrcp_version_e version); - - -/** Append active request id list */ -MRCP_DECLARE(apt_bool_t) active_request_id_list_append(mrcp_generic_header_t *generic_header, mrcp_request_id request_id); -/** Find request id in active request id list */ -MRCP_DECLARE(apt_bool_t) active_request_id_list_find(const mrcp_generic_header_t *generic_header, mrcp_request_id request_id); - - -APT_END_EXTERN_C - -#endif /* MRCP_GENERIC_HEADER_H */ diff --git a/libs/unimrcp/libs/mrcp/message/include/mrcp_header.h b/libs/unimrcp/libs/mrcp/message/include/mrcp_header.h deleted file mode 100644 index 9c9c0d5dee..0000000000 --- a/libs/unimrcp/libs/mrcp/message/include/mrcp_header.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_header.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_HEADER_H -#define MRCP_HEADER_H - -/** - * @file mrcp_header.h - * @brief MRCP Message Header Definition - */ - -#include "mrcp_header_accessor.h" - -APT_BEGIN_EXTERN_C - -/** - * Allows external applications to trigger whether - * transaprent header fields are supported or not - */ -#define TRANSPARENT_HEADER_FIELDS_SUPPORT - -/** MRCP message header declaration */ -typedef struct mrcp_message_header_t mrcp_message_header_t; -/** MRCP channel-id declaration */ -typedef struct mrcp_channel_id mrcp_channel_id; - - -/** MRCP message-header */ -struct mrcp_message_header_t { - /** MRCP generic-header */ - mrcp_header_accessor_t generic_header_accessor; - /** MRCP resource specific header */ - mrcp_header_accessor_t resource_header_accessor; - - /** Header section (collection of header fields)*/ - apt_header_section_t header_section; -}; - -/** MRCP channel-identifier */ -struct mrcp_channel_id { - /** Unambiguous string identifying the MRCP session */ - apt_str_t session_id; - /** MRCP resource name */ - apt_str_t resource_name; -}; - - -/** Initialize MRCP message-header */ -static APR_INLINE void mrcp_message_header_init(mrcp_message_header_t *header) -{ - mrcp_header_accessor_init(&header->generic_header_accessor); - mrcp_header_accessor_init(&header->resource_header_accessor); - apt_header_section_init(&header->header_section); -} - -/** Allocate MRCP message-header data */ -MRCP_DECLARE(apt_bool_t) mrcp_message_header_data_alloc( - mrcp_message_header_t *header, - const mrcp_header_vtable_t *generic_header_vtable, - const mrcp_header_vtable_t *resource_header_vtable, - apr_pool_t *pool); - -/** Create MRCP message-header */ -MRCP_DECLARE(mrcp_message_header_t*) mrcp_message_header_create( - const mrcp_header_vtable_t *generic_header_vtable, - const mrcp_header_vtable_t *resource_header_vtable, - apr_pool_t *pool); - -/** Destroy MRCP message-header */ -static APR_INLINE void mrcp_message_header_destroy(mrcp_message_header_t *header) -{ - mrcp_header_destroy(&header->generic_header_accessor); - mrcp_header_destroy(&header->resource_header_accessor); -} - -/** Add MRCP header field */ -MRCP_DECLARE(apt_bool_t) mrcp_header_field_add(mrcp_message_header_t *header, apt_header_field_t *header_field, apr_pool_t *pool); - - -/** Set (copy) MRCP header fields */ -MRCP_DECLARE(apt_bool_t) mrcp_header_fields_set(mrcp_message_header_t *header, const mrcp_message_header_t *src_header, apr_pool_t *pool); - -/** Get (copy) MRCP header fields */ -MRCP_DECLARE(apt_bool_t) mrcp_header_fields_get(mrcp_message_header_t *header, const mrcp_message_header_t *src_header, const mrcp_message_header_t *mask_header, apr_pool_t *pool); - -/** Inherit (copy) MRCP header fields */ -MRCP_DECLARE(apt_bool_t) mrcp_header_fields_inherit(mrcp_message_header_t *header, const mrcp_message_header_t *src_header, apr_pool_t *pool); - -/** Parse MRCP header fields */ -MRCP_DECLARE(apt_bool_t) mrcp_header_fields_parse(mrcp_message_header_t *header, apr_pool_t *pool); - - -/** Initialize MRCP channel-identifier */ -MRCP_DECLARE(void) mrcp_channel_id_init(mrcp_channel_id *channel_id); - -/** Parse MRCP channel-identifier */ -MRCP_DECLARE(apt_bool_t) mrcp_channel_id_parse(mrcp_channel_id *channel_id, mrcp_message_header_t *header, apr_pool_t *pool); - -/** Generate MRCP channel-identifier */ -MRCP_DECLARE(apt_bool_t) mrcp_channel_id_generate(mrcp_channel_id *channel_id, apt_text_stream_t *text_stream); - - - -APT_END_EXTERN_C - -#endif /* MRCP_HEADER_H */ diff --git a/libs/unimrcp/libs/mrcp/message/include/mrcp_header_accessor.h b/libs/unimrcp/libs/mrcp/message/include/mrcp_header_accessor.h deleted file mode 100644 index 217b7bb2cd..0000000000 --- a/libs/unimrcp/libs/mrcp/message/include/mrcp_header_accessor.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_header_accessor.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_HEADER_ACCESSOR_H -#define MRCP_HEADER_ACCESSOR_H - -/** - * @file mrcp_header_accessor.h - * @brief Abstract MRCP Header Accessor - */ - -#include "apt_text_stream.h" -#include "apt_header_field.h" -#include "mrcp.h" - -APT_BEGIN_EXTERN_C - -/** MRCP header accessor declaration */ -typedef struct mrcp_header_accessor_t mrcp_header_accessor_t; -/** MRCP header vtable declaration */ -typedef struct mrcp_header_vtable_t mrcp_header_vtable_t; - -/** MRCP header accessor interface */ -struct mrcp_header_vtable_t { - /** Allocate actual header data */ - void* (*allocate)(mrcp_header_accessor_t *accessor, apr_pool_t *pool); - /** Destroy header data */ - void (*destroy)(mrcp_header_accessor_t *accessor); - - /** Parse header field value */ - apt_bool_t (*parse_field)(mrcp_header_accessor_t *accessor, apr_size_t id, const apt_str_t *value, apr_pool_t *pool); - /** Generate header field value */ - apt_bool_t (*generate_field)(const mrcp_header_accessor_t *accessor, apr_size_t id, apt_str_t *value, apr_pool_t *pool); - /** Duplicate header field value */ - apt_bool_t (*duplicate_field)(mrcp_header_accessor_t *accessor, const mrcp_header_accessor_t *src, apr_size_t id, const apt_str_t *value, apr_pool_t *pool); - - /** Table of fields */ - const apt_str_table_item_t *field_table; - /** Number of fields */ - apr_size_t field_count; -}; - -/** MRCP header accessor */ -struct mrcp_header_accessor_t { - /** Actual header data allocated by accessor */ - void *data; - /** Header accessor interface */ - const mrcp_header_vtable_t *vtable; -}; - - - -/** Initialize header vtable */ -static APR_INLINE void mrcp_header_vtable_init(mrcp_header_vtable_t *vtable) -{ - vtable->allocate = NULL; - vtable->destroy = NULL; - vtable->parse_field = NULL; - vtable->generate_field = NULL; - vtable->duplicate_field = NULL; - vtable->field_table = NULL; - vtable->field_count = 0; -} - -/** Validate header vtable */ -static APR_INLINE apt_bool_t mrcp_header_vtable_validate(const mrcp_header_vtable_t *vtable) -{ - return (vtable->allocate && vtable->destroy && - vtable->parse_field && vtable->generate_field && - vtable->duplicate_field && vtable->field_table && - vtable->field_count) ? TRUE : FALSE; -} - - -/** Initialize header accessor */ -static APR_INLINE void mrcp_header_accessor_init(mrcp_header_accessor_t *accessor) -{ - accessor->data = NULL; - accessor->vtable = NULL; -} - -/** Allocate header data */ -static APR_INLINE void* mrcp_header_allocate(mrcp_header_accessor_t *accessor, apr_pool_t *pool) -{ - if(accessor->data) { - return accessor->data; - } - if(!accessor->vtable || !accessor->vtable->allocate) { - return NULL; - } - return accessor->vtable->allocate(accessor,pool); -} - -/** Destroy header data */ -static APR_INLINE void mrcp_header_destroy(mrcp_header_accessor_t *accessor) -{ - if(!accessor->vtable || !accessor->vtable->destroy) { - return; - } - accessor->vtable->destroy(accessor); -} - - -/** Parse header field value */ -MRCP_DECLARE(apt_bool_t) mrcp_header_field_value_parse(mrcp_header_accessor_t *accessor, apt_header_field_t *header_field, apr_pool_t *pool); - -/** Generate header field value */ -MRCP_DECLARE(apt_header_field_t*) mrcp_header_field_value_generate(const mrcp_header_accessor_t *accessor, apr_size_t id, apt_bool_t empty_value, apr_pool_t *pool); - -/** Duplicate header field value */ -MRCP_DECLARE(apt_bool_t) mrcp_header_field_value_duplicate(mrcp_header_accessor_t *accessor, const mrcp_header_accessor_t *src_accessor, apr_size_t id, const apt_str_t *value, apr_pool_t *pool); - - -APT_END_EXTERN_C - -#endif /* MRCP_HEADER_ACCESSOR_H */ diff --git a/libs/unimrcp/libs/mrcp/message/include/mrcp_message.h b/libs/unimrcp/libs/mrcp/message/include/mrcp_message.h deleted file mode 100644 index 569a91b4bf..0000000000 --- a/libs/unimrcp/libs/mrcp/message/include/mrcp_message.h +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_message.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_MESSAGE_H -#define MRCP_MESSAGE_H - -/** - * @file mrcp_message.h - * @brief MRCP Message Definition - */ - -#include "mrcp_types.h" -#include "mrcp_start_line.h" -#include "mrcp_header.h" -#include "mrcp_generic_header.h" - -APT_BEGIN_EXTERN_C - -/** Macro to log channel identifier of the message */ -#define MRCP_MESSAGE_SIDRES(message) \ - (message)->channel_id.session_id.buf, (message)->channel_id.resource_name.buf - -/** MRCP message */ -struct mrcp_message_t { - /** Start-line of MRCP message */ - mrcp_start_line_t start_line; - /** Channel-identifier of MRCP message */ - mrcp_channel_id channel_id; - /** Header of MRCP message */ - mrcp_message_header_t header; - /** Body of MRCP message */ - apt_str_t body; - - /** Associated MRCP resource */ - const mrcp_resource_t *resource; - /** Memory pool to allocate memory from */ - apr_pool_t *pool; -}; - -/** - * Create an MRCP message. - * @param pool the pool to allocate memory from - */ -MRCP_DECLARE(mrcp_message_t*) mrcp_message_create(apr_pool_t *pool); - -/** - * Create an MRCP request message. - * @param resource the MRCP resource to use - * @param version the MRCP version to use - * @param method_id the MRCP resource specific method identifier - * @param pool the pool to allocate memory from - */ -MRCP_DECLARE(mrcp_message_t*) mrcp_request_create( - const mrcp_resource_t *resource, - mrcp_version_e version, - mrcp_method_id method_id, - apr_pool_t *pool); - -/** - * Create an MRCP response message based on given request message. - * @param request_message the MRCP request message to create a response for - * @param pool the pool to allocate memory from - */ -MRCP_DECLARE(mrcp_message_t*) mrcp_response_create(const mrcp_message_t *request_message, apr_pool_t *pool); - -/** - * Create an MRCP event message based on given requuest message. - * @param request_message the MRCP request message to create an event for - * @param event_id the MRCP resource specific event identifier - * @param pool the pool to allocate memory from - */ -MRCP_DECLARE(mrcp_message_t*) mrcp_event_create( - const mrcp_message_t *request_message, - mrcp_method_id event_id, - apr_pool_t *pool); - -/** - * Associate MRCP resource with message. - * @param message the message to associate resource with - * @param resource the resource to associate - */ -MRCP_DECLARE(apt_bool_t) mrcp_message_resource_set(mrcp_message_t *message, const mrcp_resource_t *resource); - -/** - * Validate MRCP message. - * @param message the message to validate - */ -MRCP_DECLARE(apt_bool_t) mrcp_message_validate(mrcp_message_t *message); - -/** - * Destroy MRCP message. - * @param message the message to destroy - */ -MRCP_DECLARE(void) mrcp_message_destroy(mrcp_message_t *message); - - -/** - * Get MRCP generic header. - * @param message the message to get generic header from - */ -static APR_INLINE mrcp_generic_header_t* mrcp_generic_header_get(const mrcp_message_t *message) -{ - return (mrcp_generic_header_t*) message->header.generic_header_accessor.data; -} - -/** - * Allocate (if not allocated) and get MRCP generic header. - * @param message the message to prepare generic header for - */ -static APR_INLINE mrcp_generic_header_t* mrcp_generic_header_prepare(mrcp_message_t *message) -{ - return (mrcp_generic_header_t*) mrcp_header_allocate(&message->header.generic_header_accessor,message->pool); -} - -/** - * Add MRCP generic header field by specified property (numeric identifier). - * @param message the message to add property for - * @param id the numeric identifier to add - */ -MRCP_DECLARE(apt_bool_t) mrcp_generic_header_property_add(mrcp_message_t *message, apr_size_t id); - -/** - * Add only the name of MRCP generic header field specified by property (numeric identifier). - * @param message the message to add property for - * @param id the numeric identifier to add - * @remark Should be used to construct empty header fiedls for GET-PARAMS requests - */ -MRCP_DECLARE(apt_bool_t) mrcp_generic_header_name_property_add(mrcp_message_t *message, apr_size_t id); - -/** - * Remove MRCP generic header field by specified property (numeric identifier). - * @param message the message to remove property from - * @param id the numeric identifier to remove - */ -static APR_INLINE apt_bool_t mrcp_generic_header_property_remove(mrcp_message_t *message, apr_size_t id) -{ - apt_header_field_t *header_field = apt_header_section_field_get(&message->header.header_section,id); - if(header_field) { - return apt_header_section_field_remove(&message->header.header_section,header_field); - } - return FALSE; -} - -/** - * Check whether specified by property (numeric identifier) MRCP generic header field is set or not. - * @param message the message to use - * @param id the numeric identifier to check - */ -static APR_INLINE apt_bool_t mrcp_generic_header_property_check(const mrcp_message_t *message, apr_size_t id) -{ - return apt_header_section_field_check(&message->header.header_section,id); -} - - -/** - * Get MRCP resource header. - * @param message the message to get resource header from - */ -static APR_INLINE void* mrcp_resource_header_get(const mrcp_message_t *message) -{ - return message->header.resource_header_accessor.data; -} - -/** - * Allocate (if not allocated) and get MRCP resource header. - * @param message the message to prepare resource header for - */ -static APR_INLINE void* mrcp_resource_header_prepare(mrcp_message_t *mrcp_message) -{ - return mrcp_header_allocate(&mrcp_message->header.resource_header_accessor,mrcp_message->pool); -} - -/** - * Add MRCP resource header field by specified property (numeric identifier). - * @param message the message to add property for - * @param id the numeric identifier to add - */ -MRCP_DECLARE(apt_bool_t) mrcp_resource_header_property_add(mrcp_message_t *message, apr_size_t id); - -/** - * Add only the name of MRCP resource header field specified by property (numeric identifier). - * @param message the message to add property for - * @param id the numeric identifier to add - * @remark Should be used to construct empty header fiedls for GET-PARAMS requests - */ -MRCP_DECLARE(apt_bool_t) mrcp_resource_header_name_property_add(mrcp_message_t *message, apr_size_t id); - -/** - * Remove MRCP resource header field by specified property (numeric identifier). - * @param message the message to remove property from - * @param id the numeric identifier to remove - */ -static APR_INLINE apt_bool_t mrcp_resource_header_property_remove(mrcp_message_t *message, apr_size_t id) -{ - apt_header_field_t *header_field = apt_header_section_field_get(&message->header.header_section,id + GENERIC_HEADER_COUNT); - if(header_field) { - return apt_header_section_field_remove(&message->header.header_section,header_field); - } - return FALSE; -} - -/** - * Check whether specified by property (numeric identifier) MRCP resource header field is set or not. - * @param message the message to use - * @param id the numeric identifier to check - */ -static APR_INLINE apt_bool_t mrcp_resource_header_property_check(const mrcp_message_t *message, apr_size_t id) -{ - return apt_header_section_field_check(&message->header.header_section,id + GENERIC_HEADER_COUNT); -} - -/** - * Add MRCP header field. - * @param message the message to add header field for - * @param header_field the header field to add - */ -static APR_INLINE apt_bool_t mrcp_message_header_field_add(mrcp_message_t *message, apt_header_field_t *header_field) -{ - return mrcp_header_field_add(&message->header,header_field,message->pool); -} - -/** - * Get the next MRCP header field. - * @param message the message to use - * @param header_field current header field - * @remark Should be used to iterate on header fields - * - * apt_header_field_t *header_field = NULL; - * while( (header_field = mrcp_message_next_header_field_get(message,header_field)) != NULL ) { - * } - */ -MRCP_DECLARE(apt_header_field_t*) mrcp_message_next_header_field_get( - const mrcp_message_t *message, - apt_header_field_t *header_field); - -APT_END_EXTERN_C - -#endif /* MRCP_MESSAGE_H */ diff --git a/libs/unimrcp/libs/mrcp/message/include/mrcp_start_line.h b/libs/unimrcp/libs/mrcp/message/include/mrcp_start_line.h deleted file mode 100644 index 8b739a259f..0000000000 --- a/libs/unimrcp/libs/mrcp/message/include/mrcp_start_line.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_start_line.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_START_LINE_H -#define MRCP_START_LINE_H - -/** - * @file mrcp_start_line.h - * @brief MRCP Start Line Definition - */ - -#include "mrcp_types.h" -#include "apt_text_stream.h" - -APT_BEGIN_EXTERN_C - -/** Request-states used in MRCP response message */ -typedef enum { - /** The request was processed to completion and there will be no - more events from that resource to the client with that request-id */ - MRCP_REQUEST_STATE_COMPLETE, - /** Indicate that further event messages will be delivered with that request-id */ - MRCP_REQUEST_STATE_INPROGRESS, - /** The job has been placed on a queue and will be processed in first-in-first-out order */ - MRCP_REQUEST_STATE_PENDING, - - /** Number of request states */ - MRCP_REQUEST_STATE_COUNT, - /** Unknown request state */ - MRCP_REQUEST_STATE_UNKNOWN = MRCP_REQUEST_STATE_COUNT -} mrcp_request_state_e; - -/** Status codes */ -typedef enum { - MRCP_STATUS_CODE_UNKNOWN = 0, - /* success codes (2xx) */ - MRCP_STATUS_CODE_SUCCESS = 200, - MRCP_STATUS_CODE_SUCCESS_WITH_IGNORE = 201, - /* failure codes (4xx) */ - MRCP_STATUS_CODE_METHOD_NOT_ALLOWED = 401, - MRCP_STATUS_CODE_METHOD_NOT_VALID = 402, - MRCP_STATUS_CODE_UNSUPPORTED_PARAM = 403, - MRCP_STATUS_CODE_ILLEGAL_PARAM_VALUE = 404, - MRCP_STATUS_CODE_NOT_FOUND = 405, - MRCP_STATUS_CODE_MISSING_PARAM = 406, - MRCP_STATUS_CODE_METHOD_FAILED = 407, - MRCP_STATUS_CODE_UNRECOGNIZED_MESSAGE = 408, - MRCP_STATUS_CODE_UNSUPPORTED_PARAM_VALUE = 409, - MRCP_STATUS_CODE_OUT_OF_ORDER = 410, - MRCP_STATUS_CODE_RESOURCE_SPECIFIC_FAILURE = 421 -} mrcp_status_code_e; - -/** MRCP message types */ -typedef enum { - MRCP_MESSAGE_TYPE_UNKNOWN, - MRCP_MESSAGE_TYPE_REQUEST, - MRCP_MESSAGE_TYPE_RESPONSE, - MRCP_MESSAGE_TYPE_EVENT -} mrcp_message_type_e; - - -/** MRCP start-line declaration */ -typedef struct mrcp_start_line_t mrcp_start_line_t; - -/** Start-line of MRCP message */ -struct mrcp_start_line_t { - /** MRCP message type */ - mrcp_message_type_e message_type; - /** Version of protocol in use */ - mrcp_version_e version; - /** Specify the length of the message, including the start-line (v2) */ - apr_size_t length; - /** Unique identifier among client and server */ - mrcp_request_id request_id; - /** MRCP method name */ - apt_str_t method_name; - /** MRCP method id (associated with method name) */ - mrcp_method_id method_id; - /** Success or failure or other status of the request */ - mrcp_status_code_e status_code; - /** The state of the job initiated by the request */ - mrcp_request_state_e request_state; -}; - -/** Initialize MRCP start-line */ -MRCP_DECLARE(void) mrcp_start_line_init(mrcp_start_line_t *start_line); -/** Parse MRCP start-line */ -MRCP_DECLARE(apt_bool_t) mrcp_start_line_parse(mrcp_start_line_t *start_line, apt_str_t *str, apr_pool_t *pool); -/** Generate MRCP start-line */ -MRCP_DECLARE(apt_bool_t) mrcp_start_line_generate(mrcp_start_line_t *start_line, apt_text_stream_t *text_stream); -/** Finalize MRCP start-line generation */ -MRCP_DECLARE(apt_bool_t) mrcp_start_line_finalize(mrcp_start_line_t *start_line, apr_size_t content_length, apt_text_stream_t *text_stream); - -/** Parse MRCP request-id */ -MRCP_DECLARE(mrcp_request_id) mrcp_request_id_parse(const apt_str_t *field); -/** Generate MRCP request-id */ -MRCP_DECLARE(apt_bool_t) mrcp_request_id_generate(mrcp_request_id request_id, apt_text_stream_t *stream); - - -APT_END_EXTERN_C - -#endif /* MRCP_START_LINE_H */ diff --git a/libs/unimrcp/libs/mrcp/message/src/mrcp_generic_header.c b/libs/unimrcp/libs/mrcp/message/src/mrcp_generic_header.c deleted file mode 100644 index 858a76f802..0000000000 --- a/libs/unimrcp/libs/mrcp/message/src/mrcp_generic_header.c +++ /dev/null @@ -1,350 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_generic_header.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mrcp_generic_header.h" -#include "mrcp_start_line.h" - -/** String table of mrcp generic-header fields (mrcp_generic_header_id) */ -static const apt_str_table_item_t generic_header_string_table[] = { - {{"Active-Request-Id-List", 22},3}, - {{"Proxy-Sync-Id", 13},0}, - {{"Accept-Charset", 14},7}, - {{"Content-Type", 12},9}, - {{"Content-Id", 10},9}, - {{"Content-Base", 12},8}, - {{"Content-Encoding", 16},9}, - {{"Content-Location", 16},9}, - {{"Content-Length", 14},10}, - {{"Cache-Control", 13},1}, - {{"Logging-Tag", 11},0}, - {{"Vendor-Specific-Parameters",26},0}, - {{"Accept", 6},6}, - {{"Fetch-Timeout", 13},0}, - {{"Set-Cookie", 10},10}, - {{"Set-Cookie2", 11},10} -}; - -/** Parse mrcp request-id list */ -static apt_bool_t mrcp_request_id_list_parse(mrcp_request_id_list_t *request_id_list, const apt_str_t *value) -{ - apt_str_t field; - apt_text_stream_t stream; - stream.text = *value; - apt_text_stream_reset(&stream); - request_id_list->count = 0; - while(request_id_list->count < MAX_ACTIVE_REQUEST_ID_COUNT) { - if(apt_text_field_read(&stream,',',TRUE,&field) == FALSE) { - break; - } - request_id_list->ids[request_id_list->count] = mrcp_request_id_parse(&field); - request_id_list->count++; - } - return TRUE; -} - -/** Generate mrcp request-id list */ -static apt_bool_t mrcp_request_id_list_generate(const mrcp_request_id_list_t *request_id_list, apt_str_t *str, apr_pool_t *pool) -{ - apr_size_t i; - int length; - char *pos; - - /* compute estimated length, assuming request-ids consist of upto 10 digits */ - str->length = 10 * request_id_list->count; - if(request_id_list->count > 1) { - /* , */ - str->length += request_id_list->count - 1; - } - - str->buf = apr_palloc(pool,str->length + 1); - - pos = str->buf; - for(i=0; icount; i++) { - if(i != 0) { - *pos++ = ','; - } - - length = apr_snprintf(pos, str->length - (pos - str->buf), "%"MRCP_REQUEST_ID_FMT, request_id_list->ids[i]); - if(length < 0) - return FALSE; - pos += length; - } - *pos = '\0'; - return TRUE; -} - - -/** Initialize generic-header */ -static void mrcp_generic_header_init(mrcp_generic_header_t *generic_header) -{ - generic_header->active_request_id_list.count = 0; - apt_string_reset(&generic_header->proxy_sync_id); - apt_string_reset(&generic_header->accept_charset); - apt_string_reset(&generic_header->content_type); - apt_string_reset(&generic_header->content_id); - apt_string_reset(&generic_header->content_base); - apt_string_reset(&generic_header->content_encoding); - apt_string_reset(&generic_header->content_location); - generic_header->content_length = 0; - apt_string_reset(&generic_header->cache_control); - apt_string_reset(&generic_header->logging_tag); - generic_header->vendor_specific_params = NULL; - /* initializes additionnal MRCP v2 generic header fields */ - apt_string_reset(&generic_header->accept); - generic_header->fetch_timeout = 0; - apt_string_reset(&generic_header->set_cookie); - apt_string_reset(&generic_header->set_cookie2); -} - - -/** Allocate generic-header */ -static void* mrcp_generic_header_allocate(mrcp_header_accessor_t *accessor, apr_pool_t *pool) -{ - mrcp_generic_header_t *generic_header = apr_palloc(pool,sizeof(mrcp_generic_header_t)); - mrcp_generic_header_init(generic_header); - accessor->data = generic_header; - return accessor->data; -} - -/** Parse generic-header */ -static apt_bool_t mrcp_generic_header_parse(mrcp_header_accessor_t *accessor, size_t id, const apt_str_t *value, apr_pool_t *pool) -{ - apt_bool_t status = TRUE; - mrcp_generic_header_t *generic_header = accessor->data; - switch(id) { - case GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST: - mrcp_request_id_list_parse(&generic_header->active_request_id_list,value); - break; - case GENERIC_HEADER_PROXY_SYNC_ID: - generic_header->proxy_sync_id = *value; - break; - case GENERIC_HEADER_ACCEPT_CHARSET: - generic_header->accept_charset = *value; - break; - case GENERIC_HEADER_CONTENT_TYPE: - generic_header->content_type = *value; - break; - case GENERIC_HEADER_CONTENT_ID: - generic_header->content_id = *value; - break; - case GENERIC_HEADER_CONTENT_BASE: - generic_header->content_base = *value; - break; - case GENERIC_HEADER_CONTENT_ENCODING: - generic_header->content_encoding = *value; - break; - case GENERIC_HEADER_CONTENT_LOCATION: - generic_header->content_location = *value; - break; - case GENERIC_HEADER_CONTENT_LENGTH: - generic_header->content_length = apt_size_value_parse(value); - break; - case GENERIC_HEADER_CACHE_CONTROL: - generic_header->cache_control = *value; - break; - case GENERIC_HEADER_LOGGING_TAG: - generic_header->logging_tag = *value; - break; - case GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS: - if(!generic_header->vendor_specific_params) { - generic_header->vendor_specific_params = apt_pair_array_create(1,pool); - } - apt_pair_array_parse(generic_header->vendor_specific_params,value,pool); - break; - case GENERIC_HEADER_ACCEPT: - generic_header->accept = *value; - break; - case GENERIC_HEADER_FETCH_TIMEOUT: - generic_header->fetch_timeout = apt_size_value_parse(value); - break; - case GENERIC_HEADER_SET_COOKIE: - generic_header->set_cookie = *value; - break; - case GENERIC_HEADER_SET_COOKIE2: - generic_header->set_cookie2 = *value; - break; - default: - status = FALSE; - } - return status; -} - -/** Generate generic-header */ -static apt_bool_t mrcp_generic_header_generate(const mrcp_header_accessor_t *accessor, apr_size_t id, apt_str_t *value, apr_pool_t *pool) -{ - mrcp_generic_header_t *generic_header = accessor->data; - switch(id) { - case GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST: - mrcp_request_id_list_generate(&generic_header->active_request_id_list,value,pool); - break; - case GENERIC_HEADER_PROXY_SYNC_ID: - *value = generic_header->proxy_sync_id; - break; - case GENERIC_HEADER_ACCEPT_CHARSET: - *value = generic_header->accept_charset; - break; - case GENERIC_HEADER_CONTENT_TYPE: - *value = generic_header->content_type; - break; - case GENERIC_HEADER_CONTENT_ID: - *value = generic_header->content_id; - break; - case GENERIC_HEADER_CONTENT_BASE: - *value = generic_header->content_base; - break; - case GENERIC_HEADER_CONTENT_ENCODING: - *value = generic_header->content_encoding; - break; - case GENERIC_HEADER_CONTENT_LOCATION: - *value = generic_header->content_location; - break; - case GENERIC_HEADER_CONTENT_LENGTH: - apt_size_value_generate(generic_header->content_length,value,pool); - break; - case GENERIC_HEADER_CACHE_CONTROL: - *value = generic_header->cache_control; - break; - case GENERIC_HEADER_LOGGING_TAG: - *value = generic_header->logging_tag; - break; - case GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS: - apt_pair_array_generate(generic_header->vendor_specific_params,value,pool); - break; - case GENERIC_HEADER_ACCEPT: - *value = generic_header->accept; - break; - case GENERIC_HEADER_FETCH_TIMEOUT: - apt_size_value_generate(generic_header->fetch_timeout,value,pool); - break; - case GENERIC_HEADER_SET_COOKIE: - *value = generic_header->set_cookie; - break; - case GENERIC_HEADER_SET_COOKIE2: - *value = generic_header->set_cookie2; - break; - default: - break; - } - return TRUE; -} - -/** Duplicate generic-header */ -static apt_bool_t mrcp_generic_header_duplicate(mrcp_header_accessor_t *accessor, const mrcp_header_accessor_t *src, apr_size_t id, const apt_str_t *value, apr_pool_t *pool) -{ - mrcp_generic_header_t *generic_header = accessor->data; - const mrcp_generic_header_t *src_generic_header = src->data; - apt_bool_t status = TRUE; - - if(!generic_header || !src_generic_header) { - return FALSE; - } - - switch(id) { - case GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST: - break; - case GENERIC_HEADER_PROXY_SYNC_ID: - generic_header->proxy_sync_id = *value; - break; - case GENERIC_HEADER_ACCEPT_CHARSET: - generic_header->accept_charset = *value; - break; - case GENERIC_HEADER_CONTENT_TYPE: - generic_header->content_type = *value; - break; - case GENERIC_HEADER_CONTENT_ID: - generic_header->content_id = *value; - break; - case GENERIC_HEADER_CONTENT_BASE: - generic_header->content_base = *value; - break; - case GENERIC_HEADER_CONTENT_ENCODING: - generic_header->content_encoding = *value; - break; - case GENERIC_HEADER_CONTENT_LOCATION: - generic_header->content_location = *value; - break; - case GENERIC_HEADER_CONTENT_LENGTH: - generic_header->content_length = src_generic_header->content_length; - break; - case GENERIC_HEADER_CACHE_CONTROL: - generic_header->cache_control = *value; - break; - case GENERIC_HEADER_LOGGING_TAG: - generic_header->logging_tag = *value; - break; - case GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS: - generic_header->vendor_specific_params = apt_pair_array_copy(src_generic_header->vendor_specific_params,pool); - break; - case GENERIC_HEADER_ACCEPT: - generic_header->accept = *value; - break; - case GENERIC_HEADER_FETCH_TIMEOUT: - generic_header->fetch_timeout = src_generic_header->fetch_timeout; - break; - case GENERIC_HEADER_SET_COOKIE: - generic_header->set_cookie = *value; - break; - case GENERIC_HEADER_SET_COOKIE2: - generic_header->set_cookie2 = *value; - break; - default: - status = FALSE; - } - return status; -} - -static const mrcp_header_vtable_t vtable = { - mrcp_generic_header_allocate, - NULL, /* nothing to destroy */ - mrcp_generic_header_parse, - mrcp_generic_header_generate, - mrcp_generic_header_duplicate, - generic_header_string_table, - GENERIC_HEADER_COUNT -}; - - -MRCP_DECLARE(const mrcp_header_vtable_t*) mrcp_generic_header_vtable_get(mrcp_version_e version) -{ - return &vtable; -} - - -/** Append active request id list */ -MRCP_DECLARE(apt_bool_t) active_request_id_list_append(mrcp_generic_header_t *generic_header, mrcp_request_id request_id) -{ - mrcp_request_id_list_t *request_id_list = &generic_header->active_request_id_list; - if(request_id_list->count >= MAX_ACTIVE_REQUEST_ID_COUNT) { - return FALSE; - } - request_id_list->ids[request_id_list->count++] = request_id; - return TRUE; -} - -/** Find request id in active request id list */ -MRCP_DECLARE(apt_bool_t) active_request_id_list_find(const mrcp_generic_header_t *generic_header, mrcp_request_id request_id) -{ - size_t i; - const mrcp_request_id_list_t *request_id_list = &generic_header->active_request_id_list; - for(i=0; icount; i++) { - if(request_id_list->ids[i] == request_id) { - return TRUE; - } - } - return FALSE; -} diff --git a/libs/unimrcp/libs/mrcp/message/src/mrcp_header.c b/libs/unimrcp/libs/mrcp/message/src/mrcp_header.c deleted file mode 100644 index 22d02692e1..0000000000 --- a/libs/unimrcp/libs/mrcp/message/src/mrcp_header.c +++ /dev/null @@ -1,265 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_header.c 2238 2014-11-12 01:50:43Z achaloyan@gmail.com $ - */ - -#include "mrcp_header.h" -#include "mrcp_generic_header.h" -#include "apt_text_message.h" -#include "apt_log.h" - -#define MRCP_CHANNEL_ID "Channel-Identifier" -#define MRCP_CHANNEL_ID_LENGTH (sizeof(MRCP_CHANNEL_ID)-1) - - -/** Allocate MRCP message-header data */ -MRCP_DECLARE(apt_bool_t) mrcp_message_header_data_alloc( - mrcp_message_header_t *header, - const mrcp_header_vtable_t *generic_header_vtable, - const mrcp_header_vtable_t *resource_header_vtable, - apr_pool_t *pool) -{ - if(!generic_header_vtable || !resource_header_vtable) { - return FALSE; - } - - header->generic_header_accessor.data = NULL; - header->generic_header_accessor.vtable = generic_header_vtable; - - header->resource_header_accessor.data = NULL; - header->resource_header_accessor.vtable = resource_header_vtable; - - apt_header_section_array_alloc( - &header->header_section, - header->generic_header_accessor.vtable->field_count + - header->resource_header_accessor.vtable->field_count, - pool); - - mrcp_header_allocate(&header->generic_header_accessor,pool); - mrcp_header_allocate(&header->resource_header_accessor,pool); - return TRUE; -} - -MRCP_DECLARE(mrcp_message_header_t*) mrcp_message_header_create( - const mrcp_header_vtable_t *generic_header_vtable, - const mrcp_header_vtable_t *resource_header_vtable, - apr_pool_t *pool) -{ - mrcp_message_header_t *header = apr_palloc(pool,sizeof(mrcp_message_header_t)); - apt_header_section_init(&header->header_section); - mrcp_message_header_data_alloc(header,generic_header_vtable,resource_header_vtable,pool); - return header; -} - -/** Add MRCP header field */ -MRCP_DECLARE(apt_bool_t) mrcp_header_field_add(mrcp_message_header_t *header, apt_header_field_t *header_field, apr_pool_t *pool) -{ - apt_bool_t status = FALSE; - if(apt_string_is_empty(&header_field->name) == FALSE) { - /* normal header */ - if(mrcp_header_field_value_parse(&header->resource_header_accessor,header_field,pool) == TRUE) { - header_field->id += GENERIC_HEADER_COUNT; - } - else if(mrcp_header_field_value_parse(&header->generic_header_accessor,header_field,pool) == TRUE) { - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Unknown MRCP header field: %s",header_field->name.buf); - } - status = apt_header_section_field_add(&header->header_section,header_field); - } - return status; -} - -/** Parse MRCP header fields */ -MRCP_DECLARE(apt_bool_t) mrcp_header_fields_parse(mrcp_message_header_t *header, apr_pool_t *pool) -{ - apt_header_field_t *header_field; - for(header_field = APR_RING_FIRST(&header->header_section.ring); - header_field != APR_RING_SENTINEL(&header->header_section.ring, apt_header_field_t, link); - header_field = APR_RING_NEXT(header_field, link)) { - - if(mrcp_header_field_value_parse(&header->resource_header_accessor,header_field,pool) == TRUE) { - header_field->id += GENERIC_HEADER_COUNT; - apt_header_section_field_set(&header->header_section,header_field); - } - else if(mrcp_header_field_value_parse(&header->generic_header_accessor,header_field,pool) == TRUE) { - apt_header_section_field_set(&header->header_section,header_field); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown MRCP header field: %s",header_field->name.buf); - } - } - - return TRUE; -} - -static apt_bool_t mrcp_header_accessor_value_duplicate(mrcp_message_header_t *header, apt_header_field_t *header_field, - const mrcp_message_header_t *src_header, const apt_header_field_t *src_header_field, - apr_pool_t *pool) -{ - apt_bool_t status = FALSE; - if(header_field->id < GENERIC_HEADER_COUNT) { - status = mrcp_header_field_value_duplicate( - &header->generic_header_accessor, - &src_header->generic_header_accessor, - header_field->id, - &header_field->value, - pool); - } - else { - status = mrcp_header_field_value_duplicate( - &header->resource_header_accessor, - &src_header->resource_header_accessor, - header_field->id - GENERIC_HEADER_COUNT, - &header_field->value, - pool); - } - return status; -} - -/** Set (copy) MRCP header fields */ -MRCP_DECLARE(apt_bool_t) mrcp_header_fields_set(mrcp_message_header_t *header, const mrcp_message_header_t *src_header, apr_pool_t *pool) -{ - apt_header_field_t *header_field; - const apt_header_field_t *src_header_field; - for(src_header_field = APR_RING_FIRST(&src_header->header_section.ring); - src_header_field != APR_RING_SENTINEL(&src_header->header_section.ring, apt_header_field_t, link); - src_header_field = APR_RING_NEXT(src_header_field, link)) { - - header_field = apt_header_section_field_get(&header->header_section,src_header_field->id); - if(header_field) { - /* this header field has already been set, just copy its value */ - apt_string_copy(&header_field->value,&src_header_field->value,pool); - } - else { - /* copy the entire header field and add it to the header section */ - header_field = apt_header_field_copy(src_header_field,pool); - apt_header_section_field_add(&header->header_section,header_field); - } - - mrcp_header_accessor_value_duplicate(header,header_field,src_header,src_header_field,pool); - } - - return TRUE; -} - -/** Get (copy) MRCP header fields */ -MRCP_DECLARE(apt_bool_t) mrcp_header_fields_get(mrcp_message_header_t *header, const mrcp_message_header_t *src_header, const mrcp_message_header_t *mask_header, apr_pool_t *pool) -{ - apt_header_field_t *header_field; - const apt_header_field_t *src_header_field; - const apt_header_field_t *mask_header_field; - for(mask_header_field = APR_RING_FIRST(&mask_header->header_section.ring); - mask_header_field != APR_RING_SENTINEL(&mask_header->header_section.ring, apt_header_field_t, link); - mask_header_field = APR_RING_NEXT(mask_header_field, link)) { - - header_field = apt_header_section_field_get(&header->header_section,mask_header_field->id); - if(header_field) { - /* this header field has already been set, skip to the next one */ - continue; - } - - src_header_field = apt_header_section_field_get(&src_header->header_section,mask_header_field->id); - if(src_header_field) { - /* copy the entire header field */ - header_field = apt_header_field_copy(src_header_field,pool); - mrcp_header_accessor_value_duplicate(header,header_field,src_header,src_header_field,pool); - } - else { - /* copy only the name of the header field */ - header_field = apt_header_field_copy(mask_header_field,pool); - } - /* add the header field to the header section */ - apt_header_section_field_add(&header->header_section,header_field); - } - - return TRUE; -} - -/** Inherit (copy) MRCP header fields */ -MRCP_DECLARE(apt_bool_t) mrcp_header_fields_inherit(mrcp_message_header_t *header, const mrcp_message_header_t *src_header, apr_pool_t *pool) -{ - apt_header_field_t *header_field; - const apt_header_field_t *src_header_field; - for(src_header_field = APR_RING_FIRST(&src_header->header_section.ring); - src_header_field != APR_RING_SENTINEL(&src_header->header_section.ring, apt_header_field_t, link); - src_header_field = APR_RING_NEXT(src_header_field, link)) { - - header_field = apt_header_section_field_get(&header->header_section,src_header_field->id); - if(header_field) { - /* this header field has already been set, skip to the next one */ - continue; - } - - /* copy the entire header field and add it to the header section */ - header_field = apt_header_field_copy(src_header_field,pool); - mrcp_header_accessor_value_duplicate(header,header_field,src_header,src_header_field,pool); - apt_header_section_field_add(&header->header_section,header_field); - } - return TRUE; -} - - -/** Initialize MRCP channel-identifier */ -MRCP_DECLARE(void) mrcp_channel_id_init(mrcp_channel_id *channel_id) -{ - apt_string_reset(&channel_id->session_id); - apt_string_reset(&channel_id->resource_name); -} - -/** Parse MRCP channel-identifier */ -MRCP_DECLARE(apt_bool_t) mrcp_channel_id_parse(mrcp_channel_id *channel_id, mrcp_message_header_t *header, apr_pool_t *pool) -{ - apt_header_field_t *header_field; - for(header_field = APR_RING_FIRST(&header->header_section.ring); - header_field != APR_RING_SENTINEL(&header->header_section.ring, apt_header_field_t, link); - header_field = APR_RING_NEXT(header_field, link)) { - - if(header_field->value.length && strncasecmp(header_field->name.buf,MRCP_CHANNEL_ID,MRCP_CHANNEL_ID_LENGTH) == 0) { - apt_id_resource_parse(&header_field->value,'@',&channel_id->session_id,&channel_id->resource_name,pool); - apt_header_section_field_remove(&header->header_section,header_field); - return TRUE; - } - } - return FALSE; -} - -/** Generate MRCP channel-identifier */ -MRCP_DECLARE(apt_bool_t) mrcp_channel_id_generate(mrcp_channel_id *channel_id, apt_text_stream_t *stream) -{ - apt_str_t *str; - char *pos = stream->pos; - if(pos + MRCP_CHANNEL_ID_LENGTH + 2 + channel_id->session_id.length + 1 + - channel_id->resource_name.length >= stream->end) { - return FALSE; - } - memcpy(pos,MRCP_CHANNEL_ID,MRCP_CHANNEL_ID_LENGTH); - pos += MRCP_CHANNEL_ID_LENGTH; - *pos++ = ':'; - *pos++ = APT_TOKEN_SP; - - str = &channel_id->session_id; - memcpy(pos,str->buf,str->length); - pos += str->length; - *pos++ = '@'; - - str = &channel_id->resource_name; - memcpy(pos,str->buf,str->length); - pos += str->length; - - stream->pos = pos; - return apt_text_eol_insert(stream); -} diff --git a/libs/unimrcp/libs/mrcp/message/src/mrcp_header_accessor.c b/libs/unimrcp/libs/mrcp/message/src/mrcp_header_accessor.c deleted file mode 100644 index ffc113e457..0000000000 --- a/libs/unimrcp/libs/mrcp/message/src/mrcp_header_accessor.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_header_accessor.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mrcp_header_accessor.h" - - -/** Parse header field value */ -MRCP_DECLARE(apt_bool_t) mrcp_header_field_value_parse(mrcp_header_accessor_t *accessor, apt_header_field_t *header_field, apr_pool_t *pool) -{ - apr_size_t id; - if(!accessor->vtable) { - return FALSE; - } - - id = apt_string_table_id_find(accessor->vtable->field_table,accessor->vtable->field_count,&header_field->name); - if(id >= accessor->vtable->field_count) { - return FALSE; - } - header_field->id = id; - - if(header_field->value.length) { - if(accessor->vtable->parse_field(accessor,header_field->id,&header_field->value,pool) == FALSE) { - return FALSE; - } - } - - return TRUE; -} - -/** Generate header field value */ -MRCP_DECLARE(apt_header_field_t*) mrcp_header_field_value_generate(const mrcp_header_accessor_t *accessor, apr_size_t id, apt_bool_t empty_value, apr_pool_t *pool) -{ - apt_header_field_t *header_field; - const apt_str_t *name; - - if(!accessor->vtable) { - return NULL; - } - - header_field = apt_header_field_alloc(pool); - name = apt_string_table_str_get(accessor->vtable->field_table,accessor->vtable->field_count,id); - if(name) { - header_field->name = *name; - } - - if(empty_value == FALSE) { - if(accessor->vtable->generate_field(accessor,id,&header_field->value,pool) == FALSE) { - return NULL; - } - } - - return header_field; -} - -/** Duplicate header field value */ -MRCP_DECLARE(apt_bool_t) mrcp_header_field_value_duplicate(mrcp_header_accessor_t *accessor, const mrcp_header_accessor_t *src_accessor, apr_size_t id, const apt_str_t *value, apr_pool_t *pool) -{ - if(!accessor->vtable) { - return FALSE; - } - - if(value->length) { - if(accessor->vtable->duplicate_field(accessor,src_accessor,id,value,pool) == FALSE) { - return FALSE; - } - } - - return TRUE; -} diff --git a/libs/unimrcp/libs/mrcp/message/src/mrcp_message.c b/libs/unimrcp/libs/mrcp/message/src/mrcp_message.c deleted file mode 100644 index e12aac85b6..0000000000 --- a/libs/unimrcp/libs/mrcp/message/src/mrcp_message.c +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_message.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mrcp_message.h" -#include "mrcp_generic_header.h" -#include "mrcp_resource.h" -#include "apt_text_message.h" -#include "apt_log.h" - -/** Associate MRCP resource with message */ -static apt_bool_t mrcp_message_resource_set_by_id(mrcp_message_t *message, const mrcp_resource_t *resource) -{ - if(!resource) { - return FALSE; - } - message->resource = resource; - message->channel_id.resource_name = resource->name; - mrcp_message_header_data_alloc( - &message->header, - mrcp_generic_header_vtable_get(message->start_line.version), - resource->get_resource_header_vtable(message->start_line.version), - message->pool); - - /* associate method_name and method_id */ - if(message->start_line.message_type == MRCP_MESSAGE_TYPE_REQUEST) { - const apt_str_t *name = apt_string_table_str_get( - resource->get_method_str_table(message->start_line.version), - resource->method_count, - message->start_line.method_id); - if(!name) { - return FALSE; - } - message->start_line.method_name = *name; - } - else if(message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) { - const apt_str_t *name = apt_string_table_str_get( - resource->get_event_str_table(message->start_line.version), - resource->event_count, - message->start_line.method_id); - if(!name) { - return FALSE; - } - message->start_line.method_name = *name; - } - - return TRUE; -} - -/** Associate MRCP resource specific data by resource name */ -MRCP_DECLARE(apt_bool_t) mrcp_message_resource_set(mrcp_message_t *message, const mrcp_resource_t *resource) -{ - if(!resource) { - return FALSE; - } - message->resource = resource; - mrcp_message_header_data_alloc( - &message->header, - mrcp_generic_header_vtable_get(message->start_line.version), - resource->get_resource_header_vtable(message->start_line.version), - message->pool); - - /* associate method_name and method_id */ - if(message->start_line.message_type == MRCP_MESSAGE_TYPE_REQUEST) { - message->start_line.method_id = apt_string_table_id_find( - resource->get_method_str_table(message->start_line.version), - resource->method_count, - &message->start_line.method_name); - if(message->start_line.method_id >= resource->method_count) { - return FALSE; - } - } - else if(message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) { - message->start_line.method_id = apt_string_table_id_find( - resource->get_event_str_table(message->start_line.version), - resource->event_count, - &message->start_line.method_name); - if(message->start_line.method_id >= resource->event_count) { - return FALSE; - } - } - - return TRUE; -} - -/** Create an MRCP message */ -MRCP_DECLARE(mrcp_message_t*) mrcp_message_create(apr_pool_t *pool) -{ - mrcp_message_t *message = apr_palloc(pool,sizeof(mrcp_message_t)); - mrcp_start_line_init(&message->start_line); - mrcp_channel_id_init(&message->channel_id); - mrcp_message_header_init(&message->header); - apt_string_reset(&message->body); - message->resource = NULL; - message->pool = pool; - return message; -} - -/** Create an MRCP request message */ -MRCP_DECLARE(mrcp_message_t*) mrcp_request_create(const mrcp_resource_t *resource, mrcp_version_e version, mrcp_method_id method_id, apr_pool_t *pool) -{ - mrcp_message_t *request_message = mrcp_message_create(pool); - request_message->start_line.message_type = MRCP_MESSAGE_TYPE_REQUEST; - request_message->start_line.version = version; - request_message->start_line.method_id = method_id; - mrcp_message_resource_set_by_id(request_message,resource); - return request_message; -} - -/** Create an MRCP response message */ -MRCP_DECLARE(mrcp_message_t*) mrcp_response_create(const mrcp_message_t *request_message, apr_pool_t *pool) -{ - mrcp_message_t *response_message = mrcp_message_create(pool); - response_message->start_line.message_type = MRCP_MESSAGE_TYPE_RESPONSE; - response_message->start_line.request_state = MRCP_REQUEST_STATE_COMPLETE; - response_message->start_line.status_code = MRCP_STATUS_CODE_SUCCESS; - if(request_message) { - response_message->channel_id = request_message->channel_id; - response_message->start_line.request_id = request_message->start_line.request_id; - response_message->start_line.version = request_message->start_line.version; - response_message->start_line.method_id = request_message->start_line.method_id; - response_message->start_line.method_name = request_message->start_line.method_name; - mrcp_message_resource_set_by_id(response_message,request_message->resource); - } - return response_message; -} - -/** Create an MRCP event message */ -MRCP_DECLARE(mrcp_message_t*) mrcp_event_create(const mrcp_message_t *request_message, mrcp_method_id event_id, apr_pool_t *pool) -{ - mrcp_message_t *event_message = mrcp_message_create(pool); - event_message->start_line.message_type = MRCP_MESSAGE_TYPE_EVENT; - event_message->start_line.method_id = event_id; - if(request_message) { - event_message->channel_id = request_message->channel_id; - event_message->start_line.request_id = request_message->start_line.request_id; - event_message->start_line.version = request_message->start_line.version; - mrcp_message_resource_set_by_id(event_message,request_message->resource); - } - return event_message; -} - -/** Destroy MRCP message */ -MRCP_DECLARE(void) mrcp_message_destroy(mrcp_message_t *message) -{ - apt_string_reset(&message->body); - mrcp_message_header_destroy(&message->header); -} - -/** Validate MRCP message */ -MRCP_DECLARE(apt_bool_t) mrcp_message_validate(mrcp_message_t *message) -{ - if(message->body.length) { - /* content length must be specified */ - mrcp_generic_header_t *generic_header = mrcp_generic_header_prepare(message); - if(!generic_header) { - return FALSE; - } - if(mrcp_generic_header_property_check(message,GENERIC_HEADER_CONTENT_LENGTH) != TRUE || - !generic_header->content_length) { - generic_header->content_length = message->body.length; - mrcp_generic_header_property_add(message,GENERIC_HEADER_CONTENT_LENGTH); - } - } - - return TRUE; -} - -/** Add MRCP generic header field by specified property (numeric identifier) */ -MRCP_DECLARE(apt_bool_t) mrcp_generic_header_property_add(mrcp_message_t *message, apr_size_t id) -{ - apt_header_field_t *header_field = mrcp_header_field_value_generate( - &message->header.generic_header_accessor, - id, - FALSE, - message->pool); - if(!header_field) { - return FALSE; - } - header_field->id = id; - return apt_header_section_field_add(&message->header.header_section,header_field); -} - -/** Add only the name of MRCP generic header field specified by property (numeric identifier) */ -MRCP_DECLARE(apt_bool_t) mrcp_generic_header_name_property_add(mrcp_message_t *message, apr_size_t id) -{ - apt_header_field_t *header_field = mrcp_header_field_value_generate( - &message->header.generic_header_accessor, - id, - TRUE, - message->pool); - if(!header_field) { - return FALSE; - } - header_field->id = id; - return apt_header_section_field_add(&message->header.header_section,header_field); -} - -/** Add MRCP resource header field by specified property (numeric identifier) */ -MRCP_DECLARE(apt_bool_t) mrcp_resource_header_property_add(mrcp_message_t *message, apr_size_t id) -{ - apt_header_field_t *header_field = mrcp_header_field_value_generate( - &message->header.resource_header_accessor, - id, - FALSE, - message->pool); - if(!header_field) { - return FALSE; - } - header_field->id = id + GENERIC_HEADER_COUNT; - return apt_header_section_field_add(&message->header.header_section,header_field); -} - -/** Add only the name of MRCP resource header field specified by property (numeric identifier) */ -MRCP_DECLARE(apt_bool_t) mrcp_resource_header_name_property_add(mrcp_message_t *message, apr_size_t id) -{ - apt_header_field_t *header_field = mrcp_header_field_value_generate( - &message->header.resource_header_accessor, - id, - TRUE, - message->pool); - if(!header_field) { - return FALSE; - } - header_field->id = id + GENERIC_HEADER_COUNT; - return apt_header_section_field_add(&message->header.header_section,header_field); -} - -/** Get the next MRCP header field */ -MRCP_DECLARE(apt_header_field_t*) mrcp_message_next_header_field_get(const mrcp_message_t *message, apt_header_field_t *header_field) -{ - const apt_header_section_t *header_section = &message->header.header_section; - if(header_field) { - apt_header_field_t *next = APR_RING_NEXT(header_field,link); - if(next == APR_RING_SENTINEL(&header_section->ring,apt_header_field_t,link)) { - return NULL; - } - return next; - } - - if(APR_RING_EMPTY(&header_section->ring,apt_header_field_t,link)) { - return NULL; - } - return APR_RING_FIRST(&header_section->ring); -} diff --git a/libs/unimrcp/libs/mrcp/message/src/mrcp_start_line.c b/libs/unimrcp/libs/mrcp/message/src/mrcp_start_line.c deleted file mode 100644 index be20150d1d..0000000000 --- a/libs/unimrcp/libs/mrcp/message/src/mrcp_start_line.c +++ /dev/null @@ -1,452 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_start_line.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include -#include "mrcp_start_line.h" -#include "apt_string_table.h" -#include "apt_log.h" - -/** Protocol name used in version string */ -#define MRCP_NAME "MRCP" -#define MRCP_NAME_LENGTH (sizeof(MRCP_NAME)-1) - -/** Separators used in MRCP version string parse/generate */ -#define MRCP_NAME_VERSION_SEPARATOR '/' -#define MRCP_VERSION_MAJOR_MINOR_SEPARATOR '.' - -/** Max number of digits message length consists of */ -#define MAX_DIGIT_COUNT 6 - - -/** String table of MRCP request-states (mrcp_request_state_t) */ -static const apt_str_table_item_t mrcp_request_state_string_table[] = { - {{"COMPLETE", 8},0}, - {{"IN-PROGRESS",11},0}, - {{"PENDING", 7},0} -}; - - -/** Parse MRCP version */ -static mrcp_version_e mrcp_version_parse(const apt_str_t *field) -{ - mrcp_version_e version = MRCP_VERSION_UNKNOWN; - const char *pos; - if(field->length <= MRCP_NAME_LENGTH || strncasecmp(field->buf,MRCP_NAME,MRCP_NAME_LENGTH) != 0) { - /* unexpected protocol name */ - return version; - } - - pos = field->buf + MRCP_NAME_LENGTH; - if(*pos == MRCP_NAME_VERSION_SEPARATOR) { - pos++; - switch(*pos) { - case '1': version = MRCP_VERSION_1; break; - case '2': version = MRCP_VERSION_2; break; - default: ; - } - } - return version; -} - -/** Generate MRCP version */ -static apt_bool_t mrcp_version_generate(mrcp_version_e version, apt_text_stream_t *stream) -{ - if(stream->pos + MRCP_NAME_LENGTH + 1 >= stream->end) { - return FALSE; - } - memcpy(stream->pos,MRCP_NAME,MRCP_NAME_LENGTH); - stream->pos += MRCP_NAME_LENGTH; - *stream->pos++ = MRCP_NAME_VERSION_SEPARATOR; - - if(apt_text_size_value_insert(stream,version) == FALSE) { - return FALSE; - } - - if(stream->pos + 2 >= stream->end) { - return FALSE; - } - *stream->pos++ = MRCP_VERSION_MAJOR_MINOR_SEPARATOR; - *stream->pos++ = '0'; - return TRUE; -} - -/** Parse MRCP request-state used in MRCP response and event */ -static APR_INLINE mrcp_request_state_e mrcp_request_state_parse(const apt_str_t *request_state_str) -{ - return apt_string_table_id_find(mrcp_request_state_string_table,MRCP_REQUEST_STATE_COUNT,request_state_str); -} - -/** Generate MRCP request-state used in MRCP response and event */ -static apt_bool_t mrcp_request_state_generate(mrcp_request_state_e request_state, apt_text_stream_t *stream) -{ - const apt_str_t *name; - name = apt_string_table_str_get(mrcp_request_state_string_table,MRCP_REQUEST_STATE_COUNT,request_state); - if(request_state < MRCP_REQUEST_STATE_COUNT) { - memcpy(stream->pos,name->buf,name->length); - stream->pos += name->length; - } - return TRUE; -} - - -/** Parse MRCP status-code */ -static APR_INLINE mrcp_status_code_e mrcp_status_code_parse(const apt_str_t *field) -{ - return apt_size_value_parse(field); -} - -/** Generate MRCP status-code */ -static APR_INLINE size_t mrcp_status_code_generate(mrcp_status_code_e status_code, apt_text_stream_t *stream) -{ - return apt_text_size_value_insert(stream,status_code); -} - - -/** Parse MRCP request-line */ -static apt_bool_t mrcp_request_line_parse(mrcp_start_line_t *start_line, apt_text_stream_t *stream) -{ - apt_str_t field; - if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse request-id in request-line"); - return FALSE; - } - start_line->request_id = mrcp_request_id_parse(&field); - - if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse mrcp-version in request-line"); - return FALSE; - } - - start_line->request_state = mrcp_request_state_parse(&field); - if(start_line->request_state == MRCP_REQUEST_STATE_UNKNOWN) { - /* request-line */ - start_line->message_type = MRCP_MESSAGE_TYPE_REQUEST; - } - else { - /* event line */ - start_line->message_type = MRCP_MESSAGE_TYPE_EVENT; - - if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse mrcp-version in request-line"); - return FALSE; - } - } - - start_line->version = mrcp_version_parse(&field); - if(start_line->version == MRCP_VERSION_UNKNOWN) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown mrcp-version"); - return FALSE; - } - return TRUE; -} - -/** Generate MRCP request-line */ -static apt_bool_t mrcp_request_line_generate(mrcp_start_line_t *start_line, apt_text_stream_t *stream) -{ - memcpy(stream->pos,start_line->method_name.buf,start_line->method_name.length); - stream->pos += start_line->method_name.length; - *stream->pos++ = APT_TOKEN_SP; - - mrcp_request_id_generate(start_line->request_id,stream); - *stream->pos++ = APT_TOKEN_SP; - - if(start_line->message_type == MRCP_MESSAGE_TYPE_REQUEST) { - if(start_line->status_code != MRCP_STATUS_CODE_UNKNOWN) { - mrcp_status_code_generate(start_line->status_code,stream); - *stream->pos++ = APT_TOKEN_SP; - } - } - else if(start_line->message_type == MRCP_MESSAGE_TYPE_EVENT) { - mrcp_request_state_generate(start_line->request_state,stream); - *stream->pos++ = APT_TOKEN_SP; - } - - mrcp_version_generate(start_line->version,stream); - return TRUE; -} - -/** Parse MRCP response-line */ -static apt_bool_t mrcp_response_line_parse(mrcp_start_line_t *start_line, apt_text_stream_t *stream) -{ - apt_str_t field; - start_line->length = 0; - if(start_line->version == MRCP_VERSION_2) { - if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse message-length in response-line"); - return FALSE; - } - start_line->length = apt_size_value_parse(&field); - } - - if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse request-id in response-line"); - return FALSE; - } - start_line->request_id = mrcp_request_id_parse(&field); - - if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse status-code in response-line"); - return FALSE; - } - start_line->status_code = mrcp_status_code_parse(&field); - - if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse request-state in response-line"); - return FALSE; - } - start_line->request_state = mrcp_request_state_parse(&field); - return TRUE; -} - -/** Generate MRCP response-line */ -static apt_bool_t mrcp_response_line_generate(mrcp_start_line_t *start_line, apt_text_stream_t *stream) -{ - mrcp_version_generate(start_line->version,stream); - *stream->pos++ = APT_TOKEN_SP; - - mrcp_request_id_generate(start_line->request_id,stream); - *stream->pos++ = APT_TOKEN_SP; - - mrcp_status_code_generate(start_line->status_code,stream); - *stream->pos++ = APT_TOKEN_SP; - - mrcp_request_state_generate(start_line->request_state,stream); - return TRUE; -} - -/** Parse MRCP v2 start-line */ -static apt_bool_t mrcp_v2_start_line_parse(mrcp_start_line_t *start_line, apt_text_stream_t *stream, apr_pool_t *pool) -{ - apt_str_t field; - if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse message-length in v2 start-line"); - return FALSE; - } - start_line->length = apt_size_value_parse(&field); - - if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse request-id in v2 start-line"); - return FALSE; - } - start_line->request_id = mrcp_request_id_parse(&field); - if(start_line->request_id == 0 && *field.buf != '0') { - /* parsing MRCP v2 request or event */ - start_line->message_type = MRCP_MESSAGE_TYPE_REQUEST; - apt_string_copy(&start_line->method_name,&field,pool); - - if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse request-id in v2 start-line"); - return FALSE; - } - start_line->request_id = mrcp_request_id_parse(&field); - - if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == TRUE) { - /* parsing MRCP v2 event */ - start_line->request_state = mrcp_request_state_parse(&field); - start_line->message_type = MRCP_MESSAGE_TYPE_EVENT; - } - } - else { - /* parsing MRCP v2 response */ - start_line->message_type = MRCP_MESSAGE_TYPE_RESPONSE; - - if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse status-code in v2 start-line"); - return FALSE; - } - start_line->status_code = mrcp_status_code_parse(&field); - - if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse request-state in v2 start-line"); - return FALSE; - } - start_line->request_state = mrcp_request_state_parse(&field); - } - - return TRUE; -} - -/** Generate MRCP v2 start-line */ -static apt_bool_t mrcp_v2_start_line_generate(mrcp_start_line_t *start_line, apt_text_stream_t *stream) -{ - char *pos = stream->pos; - mrcp_version_generate(start_line->version,stream); - *stream->pos++ = APT_TOKEN_SP; - - start_line->length = stream->pos - pos; /* length is temporary used to store offset */ - /* reserving MAX_DIGIT_COUNT space for start_line->length */ - memset(stream->pos,APT_TOKEN_SP,MAX_DIGIT_COUNT+1); - stream->pos += MAX_DIGIT_COUNT+1; - - if(start_line->message_type == MRCP_MESSAGE_TYPE_RESPONSE) { - mrcp_request_id_generate(start_line->request_id,stream); - *stream->pos++ = APT_TOKEN_SP; - - mrcp_status_code_generate(start_line->status_code,stream); - *stream->pos++ = APT_TOKEN_SP; - - mrcp_request_state_generate(start_line->request_state,stream); - } - else { - memcpy(stream->pos,start_line->method_name.buf,start_line->method_name.length); - stream->pos += start_line->method_name.length; - *stream->pos++ = APT_TOKEN_SP; - - mrcp_request_id_generate(start_line->request_id,stream); - if(start_line->message_type == MRCP_MESSAGE_TYPE_EVENT) { - *stream->pos++ = APT_TOKEN_SP; - mrcp_request_state_generate(start_line->request_state,stream); - } - } - return TRUE; -} - -/** Initialize MRCP start-line */ -MRCP_DECLARE(void) mrcp_start_line_init(mrcp_start_line_t *start_line) -{ - start_line->message_type = MRCP_MESSAGE_TYPE_UNKNOWN; - start_line->version = MRCP_VERSION_UNKNOWN; - start_line->length = 0; - start_line->request_id = 0; - apt_string_reset(&start_line->method_name); - start_line->status_code = MRCP_STATUS_CODE_UNKNOWN; - start_line->request_state = MRCP_REQUEST_STATE_UNKNOWN; -} - -/** Parse MRCP start-line */ -MRCP_DECLARE(apt_bool_t) mrcp_start_line_parse(mrcp_start_line_t *start_line, apt_str_t *str, apr_pool_t *pool) -{ - apt_text_stream_t line; - apt_str_t field; - apt_bool_t status = TRUE; - - start_line->message_type = MRCP_MESSAGE_TYPE_UNKNOWN; - apt_text_stream_init(&line,str->buf,str->length); - if(apt_text_field_read(&line,APT_TOKEN_SP,TRUE,&field) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot read the first field in start-line"); - return FALSE; - } - - if(field.buf == strstr(field.buf,MRCP_NAME)) { - start_line->version = mrcp_version_parse(&field); - - if(start_line->version == MRCP_VERSION_1) { - /* parsing MRCP v1 response */ - start_line->message_type = MRCP_MESSAGE_TYPE_RESPONSE; - status = mrcp_response_line_parse(start_line,&line); - } - else if(start_line->version == MRCP_VERSION_2) { - /* parsing MRCP v2 start-line (request/response/event) */ - status = mrcp_v2_start_line_parse(start_line,&line,pool); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown MRCP version"); - return FALSE; - } - } - else { - /* parsing MRCP v1 request or event */ - apt_string_copy(&start_line->method_name,&field,pool); - status = mrcp_request_line_parse(start_line,&line); - } - return status; -} - -/** Generate MRCP start-line */ -MRCP_DECLARE(apt_bool_t) mrcp_start_line_generate(mrcp_start_line_t *start_line, apt_text_stream_t *text_stream) -{ - apt_bool_t status = FALSE; - if(start_line->version == MRCP_VERSION_1) { - switch(start_line->message_type) { - case MRCP_MESSAGE_TYPE_REQUEST: - status = mrcp_request_line_generate(start_line,text_stream); - break; - case MRCP_MESSAGE_TYPE_RESPONSE: - status = mrcp_response_line_generate(start_line,text_stream); - break; - case MRCP_MESSAGE_TYPE_EVENT: - status = mrcp_request_line_generate(start_line,text_stream); - break; - default: - break; - } - } - else if(start_line->version == MRCP_VERSION_2) { - status = mrcp_v2_start_line_generate(start_line,text_stream); - } - - if(status == FALSE) { - return FALSE; - } - - return apt_text_eol_insert(text_stream); -} - -/** Finalize MRCP start-line generation */ -MRCP_DECLARE(apt_bool_t) mrcp_start_line_finalize(mrcp_start_line_t *start_line, apr_size_t content_length, apt_text_stream_t *text_stream) -{ - apr_size_t length = text_stream->pos - text_stream->text.buf + content_length; - if(start_line->version == MRCP_VERSION_2) { - /* message-length includes the number of bytes that specify the message-length in the header */ - /* too comlex to generate!!! see the discussion */ - /* http://www1.ietf.org/mail-archive/web/speechsc/current/msg01734.html */ - apt_str_t field; - field.buf = text_stream->text.buf + start_line->length; /* length is temporary used to store offset */ - length -= MAX_DIGIT_COUNT; - if(apt_var_length_value_generate(&length,MAX_DIGIT_COUNT,&field) == FALSE) { - return FALSE; - } - field.buf[field.length] = APT_TOKEN_SP; - start_line->length += field.length; - - field.length = MAX_DIGIT_COUNT - field.length; - if(field.length) { - memmove(text_stream->text.buf+field.length,text_stream->text.buf,start_line->length); - text_stream->text.buf += field.length; - text_stream->text.length -= field.length; - } - } - - start_line->length = length; - return TRUE; -} - -/** Parse MRCP request-id */ -MRCP_DECLARE(mrcp_request_id) mrcp_request_id_parse(const apt_str_t *field) -{ - if(field->buf) { -#ifdef TOO_LONG_MRCP_REQUEST_ID - return apr_atoi64(field->buf); -#else - return atol(field->buf); -#endif - } - return 0; -} - -/** Generate MRCP request-id */ -MRCP_DECLARE(apt_bool_t) mrcp_request_id_generate(mrcp_request_id request_id, apt_text_stream_t *stream) -{ - int length = apr_snprintf(stream->pos, stream->end - stream->pos, "%"MRCP_REQUEST_ID_FMT, request_id); - if(length <= 0) { - return FALSE; - } - stream->pos += length; - return TRUE; -} diff --git a/libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj.filters b/libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj.filters deleted file mode 100644 index 119921b34b..0000000000 --- a/libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj.filters +++ /dev/null @@ -1,133 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {19ad4bde-c4f4-4937-9073-ca2780341d76} - - - {8ec996ac-8a0a-4bf0-9b3c-535616585109} - h;hpp;hxx;hm;inl;inc;xsd - - - {5ba77874-7c17-4748-b5ba-b07b7f0a2169} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {f30fd049-a10d-4aea-b4bb-3eb674690fdd} - - - {7e71717b-6f22-4c59-ba50-7b5a15516b2f} - h;hpp;hxx;hm;inl;inc;xsd - - - {c66dbb84-ce9d-4408-b54d-4d0ec51069fb} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {f20cfd62-4bb9-42de-bf1c-d578c8cd1a18} - - - {039a4834-7ddb-40e7-9177-55d11ef1e733} - h;hpp;hxx;hm;inl;inc;xsd - - - {dc087d31-8ecf-473c-baa1-f3091e16014d} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - include - - - include - - - message\include - - - message\include - - - message\include - - - message\include - - - control\include - - - control\include - - - control\include - - - control\include - - - resources\include - - - resources\include - - - resources\include - - - resources\include - - - resources\include - - - resources\include - - - - - message\src - - - message\src - - - message\src - - - message\src - - - control\src - - - control\src - - - control\src - - - resources\src - - - resources\src - - - resources\src - - - resources\src - - - resources\src - - - resources\src - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp/mrcp.2017.vcxproj b/libs/unimrcp/libs/mrcp/mrcp.2017.vcxproj deleted file mode 100644 index d2420fde7c..0000000000 --- a/libs/unimrcp/libs/mrcp/mrcp.2017.vcxproj +++ /dev/null @@ -1,163 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - mrcp - {1C320193-46A6-4B34-9C56-8AB584FC1B56} - mrcp - Win32Proj - - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(SolutionDir)$(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - - - - %(AdditionalIncludeDirectories) - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) - - - - - X64 - - - %(AdditionalIncludeDirectories) - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) - ProgramDatabase - - - - - %(AdditionalIncludeDirectories) - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) - - - - - X64 - - - %(AdditionalIncludeDirectories) - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {f6c55d93-b927-4483-bb69-15aef3dd2dff} - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp/mrcp.vcproj b/libs/unimrcp/libs/mrcp/mrcp.vcproj deleted file mode 100644 index dc421663c7..0000000000 --- a/libs/unimrcp/libs/mrcp/mrcp.vcproj +++ /dev/null @@ -1,433 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/libs/mrcp/mrcp.vcxproj b/libs/unimrcp/libs/mrcp/mrcp.vcxproj deleted file mode 100644 index b2e453c4e8..0000000000 --- a/libs/unimrcp/libs/mrcp/mrcp.vcxproj +++ /dev/null @@ -1,157 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {1C320193-46A6-4B34-9C56-8AB584FC1B56} - mrcp - Win32Proj - - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - %(AdditionalIncludeDirectories) - - - - - %(AdditionalIncludeDirectories) - - - - - X64 - - - %(AdditionalIncludeDirectories) - ProgramDatabase - - - - - X64 - - - %(AdditionalIncludeDirectories) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp/mrcp.vcxproj.filters b/libs/unimrcp/libs/mrcp/mrcp.vcxproj.filters deleted file mode 100644 index 300f13fdf6..0000000000 --- a/libs/unimrcp/libs/mrcp/mrcp.vcxproj.filters +++ /dev/null @@ -1,151 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {235b9544-2004-49c6-96de-a5830544296e} - - - {64717899-118b-46de-8646-d7312b19ce00} - h;hpp;hxx;hm;inl;inc;xsd - - - {1b656d42-e8f0-4126-85da-9bb8a470cfaa} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {39545f85-6811-4878-af3f-26d813012ea3} - - - {e165b2a9-81db-4030-9e72-7189ee45182b} - h;hpp;hxx;hm;inl;inc;xsd - - - {a4e3b1a7-762d-4fcf-83e8-f52675aab2ff} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {35e8458d-fc25-4066-b4be-ab452a6da8a9} - - - {8bbdedd2-2c1e-4474-8dbb-fcecf1f9a869} - h;hpp;hxx;hm;inl;inc;xsd - - - {1d167695-a5d2-4f87-8bd3-ea21cea5a368} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - include - - - include - - - message\include - - - message\include - - - message\include - - - message\include - - - message\include - - - control\include - - - control\include - - - control\include - - - control\include - - - resources\include - - - resources\include - - - resources\include - - - resources\include - - - resources\include - - - resources\include - - - resources\include - - - resources\include - - - - - message\src - - - message\src - - - message\src - - - message\src - - - message\src - - - control\src - - - control\src - - - control\src - - - resources\src - - - resources\src - - - resources\src - - - resources\src - - - resources\src - - - resources\src - - - resources\src - - - resources\src - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_header.h b/libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_header.h deleted file mode 100644 index a9f71c5a7e..0000000000 --- a/libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_header.h +++ /dev/null @@ -1,273 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_recog_header.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_RECOG_HEADER_H -#define MRCP_RECOG_HEADER_H - -/** - * @file mrcp_recog_header.h - * @brief MRCP Recognizer Header - */ - -#include "mrcp_types.h" -#include "mrcp_header_accessor.h" - -APT_BEGIN_EXTERN_C - -/** MRCP recognizer header fields */ -typedef enum { - RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD, - RECOGNIZER_HEADER_SENSITIVITY_LEVEL, - RECOGNIZER_HEADER_SPEED_VS_ACCURACY, - RECOGNIZER_HEADER_N_BEST_LIST_LENGTH, - RECOGNIZER_HEADER_NO_INPUT_TIMEOUT, - RECOGNIZER_HEADER_RECOGNITION_TIMEOUT, - RECOGNIZER_HEADER_WAVEFORM_URI, - RECOGNIZER_HEADER_COMPLETION_CAUSE, - RECOGNIZER_HEADER_RECOGNIZER_CONTEXT_BLOCK, - RECOGNIZER_HEADER_START_INPUT_TIMERS, - RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT, - RECOGNIZER_HEADER_SPEECH_INCOMPLETE_TIMEOUT, - RECOGNIZER_HEADER_DTMF_INTERDIGIT_TIMEOUT, - RECOGNIZER_HEADER_DTMF_TERM_TIMEOUT, - RECOGNIZER_HEADER_DTMF_TERM_CHAR, - RECOGNIZER_HEADER_FAILED_URI, - RECOGNIZER_HEADER_FAILED_URI_CAUSE, - RECOGNIZER_HEADER_SAVE_WAVEFORM, - RECOGNIZER_HEADER_NEW_AUDIO_CHANNEL, - RECOGNIZER_HEADER_SPEECH_LANGUAGE, - - /** Additional header fields for MRCP v2 */ - RECOGNIZER_HEADER_INPUT_TYPE, - RECOGNIZER_HEADER_INPUT_WAVEFORM_URI, - RECOGNIZER_HEADER_COMPLETION_REASON, - RECOGNIZER_HEADER_MEDIA_TYPE, - RECOGNIZER_HEADER_VER_BUFFER_UTTERANCE, - RECOGNIZER_HEADER_RECOGNITION_MODE, - RECOGNIZER_HEADER_CANCEL_IF_QUEUE, - RECOGNIZER_HEADER_HOTWORD_MAX_DURATION, - RECOGNIZER_HEADER_HOTWORD_MIN_DURATION, - RECOGNIZER_HEADER_INTERPRET_TEXT, - RECOGNIZER_HEADER_DTMF_BUFFER_TIME, - RECOGNIZER_HEADER_CLEAR_DTMF_BUFFER, - RECOGNIZER_HEADER_EARLY_NO_MATCH, - RECOGNIZER_HEADER_NUM_MIN_CONSISTENT_PRONUNCIATIONS, - RECOGNIZER_HEADER_CONSISTENCY_THRESHOLD, - RECOGNIZER_HEADER_CLASH_THRESHOLD, - RECOGNIZER_HEADER_PERSONAL_GRAMMAR_URI, - RECOGNIZER_HEADER_ENROLL_UTTERANCE, - RECOGNIZER_HEADER_PHRASE_ID, - RECOGNIZER_HEADER_PHRASE_NL, - RECOGNIZER_HEADER_WEIGHT, - RECOGNIZER_HEADER_SAVE_BEST_WAVEFORM, - RECOGNIZER_HEADER_NEW_PHRASE_ID, - RECOGNIZER_HEADER_CONFUSABLE_PHRASES_URI, - RECOGNIZER_HEADER_ABORT_PHRASE_ENROLLMENT, - - RECOGNIZER_HEADER_COUNT -} mrcp_recognizer_header_id; - - -/** MRCP recognizer completion-cause */ -typedef enum { - RECOGNIZER_COMPLETION_CAUSE_SUCCESS = 0, - RECOGNIZER_COMPLETION_CAUSE_NO_MATCH = 1, - RECOGNIZER_COMPLETION_CAUSE_NO_INPUT_TIMEOUT = 2, - RECOGNIZER_COMPLETION_CAUSE_RECOGNITION_TIMEOUT = 3, - RECOGNIZER_COMPLETION_CAUSE_GRAM_LOAD_FAILURE = 4, - RECOGNIZER_COMPLETION_CAUSE_GRAM_COMP_FAILURE = 5, - RECOGNIZER_COMPLETION_CAUSE_ERROR = 6, - RECOGNIZER_COMPLETION_CAUSE_SPEECH_TOO_EARLY = 7, - RECOGNIZER_COMPLETION_CAUSE_TOO_MUCH_SPEECH_TIMEOUT = 8, - RECOGNIZER_COMPLETION_CAUSE_URI_FAILURE = 9, - RECOGNIZER_COMPLETION_CAUSE_LANGUAGE_UNSUPPORTED = 10, - - /** Additional completion-cause for MRCP v2 */ - RECOGNIZER_COMPLETION_CAUSE_CANCELLED = 11, - RECOGNIZER_COMPLETION_CAUSE_SEMANTICS_FAILURE = 12, - RECOGNIZER_COMPLETION_CAUSE_PARTIAL_MATCH = 13, - RECOGNIZER_COMPLETION_CAUSE_PARTIAL_MATCH_MAXTIME = 14, - RECOGNIZER_COMPLETION_CAUSE_NO_MATCH_MAXTIME = 15, - RECOGNIZER_COMPLETION_CAUSE_GRAM_DEFINITION_FAILURE = 16, - - RECOGNIZER_COMPLETION_CAUSE_COUNT = 17, - RECOGNIZER_COMPLETION_CAUSE_UNKNOWN = RECOGNIZER_COMPLETION_CAUSE_COUNT -} mrcp_recog_completion_cause_e; - - - -/** MRCP recognizer-header declaration */ -typedef struct mrcp_recog_header_t mrcp_recog_header_t; - -/** MRCP recognizer-header */ -struct mrcp_recog_header_t { - /** Tells the recognizer resource what confidence level the client considers a - successful match */ - float confidence_threshold; - /** To filter out background noise and not mistake it for speech */ - float sensitivity_level; - /** Tunable towards Performance or Accuracy */ - float speed_vs_accuracy; - /** The client, by setting this header, can ask the recognition resource - to send it more than 1 alternative */ - apr_size_t n_best_list_length; - /** The client can use the no-input-timeout header to set this timeout */ - apr_size_t no_input_timeout; - /** The client can use the recognition-timeout header to set this timeout */ - apr_size_t recognition_timeout; - /** MUST be present in the RECOGNITION-COMPLETE event if the Save-Waveform - header was set to true */ - apt_str_t waveform_uri; - /** MUST be part of a RECOGNITION-COMPLETE, event coming from - the recognizer resource to the client */ - mrcp_recog_completion_cause_e completion_cause; - /** MAY be sent as part of the SET-PARAMS or GET-PARAMS request */ - apt_str_t recognizer_context_block; - /** MAY be sent as part of the RECOGNIZE request. A value of false tells - the recognizer to start recognition, but not to start the no-input timer yet */ - apt_bool_t start_input_timers; - /** Specifies the length of silence required following user - speech before the speech recognizer finalizes a result */ - apr_size_t speech_complete_timeout; - /** Specifies the required length of silence following user - speech after which a recognizer finalizes a result */ - apr_size_t speech_incomplete_timeout; - /** Specifies the inter-digit timeout value to use when - recognizing DTMF input */ - apr_size_t dtmf_interdigit_timeout; - /** Specifies the terminating timeout to use when - recognizing DTMF input*/ - apr_size_t dtmf_term_timeout; - /** Specifies the terminating DTMF character for DTMF input - recognition */ - char dtmf_term_char; - /** When a recognizer needs to fetch or access a URI and the access fails - the server SHOULD provide the failed URI in this header in the method response*/ - apt_str_t failed_uri; - /** When a recognizer method needs a recognizer to fetch or access a URI - and the access fails the server MUST provide the URI specific or - protocol specific response code for the URI in the Failed-URI header */ - apt_str_t failed_uri_cause; - /** Allows the client to request the recognizer resource to - save the audio input to the recognizer */ - apt_bool_t save_waveform; - /** MAY be specified in a RECOGNIZE request and allows the - client to tell the server that, from this point on, further input - audio comes from a different audio source */ - apt_bool_t new_audio_channel; - /** Specifies the language of recognition grammar data within - a session or request, if it is not specified within the data */ - apt_str_t speech_language; - - /** Additional header fields for MRCP v2 */ - /** Specifies if the input that caused a barge-in was DTMF or speech */ - apt_str_t input_type; - /** Optional header specifies a URI pointing to audio content to be - processed by the RECOGNIZE operation */ - apt_str_t input_waveform_uri; - /** MAY be specified in a RECOGNITION-COMPLETE event coming from - the recognizer resource to the client */ - apt_str_t completion_reason; - /** Tells the server resource the Media Type in which to store captured - audio such as the one captured and returned by the Waveform-URI header */ - apt_str_t media_type; - /** Lets the client request the server to buffer the - utterance associated with this recognition request into a buffer - available to a co-resident verification resource */ - apt_bool_t ver_buffer_utterance; - /** Specifies what mode the RECOGNIZE method will operate in */ - apt_str_t recognition_mode; - /** Specifies what will happen if the client attempts to - invoke another RECOGNIZE method when this RECOGNIZE request is - already in progress for the resource*/ - apt_bool_t cancel_if_queue; - /** Specifies the maximum length of an utterance (in seconds) that will - be considered for Hotword recognition */ - apr_size_t hotword_max_duration; - /** Specifies the minimum length of an utterance (in seconds) that will - be considered for Hotword recognition */ - apr_size_t hotword_min_duration; - /** Provides a pointer to the text for which a natural language interpretation is desired */ - apt_str_t interpret_text; - /** MAY be specified in a GET-PARAMS or SET-PARAMS method and - is used to specify the size in time, in milliseconds, of the - typeahead buffer for the recognizer */ - apr_size_t dtmf_buffer_time; - /** MAY be specified in a RECOGNIZE method and is used to - tell the recognizer to clear the DTMF type-ahead buffer before - starting the recognize */ - apt_bool_t clear_dtmf_buffer; - /** MAY be specified in a RECOGNIZE method and is used to - tell the recognizer that it MUST not wait for the end of speech - before processing the collected speech to match active grammars */ - apt_bool_t early_no_match; - /** MAY be specified in a START-PHRASE-ENROLLMENT, "SET-PARAMS", or - "GET-PARAMS" method and is used to specify the minimum number of - consistent pronunciations that must be obtained to voice enroll a new phrase */ - apr_size_t num_min_consistent_pronunciations; - /** MAY be sent as part of the START-PHRASE-ENROLLMENT,"SET-PARAMS", or - "GET-PARAMS" method and is used during voice-enrollment to specify how similar - to a previously enrolled pronunciation of the same phrase an utterance needs - to be in order to be considered "consistent" */ - float consistency_threshold; - /** MAY be sent as part of the START-PHRASE-ENROLLMENT, SET-PARAMS, or - "GET-PARAMS" method and is used during voice-enrollment to specify - how similar the pronunciations of two different phrases can be - before they are considered to be clashing */ - float clash_threshold; - /** Specifies the speaker-trained grammar to be used or - referenced during enrollment operations */ - apt_str_t personal_grammar_uri; - /** MAY be specified in the RECOGNIZE method. If this header - is set to "true" and an Enrollment is active, the RECOGNIZE command - MUST add the collected utterance to the personal grammar that is - being enrolled */ - apt_bool_t enroll_utterance; - /** Identifies a phrase in an existing personal grammar for which - enrollment is desired. It is also returned to the client in the - RECOGNIZE complete event */ - apt_str_t phrase_id; - /** Specifies the interpreted text to be returned when the - phrase is recognized */ - apt_str_t phrase_nl; - /** Represents the occurrence likelihood of a phrase in an enrolled grammar */ - float weight; - /** Allows the client to request the recognizer resource to - save the audio stream for the best repetition of the phrase that was - used during the enrollment session */ - apt_bool_t save_best_waveform; - /** Replaces the id used to identify the phrase in a personal grammar */ - apt_str_t new_phrase_id; - /** Specifies a grammar that defines invalid phrases for enrollment */ - apt_str_t confusable_phrases_uri; - /** Can optionally be specified in the END-PHRASE-ENROLLMENT - method to abort the phrase enrollment, rather than committing the - phrase to the personal grammar */ - apt_bool_t abort_phrase_enrollment; -}; - - -/** Get recognizer header vtable */ -const mrcp_header_vtable_t* mrcp_recog_header_vtable_get(mrcp_version_e version); - -/** Get recognizer completion cause string */ -MRCP_DECLARE(const apt_str_t*) mrcp_recog_completion_cause_get(mrcp_recog_completion_cause_e completion_cause, mrcp_version_e version); - -APT_END_EXTERN_C - -#endif /* MRCP_RECOG_HEADER_H */ diff --git a/libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_resource.h b/libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_resource.h deleted file mode 100644 index 93e2f1ba9e..0000000000 --- a/libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_resource.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_recog_resource.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_RECOG_RESOURCE_H -#define MRCP_RECOG_RESOURCE_H - -/** - * @file mrcp_recog_resource.h - * @brief MRCP Recognizer Resource - */ - -#include "mrcp_types.h" - -APT_BEGIN_EXTERN_C - -/** MRCP recognizer methods */ -typedef enum { - RECOGNIZER_SET_PARAMS, - RECOGNIZER_GET_PARAMS, - RECOGNIZER_DEFINE_GRAMMAR, - RECOGNIZER_RECOGNIZE, - RECOGNIZER_INTERPRET, - RECOGNIZER_GET_RESULT, - RECOGNIZER_START_INPUT_TIMERS, - RECOGNIZER_STOP, - RECOGNIZER_START_PHRASE_ENROLLMENT, - RECOGNIZER_ENROLLMENT_ROLLBACK, - RECOGNIZER_END_PHRASE_ENROLLMENT, - RECOGNIZER_MODIFY_PHRASE, - RECOGNIZER_DELETE_PHRASE, - - RECOGNIZER_METHOD_COUNT -} mrcp_recognizer_method_id; - -/** MRCP recognizer events */ -typedef enum { - RECOGNIZER_START_OF_INPUT, - RECOGNIZER_RECOGNITION_COMPLETE, - RECOGNIZER_INTERPRETATION_COMPLETE, - - RECOGNIZER_EVENT_COUNT -} mrcp_recognizer_event_id; - -/** Create MRCP recognizer resource */ -MRCP_DECLARE(mrcp_resource_t*) mrcp_recog_resource_create(apr_pool_t *pool); - -APT_END_EXTERN_C - -#endif /* MRCP_RECOG_RESOURCE_H */ diff --git a/libs/unimrcp/libs/mrcp/resources/include/mrcp_recorder_header.h b/libs/unimrcp/libs/mrcp/resources/include/mrcp_recorder_header.h deleted file mode 100644 index 77569a00b0..0000000000 --- a/libs/unimrcp/libs/mrcp/resources/include/mrcp_recorder_header.h +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_recorder_header.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_RECORDER_HEADER_H -#define MRCP_RECORDER_HEADER_H - -/** - * @file mrcp_recorder_header.h - * @brief MRCP Recorder Header - */ - -#include "mrcp_types.h" -#include "mrcp_header_accessor.h" - -APT_BEGIN_EXTERN_C - -/** MRCP recorder header fields */ -typedef enum { - RECORDER_HEADER_SENSITIVITY_LEVEL, - RECORDER_HEADER_NO_INPUT_TIMEOUT, - RECORDER_HEADER_COMPLETION_CAUSE, - RECORDER_HEADER_COMPLETION_REASON, - RECORDER_HEADER_FAILED_URI, - RECORDER_HEADER_FAILED_URI_CAUSE, - RECORDER_HEADER_RECORD_URI, - RECORDER_HEADER_MEDIA_TYPE, - RECORDER_HEADER_MAX_TIME, - RECORDER_HEADER_TRIM_LENGTH, - RECORDER_HEADER_FINAL_SILENCE, - RECORDER_HEADER_CAPTURE_ON_SPEECH, - RECORDER_HEADER_VER_BUFFER_UTTERANCE, - RECORDER_HEADER_START_INPUT_TIMERS, - RECORDER_HEADER_NEW_AUDIO_CHANNEL, - - RECORDER_HEADER_COUNT -} mrcp_recorder_header_id; - - -/** MRCP recorder completion-cause */ -typedef enum { - RECORDER_COMPLETION_CAUSE_SUCCESS_SILENCE = 0, - RECORDER_COMPLETION_CAUSE_SUCCESS_MAXTIME = 1, - RECORDER_COMPLETION_CAUSE_NO_INPUT_TIMEOUT = 2, - RECORDER_COMPLETION_CAUSE_URI_FAILURE = 3, - RECORDER_COMPLETION_CAUSE_ERROR = 4, - - RECORDER_COMPLETION_CAUSE_COUNT = 5, - RECORDER_COMPLETION_CAUSE_UNKNOWN = RECORDER_COMPLETION_CAUSE_COUNT -} mrcp_recorder_completion_cause_e; - - - -/** MRCP recorder-header declaration */ -typedef struct mrcp_recorder_header_t mrcp_recorder_header_t; - -/** MRCP recorder-header */ -struct mrcp_recorder_header_t { - /** To filter out background noise and not mistake it for speech */ - float sensitivity_level; - /** When recording is started and there is no speech detected for a - certain period of time, the recorder can send a RECORD-COMPLETE event */ - apr_size_t no_input_timeout; - /** MUST be part of a RECORD-COMPLETE event coming from the - recorder resource to the client */ - mrcp_recorder_completion_cause_e completion_cause; - /** MAY be specified in a RECORD-COMPLETE event coming from - the recorder resource to the client */ - apt_str_t completion_reason; - /** When a recorder method needs to post the audio to a URI and access to - the URI fails, the server MUST provide the failed URI in this header - in the method response */ - apt_str_t failed_uri; - /** When a recorder method needs to post the audio to a URI and access to - the URI fails, the server MUST provide the URI specific or protocol - specific response code through this header in the method response */ - apt_str_t failed_uri_cause; - /** When a recorder method contains this header the server must capture - the audio and store it */ - apt_str_t record_uri; - /** A RECORD method MUST contain this header, which specifies to the - server the Media Type of the captured audio or video */ - apt_str_t media_type; - /** When recording is started this specifies the maximum length of the - recording in milliseconds, calculated from the time the actual - capture and store begins and is not necessarily the time the RECORD - method is received */ - apr_size_t max_time; - /** This header MAY be sent on a STOP method and specifies the length of - audio to be trimmed from the end of the recording after the stop */ - apr_size_t trim_length; - /** When recorder is started and the actual capture begins, this header - specifies the length of silence in the audio that is to be - interpreted as the end of the recording*/ - apr_size_t final_silence; - /** f false, the recorder MUST start capturing immediately when started. - If true, the recorder MUST wait for the endpointing functionality to - detect speech before it starts capturing */ - apt_bool_t capture_on_speech; - /** Tells the server to buffer the utterance associated with this - recording request into the verification buffer */ - apt_bool_t ver_buffer_utterance; - /** MAY be sent as part of the RECORD request. A value of false tells the - recorder resource to start the operation, but not to start the no-input - timer until the client sends a START-INPUT-TIMERS */ - apt_bool_t start_input_timers; - /** MAY be specified in a RECORD request and allows the - client to tell the server that, from this point on, further input - audio comes from a different audio source */ - apt_bool_t new_audio_channel; -}; - - -/** Get recorder header vtable */ -const mrcp_header_vtable_t* mrcp_recorder_header_vtable_get(mrcp_version_e version); - -/** Get recorder completion cause string */ -MRCP_DECLARE(const apt_str_t*) mrcp_recorder_completion_cause_get( - mrcp_recorder_completion_cause_e completion_cause, - mrcp_version_e version); - -APT_END_EXTERN_C - -#endif /* MRCP_RECORDER_HEADER_H */ diff --git a/libs/unimrcp/libs/mrcp/resources/include/mrcp_recorder_resource.h b/libs/unimrcp/libs/mrcp/resources/include/mrcp_recorder_resource.h deleted file mode 100644 index 86100030a1..0000000000 --- a/libs/unimrcp/libs/mrcp/resources/include/mrcp_recorder_resource.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_recorder_resource.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_RECORDER_RESOURCE_H -#define MRCP_RECORDER_RESOURCE_H - -/** - * @file mrcp_recorder_resource.h - * @brief MRCP Recorder Resource - */ - -#include "mrcp_types.h" - -APT_BEGIN_EXTERN_C - -/** MRCP recorder methods */ -typedef enum { - RECORDER_SET_PARAMS, - RECORDER_GET_PARAMS, - RECORDER_RECORD, - RECORDER_STOP, - RECORDER_START_INPUT_TIMERS, - - RECORDER_METHOD_COUNT -} mrcp_recorder_method_id; - -/** MRCP recorder events */ -typedef enum { - RECORDER_START_OF_INPUT, - RECORDER_RECORD_COMPLETE, - - RECORDER_EVENT_COUNT -} mrcp_recorder_event_id; - -/** Create MRCP recorder resource */ -MRCP_DECLARE(mrcp_resource_t*) mrcp_recorder_resource_create(apr_pool_t *pool); - -APT_END_EXTERN_C - -#endif /* MRCP_RECORDER_RESOURCE_H */ diff --git a/libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_header.h b/libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_header.h deleted file mode 100644 index 9a9fc6eb6b..0000000000 --- a/libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_header.h +++ /dev/null @@ -1,304 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_synth_header.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_SYNTH_HEADER_H -#define MRCP_SYNTH_HEADER_H - -/** - * @file mrcp_synth_header.h - * @brief MRCP Synthesizer Header - */ - -#include "mrcp_types.h" -#include "mrcp_header_accessor.h" - -APT_BEGIN_EXTERN_C - -/** MRCP synthesizer header fields */ -typedef enum { - SYNTHESIZER_HEADER_JUMP_SIZE, - SYNTHESIZER_HEADER_KILL_ON_BARGE_IN, - SYNTHESIZER_HEADER_SPEAKER_PROFILE, - SYNTHESIZER_HEADER_COMPLETION_CAUSE, - SYNTHESIZER_HEADER_COMPLETION_REASON, - SYNTHESIZER_HEADER_VOICE_GENDER, - SYNTHESIZER_HEADER_VOICE_AGE, - SYNTHESIZER_HEADER_VOICE_VARIANT, - SYNTHESIZER_HEADER_VOICE_NAME, - SYNTHESIZER_HEADER_PROSODY_VOLUME, - SYNTHESIZER_HEADER_PROSODY_RATE, - SYNTHESIZER_HEADER_SPEECH_MARKER, - SYNTHESIZER_HEADER_SPEECH_LANGUAGE, - SYNTHESIZER_HEADER_FETCH_HINT, - SYNTHESIZER_HEADER_AUDIO_FETCH_HINT, - SYNTHESIZER_HEADER_FAILED_URI, - SYNTHESIZER_HEADER_FAILED_URI_CAUSE, - SYNTHESIZER_HEADER_SPEAK_RESTART, - SYNTHESIZER_HEADER_SPEAK_LENGTH, - SYNTHESIZER_HEADER_LOAD_LEXICON, - SYNTHESIZER_HEADER_LEXICON_SEARCH_ORDER, - - SYNTHESIZER_HEADER_COUNT -} mrcp_synthesizer_header_id; - - -/** Speech-units */ -typedef enum { - SPEECH_UNIT_SECOND, - SPEECH_UNIT_WORD, - SPEECH_UNIT_SENTENCE, - SPEECH_UNIT_PARAGRAPH, - - SPEECH_UNIT_COUNT -} mrcp_speech_unit_e; - -/** Speech-length types */ -typedef enum { - SPEECH_LENGTH_TYPE_TEXT, - SPEECH_LENGTH_TYPE_NUMERIC_POSITIVE, - SPEECH_LENGTH_TYPE_NUMERIC_NEGATIVE, - - SPEECH_LENGTH_TYPE_UNKNOWN -} mrcp_speech_length_type_e; - -/** MRCP voice-gender */ -typedef enum { - VOICE_GENDER_MALE, - VOICE_GENDER_FEMALE, - VOICE_GENDER_NEUTRAL, - - VOICE_GENDER_COUNT, - VOICE_GENDER_UNKNOWN = VOICE_GENDER_COUNT -} mrcp_voice_gender_e; - -/** Prosody-volume type */ -typedef enum { - PROSODY_VOLUME_TYPE_LABEL, - PROSODY_VOLUME_TYPE_NUMERIC, - PROSODY_VOLUME_TYPE_RELATIVE_CHANGE, - - PROSODY_VOLUME_TYPE_UNKNOWN -} mrcp_prosody_volume_type_e; - -/** Prosody-rate type */ -typedef enum { - PROSODY_RATE_TYPE_LABEL, - PROSODY_RATE_TYPE_RELATIVE_CHANGE, - - PROSODY_RATE_TYPE_UNKNOWN -} mrcp_prosody_rate_type_e; - -/** Prosody-volume */ -typedef enum { - PROSODY_VOLUME_SILENT, - PROSODY_VOLUME_XSOFT, - PROSODY_VOLUME_SOFT, - PROSODY_VOLUME_MEDIUM, - PROSODY_VOLUME_LOUD, - PROSODY_VOLUME_XLOUD, - PROSODY_VOLUME_DEFAULT, - - PROSODY_VOLUME_COUNT, - PROSODY_VOLUME_UNKNOWN = PROSODY_VOLUME_COUNT -} mrcp_prosody_volume_label_e; - -/** Prosody-rate */ -typedef enum { - PROSODY_RATE_XSLOW, - PROSODY_RATE_SLOW, - PROSODY_RATE_MEDIUM, - PROSODY_RATE_FAST, - PROSODY_RATE_XFAST, - PROSODY_RATE_DEFAULT, - - PROSODY_RATE_COUNT, - PROSODY_RATE_UNKNOWN = PROSODY_RATE_COUNT -} mrcp_prosody_rate_label_e; - -/** Synthesizer completion-cause specified in SPEAK-COMPLETE event */ -typedef enum { - SYNTHESIZER_COMPLETION_CAUSE_NORMAL = 0, - SYNTHESIZER_COMPLETION_CAUSE_BARGE_IN = 1, - SYNTHESIZER_COMPLETION_CAUSE_PARSE_FAILURE = 2, - SYNTHESIZER_COMPLETION_CAUSE_URI_FAILURE = 3, - SYNTHESIZER_COMPLETION_CAUSE_ERROR = 4, - SYNTHESIZER_COMPLETION_CAUSE_LANGUAGE_UNSUPPORTED = 5, - SYNTHESIZER_COMPLETION_CAUSE_LEXICON_LOAD_FAILURE = 6, - SYNTHESIZER_COMPLETION_CAUSE_CANCELLED = 7, - - SYNTHESIZER_COMPLETION_CAUSE_COUNT = 8, - SYNTHESIZER_COMPLETION_CAUSE_UNKNOWN = SYNTHESIZER_COMPLETION_CAUSE_COUNT -} mrcp_synth_completion_cause_e; - - -/** Speech-length value declaration */ -typedef struct mrcp_speech_length_value_t mrcp_speech_length_value_t; -/** Numeric speech-length declaration */ -typedef struct mrcp_numeric_speech_length_t mrcp_numeric_speech_length_t; -/** Prosody-param declaration */ -typedef struct mrcp_prosody_param_t mrcp_prosody_param_t; -/** Voice-param declaration */ -typedef struct mrcp_voice_param_t mrcp_voice_param_t; -/**Prosody-rate declaration*/ -typedef struct mrcp_prosody_rate_t mrcp_prosody_rate_t; -/**Prosody-volume declaration*/ -typedef struct mrcp_prosody_volume_t mrcp_prosody_volume_t; -/** MRCP synthesizer-header declaration */ -typedef struct mrcp_synth_header_t mrcp_synth_header_t; - -/** Numeric speech-length */ -struct mrcp_numeric_speech_length_t { - /** The length */ - apr_size_t length; - /** The unit (second/word/sentence/paragraph) */ - mrcp_speech_unit_e unit; -}; - -/** Definition of speech-length value */ -struct mrcp_speech_length_value_t { - /** Speech-length type (numeric/text)*/ - mrcp_speech_length_type_e type; - /** Speech-length value (either numeric or text) */ - union { - /** Text speech-length */ - apt_str_t tag; - /** Numeric speech-length */ - mrcp_numeric_speech_length_t numeric; - } value; -}; - -/** MRCP voice-param */ -struct mrcp_voice_param_t { - /** Voice gender (male/femaile/neutral)*/ - mrcp_voice_gender_e gender; - /** Voice age */ - apr_size_t age; - /** Voice variant */ - apr_size_t variant; - /** Voice name */ - apt_str_t name; -}; - -/** MRCP prosody-volume */ -struct mrcp_prosody_volume_t { - /** prosody-volume type (one of label,numeric,relative change) */ - mrcp_prosody_volume_type_e type; - - /** prosody-volume value */ - union { - /** one of "silent", "x-soft", ... */ - mrcp_prosody_volume_label_e label; - /** numeric value */ - float numeric; - /** relative change */ - float relative; - } value; -}; - -/** MRCP prosody-rate */ -struct mrcp_prosody_rate_t { - /** prosody-rate type (one of label, relative change) */ - mrcp_prosody_rate_type_e type; - - /** prosody-rate value */ - union { - /** one of "x-slow", "slow", ... */ - mrcp_prosody_rate_label_e label; - /** relative change */ - float relative; - } value; -}; - -/** MRCP prosody-param */ -struct mrcp_prosody_param_t { - /** Prosofy volume */ - mrcp_prosody_volume_t volume; - /** Prosofy rate */ - mrcp_prosody_rate_t rate; -}; - -/** MRCP synthesizer-header */ -struct mrcp_synth_header_t { - /** MAY be specified in a CONTROL method and controls the - amount to jump forward or backward in an active "SPEAK" request */ - mrcp_speech_length_value_t jump_size; - /** MAY be sent as part of the "SPEAK" method to enable kill- - on-barge-in support */ - apt_bool_t kill_on_barge_in; - /** MAY be part of the "SET-PARAMS"/"GET-PARAMS" or "SPEAK" - request from the client to the server and specifies a URI which - references the profile of the speaker */ - apt_str_t speaker_profile; - /** MUST be specified in a "SPEAK-COMPLETE" event coming from - the synthesizer resource to the client */ - mrcp_synth_completion_cause_e completion_cause; - /** MAY be specified in a "SPEAK-COMPLETE" event coming from - the synthesizer resource to the client */ - apt_str_t completion_reason; - /** This set of header fields defines the voice of the speaker */ - mrcp_voice_param_t voice_param; - /** This set of header fields defines the prosody of the speech */ - mrcp_prosody_param_t prosody_param; - /** Contains timestamp information in a "timestamp" field */ - apt_str_t speech_marker; - /** specifies the default language of the speech data if the - language is not specified in the markup */ - apt_str_t speech_language; - /** When the synthesizer needs to fetch documents or other resources like - speech markup or audio files, this header controls the corresponding - URI access properties */ - apt_str_t fetch_hint; - /** When the synthesizer needs to fetch documents or other resources like - speech audio files, this header controls the corresponding URI access - properties */ - apt_str_t audio_fetch_hint; - /** When a synthesizer method needs a synthesizer to fetch or access a - URI and the access fails, the server SHOULD provide the failed URI in - this header in the method response */ - apt_str_t failed_uri; - /** When a synthesizer method needs a synthesizer to fetch or access a - URI and the access fails the server MUST provide the URI specific or - protocol specific response code for the URI in the Failed-URI header - in the method response through this header */ - apt_str_t failed_uri_cause; - /** When a CONTROL request to jump backward is issued to a currently - speaking synthesizer resource, and the target jump point is before - the start of the current "SPEAK" request, the current "SPEAK" request - MUST restart */ - apt_bool_t speak_restart; - /** MAY be specified in a CONTROL method to control the - length of speech to speak, relative to the current speaking point in - the currently active "SPEAK" request */ - mrcp_speech_length_value_t speak_length; - /** Used to indicate whether a lexicon has to be loaded or unloaded */ - apt_bool_t load_lexicon; - /** Used to specify a list of active Lexicon URIs and the - search order among the active lexicons */ - apt_str_t lexicon_search_order; -}; - -/** Get synthesizer header vtable */ -const mrcp_header_vtable_t* mrcp_synth_header_vtable_get(mrcp_version_e version); - -/** Get synthesizer completion cause string */ -MRCP_DECLARE(const apt_str_t*) mrcp_synth_completion_cause_get(mrcp_synth_completion_cause_e completion_cause, mrcp_version_e version); - - -APT_END_EXTERN_C - -#endif /* MRCP_SYNTH_HEADER_H */ diff --git a/libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_resource.h b/libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_resource.h deleted file mode 100644 index a03cc53e55..0000000000 --- a/libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_resource.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_synth_resource.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_SYNTH_RESOURCE_H -#define MRCP_SYNTH_RESOURCE_H - -/** - * @file mrcp_synth_resource.h - * @brief MRCP Synthesizer Resource - */ - -#include "mrcp_types.h" - -APT_BEGIN_EXTERN_C - -/** MRCP synthesizer methods */ -typedef enum { - SYNTHESIZER_SET_PARAMS, - SYNTHESIZER_GET_PARAMS, - SYNTHESIZER_SPEAK, - SYNTHESIZER_STOP, - SYNTHESIZER_PAUSE, - SYNTHESIZER_RESUME, - SYNTHESIZER_BARGE_IN_OCCURRED, - SYNTHESIZER_CONTROL, - SYNTHESIZER_DEFINE_LEXICON, - - SYNTHESIZER_METHOD_COUNT -} mrcp_synthesizer_method_id; - -/** MRCP synthesizer events */ -typedef enum { - SYNTHESIZER_SPEECH_MARKER, - SYNTHESIZER_SPEAK_COMPLETE, - - SYNTHESIZER_EVENT_COUNT -} mrcp_synthesizer_event_id; - - -/** Create MRCP synthesizer resource */ -MRCP_DECLARE(mrcp_resource_t*) mrcp_synth_resource_create(apr_pool_t *pool); - -APT_END_EXTERN_C - -#endif /* MRCP_SYNTH_RESOURCE_H */ diff --git a/libs/unimrcp/libs/mrcp/resources/include/mrcp_verifier_header.h b/libs/unimrcp/libs/mrcp/resources/include/mrcp_verifier_header.h deleted file mode 100644 index 7a7e94419a..0000000000 --- a/libs/unimrcp/libs/mrcp/resources/include/mrcp_verifier_header.h +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: - */ - -#ifndef MRCP_VERIFIER_HEADER_H -#define MRCP_VERIFIER_HEADER_H - -/** - * @file mrcp_verifier_header.h - * @brief MRCP Verifier Header - */ - -#include "mrcp_types.h" -#include "mrcp_header_accessor.h" - -APT_BEGIN_EXTERN_C - -/** MRCP verifier header fields */ -typedef enum { - VERIFIER_HEADER_REPOSITORY_URI, - VERIFIER_HEADER_VOICEPRINT_IDENTIFIER, - VERIFIER_HEADER_VERIFICATION_MODE, - VERIFIER_HEADER_ADAPT_MODEL, - VERIFIER_HEADER_ABORT_MODEL, - VERIFIER_HEADER_MIN_VERIFICATION_SCORE, - VERIFIER_HEADER_NUM_MIN_VERIFICATION_PHRASES, - VERIFIER_HEADER_NUM_MAX_VERIFICATION_PHRASES, - VERIFIER_HEADER_NO_INPUT_TIMEOUT, - VERIFIER_HEADER_SAVE_WAVEFORM, - VERIFIER_HEADER_MEDIA_TYPE, - VERIFIER_HEADER_WAVEFORM_URI, - VERIFIER_HEADER_VOICEPRINT_EXISTS, - VERIFIER_HEADER_VER_BUFFER_UTTERANCE, - VERIFIER_HEADER_INPUT_WAVEFORM_URI, - VERIFIER_HEADER_COMPLETION_CAUSE, - VERIFIER_HEADER_COMPLETION_REASON, - VERIFIER_HEADER_SPEECH_COMPLETE_TIMEOUT, - VERIFIER_HEADER_NEW_AUDIO_CHANNEL, - VERIFIER_HEADER_ABORT_VERIFICATION, - VERIFIER_HEADER_START_INPUT_TIMERS, - - VERIFIER_HEADER_COUNT -} mrcp_verifier_header_id; - - -/** MRCP verifier completion-cause */ -typedef enum { - VERIFIER_COMPLETION_CAUSE_SUCCESS = 0, - VERIFIER_COMPLETION_CAUSE_ERROR = 1, - VERIFIER_COMPLETION_CAUSE_NO_INPUT_TIMEOUT = 2, - VERIFIER_COMPLETION_CAUSE_TOO_MUCH_SPEECH_TIMEOUT = 3, - VERIFIER_COMPLETION_CAUSE_SPEECH_TOO_EARLY = 4, - VERIFIER_COMPLETION_CAUSE_BUFFER_EMPTY = 5, - VERIFIER_COMPLETION_CAUSE_OUT_OF_SEQUENCE = 6, - VERIFIER_COMPLETION_CAUSE_REPOSITORY_URI_FAILURE = 7, - VERIFIER_COMPLETION_CAUSE_REPOSITORY_URI_MISSING = 8, - VERIFIER_COMPLETION_CAUSE_VOICEPRINT_ID_MISSING = 9, - VERIFIER_COMPLETION_CAUSE_VOICEPRINT_ID_NOT_EXIST = 10, - VERIFIER_COMPLETION_CAUSE_SPEECH_NOT_USABLE = 11, - - VERIFIER_COMPLETION_CAUSE_COUNT = 12, - VERIFIER_COMPLETION_CAUSE_UNKNOWN = VERIFIER_COMPLETION_CAUSE_COUNT -} mrcp_verifier_completion_cause_e; - - - -/** MRCP verifier-header declaration */ -typedef struct mrcp_verifier_header_t mrcp_verifier_header_t; - -/** MRCP verifier-header */ -struct mrcp_verifier_header_t { - /** Specifies the voiceprint repository to be used or referenced during - speaker verification or identification operations */ - apt_str_t repository_uri; - /** Specifies the claimed identity for verification applications */ - apt_str_t voiceprint_identifier; - /** Specifies the mode of the verification resource */ - apt_str_t verification_mode; - /** Indicates the desired behavior of the verification resource - after a successful verification operation */ - apt_bool_t adapt_model; - /** Indicates the desired behavior of the verification resource - upon session termination */ - apt_bool_t abort_model; - /** Determines the minimum verification score for which a verification - decision of "accepted" may be declared by the server */ - float min_verification_score; - /** Specifies the minimum number of valid utterances - before a positive decision is given for verification */ - apr_size_t num_min_verification_phrases; - /** Specifies the number of valid utterances required - before a decision is forced for verification */ - apr_size_t num_max_verification_phrases; - /** Sets the length of time from the start of the verification timers - (see START-INPUT-TIMERS) until the declaration of a no-input event - in the VERIFICATION-COMPLETE server event message */ - apr_size_t no_input_timeout; - /** Allows the client to request the verification resource to save - the audio stream that was used for verification/identification */ - apt_bool_t save_waveform; - /** Tells the server resource the Media Type of the captured audio or video - such as the one captured and returned by the Waveform-URI header field */ - apt_str_t media_type; - /** If the Save-Waveform header field is set to true, the verification resource - MUST attempt to record the incoming audio stream of the verification into - a file and provide a URI for the client to access it */ - apt_str_t waveform_uri; - /** Shows the status of the voiceprint specified - in the QUERY-VOICEPRINT method */ - apt_bool_t voiceprint_exists; - /** Indicates that this utterance could be - later considered for Speaker Verification */ - apt_bool_t ver_buffer_utterance; - /** Specifies stored audio content that the client requests the server - to fetch and process according to the current verification mode, - either to train the voiceprint or verify a claimed identity */ - apt_str_t input_waveform_uri; - /** Indicates the cause of VERIFY or VERIFY-FROM-BUFFER method completion */ - mrcp_verifier_completion_cause_e completion_cause; - /** MAY be specified in a VERIFICATION-COMPLETE event - coming from the verifier resource to the client */ - apt_str_t completion_reason; - /** Specifies the length of silence required following user - speech before the speech verifier finalizes a result */ - apr_size_t speech_complete_timeout; - /** MAY be specified in a VERIFIER request and allows the - client to tell the server that, from this point on, further input - audio comes from a different audio source */ - apt_bool_t new_audio_channel; - /** MUST be sent in a STOP request to indicate - whether or not to abort a VERIFY method in progress */ - apt_bool_t abort_verification; - /** MAY be sent as part of a VERIFY request. A value of false - tells the verification resource to start the VERIFY operation, - but not to start the no-input timer yet */ - apt_bool_t start_input_timers; -}; - - -/** Get verifier header vtable */ -const mrcp_header_vtable_t* mrcp_verifier_header_vtable_get(mrcp_version_e version); - -/** Get verifier completion cause string */ -MRCP_DECLARE(const apt_str_t*) mrcp_verifier_completion_cause_get(mrcp_verifier_completion_cause_e completion_cause, mrcp_version_e version); - -APT_END_EXTERN_C - -#endif /* MRCP_VERIFIER_HEADER_H */ diff --git a/libs/unimrcp/libs/mrcp/resources/include/mrcp_verifier_resource.h b/libs/unimrcp/libs/mrcp/resources/include/mrcp_verifier_resource.h deleted file mode 100644 index f3022513eb..0000000000 --- a/libs/unimrcp/libs/mrcp/resources/include/mrcp_verifier_resource.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: - */ - -#ifndef MRCP_VERIFIER_RESOURCE_H -#define MRCP_VERIFIER_RESOURCE_H - -/** - * @file mrcp_verifier_resource.h - * @brief MRCP Verifier Resource - */ - -#include "mrcp_types.h" - -APT_BEGIN_EXTERN_C - -/** MRCP verifier methods */ -typedef enum { - VERIFIER_SET_PARAMS, - VERIFIER_GET_PARAMS, - VERIFIER_START_SESSION, - VERIFIER_END_SESSION, - VERIFIER_QUERY_VOICEPRINT, - VERIFIER_DELETE_VOICEPRINT, - VERIFIER_VERIFY, - VERIFIER_VERIFY_FROM_BUFFER, - VERIFIER_VERIFY_ROLLBACK, - VERIFIER_STOP, - VERIFIER_CLEAR_BUFFER, - VERIFIER_START_INPUT_TIMERS, - VERIFIER_GET_INTERMIDIATE_RESULT, - - VERIFIER_METHOD_COUNT -} mrcp_verifier_method_id; - -/** MRCP verifier events */ -typedef enum { - VERIFIER_START_OF_INPUT, - VERIFIER_VERIFICATION_COMPLETE, - - VERIFIER_EVENT_COUNT -} mrcp_verifier_event_id; - -/** Create MRCP verifier resource */ -MRCP_DECLARE(mrcp_resource_t*) mrcp_verifier_resource_create(apr_pool_t *pool); - -APT_END_EXTERN_C - -#endif /* MRCP_VERIFIER_RESOURCE_H */ diff --git a/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_header.c b/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_header.c deleted file mode 100644 index 527476c303..0000000000 --- a/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_header.c +++ /dev/null @@ -1,781 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_recog_header.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mrcp_recog_header.h" - -/** String table of MRCPv1 recognizer header fields (mrcp_recog_header_id) */ -static const apt_str_table_item_t v1_recog_header_string_table[] = { - {{"Confidence-Threshold", 20},16}, - {{"Sensitivity-Level", 17},14}, - {{"Speed-Vs-Accuracy", 17},4}, - {{"N-Best-List-Length", 18},1}, - {{"No-Input-Timeout", 16},2}, - {{"Recognition-Timeout", 19},19}, - {{"Waveform-Url", 12},4}, - {{"Completion-Cause", 16},16}, - {{"Recognizer-Context-Block", 24},16}, - {{"Recognizer-Start-Timers", 23},18}, - {{"Speech-Complete-Timeout", 23},7}, - {{"Speech-Incomplete-Timeout", 25},12}, - {{"DTMF-Interdigit-Timeout", 23},10}, - {{"DTMF-Term-Timeout", 17},14}, - {{"DTMF-Term-Char", 14},14}, - {{"Failed-Uri", 10},10}, - {{"Failed-Uri-Cause", 16},16}, - {{"Save-Waveform", 13},5}, - {{"New-Audio-Channel", 17},17}, - {{"Speech-Language", 15},8}, - {{"Input-Type", 10},10}, - {{"Input-Waveform-Uri", 18},6}, - {{"Completion-Reason", 17},17}, - {{"Media-Type", 10},0}, - {{"Ver-Buffer-Utterance", 20},0}, - {{"Recognition-Mode", 16},16}, - {{"Cancel-If-Queue", 15},3}, - {{"Hotword-Max-Duration", 20},10}, - {{"Hotword-Min-Duration", 20},20}, - {{"Interpret-Text", 14},12}, - {{"DTMF-Buffer-Time", 16},16}, - {{"Clear-DTMF-Buffer", 17},11}, - {{"Early-No-Match", 14},4}, - {{"Num-Min-Consistent-Pronunciations",33},1}, - {{"Consistency-Threshold", 21},16}, - {{"Clash-Threshold", 15},2}, - {{"Personal-Grammar-URI", 20},9}, - {{"Enroll-Utterance", 16},10}, - {{"Phrase-ID", 9},8}, - {{"Phrase-NL", 9},9}, - {{"Weight", 6},3}, - {{"Save-Best-Waveform", 18},10}, - {{"New-Phrase-ID", 13},4}, - {{"Confusable-Phrases-URI", 22},4}, - {{"Abort-Phrase-Enrollment", 23},0} -}; - -/** String table of MRCPv2 recognizer header fields (mrcp_recog_header_id) */ -static const apt_str_table_item_t v2_recog_header_string_table[] = { - {{"Confidence-Threshold", 20},16}, - {{"Sensitivity-Level", 17},14}, - {{"Speed-Vs-Accuracy", 17},4}, - {{"N-Best-List-Length", 18},1}, - {{"No-Input-Timeout", 16},2}, - {{"Recognition-Timeout", 19},19}, - {{"Waveform-Uri", 12},4}, - {{"Completion-Cause", 16},16}, - {{"Recognizer-Context-Block", 24},7}, - {{"Start-Input-Timers", 18},18}, - {{"Speech-Complete-Timeout", 23},7}, - {{"Speech-Incomplete-Timeout", 25},12}, - {{"DTMF-Interdigit-Timeout", 23},10}, - {{"DTMF-Term-Timeout", 17},14}, - {{"DTMF-Term-Char", 14},14}, - {{"Failed-Uri", 10},10}, - {{"Failed-Uri-Cause", 16},16}, - {{"Save-Waveform", 13},5}, - {{"New-Audio-Channel", 17},17}, - {{"Speech-Language", 15},8}, - {{"Input-Type", 10},10}, - {{"Input-Waveform-Uri", 18},6}, - {{"Completion-Reason", 17},13}, - {{"Media-Type", 10},0}, - {{"Ver-Buffer-Utterance", 20},0}, - {{"Recognition-Mode", 16},16}, - {{"Cancel-If-Queue", 15},3}, - {{"Hotword-Max-Duration", 20},10}, - {{"Hotword-Min-Duration", 20},20}, - {{"Interpret-Text", 14},12}, - {{"DTMF-Buffer-Time", 16},16}, - {{"Clear-DTMF-Buffer", 17},11}, - {{"Early-No-Match", 14},4}, - {{"Num-Min-Consistent-Pronunciations",33},1}, - {{"Consistency-Threshold", 21},16}, - {{"Clash-Threshold", 15},15}, - {{"Personal-Grammar-URI", 20},9}, - {{"Enroll-Utterance", 16},10}, - {{"Phrase-ID", 9},8}, - {{"Phrase-NL", 9},9}, - {{"Weight", 6},3}, - {{"Save-Best-Waveform", 18},10}, - {{"New-Phrase-ID", 13},4}, - {{"Confusable-Phrases-URI", 22},4}, - {{"Abort-Phrase-Enrollment", 23},0} -}; - -/** String table of MRCPv1 recognizer completion-cause fields (mrcp_recog_completion_cause_e) */ -static const apt_str_table_item_t v1_completion_cause_string_table[] = { - {{"success", 7},1}, - {{"no-match", 8},8}, - {{"no-input-timeout", 16},3}, - {{"recognition-timeout", 19},0}, - {{"gram-load-failure", 17},7}, - {{"gram-comp-failure", 17},5}, - {{"error", 5},0}, - {{"speech-too-early", 16},1}, - {{"too-much-speech-timeout", 23},0}, - {{"uri-failure", 11},0}, - {{"language-unsupported", 20},0}, - {{"cancelled", 9},0}, - {{"semantics-failure", 17},2}, - {{"partial-match", 13},13}, - {{"partial-match-maxtime", 21},13}, - {{"no-match-maxtime", 16},9}, - {{"gram-definition-failure", 23},5} -}; - - -/** String table of MRCPv2 recognizer completion-cause fields (mrcp_recog_completion_cause_e) */ -static const apt_str_table_item_t v2_completion_cause_string_table[] = { - {{"success", 7},7}, - {{"no-match", 8},4}, - {{"no-input-timeout", 16},3}, - {{"hotword-maxtime", 15},0}, - {{"grammar-load-failure", 20},8}, - {{"grammar-compilation-failure",27},8}, - {{"recognizer-error", 16},0}, - {{"speech-too-early", 16},1}, - {{"success-maxtime", 15},15}, - {{"uri-failure", 11},0}, - {{"language-unsupported", 20},0}, - {{"cancelled", 9},0}, - {{"semantics-failure", 17},2}, - {{"partial-match", 13},13}, - {{"partial-match-maxtime", 21},13}, - {{"no-match-maxtime", 16},9}, - {{"grammar-definition-failure", 26},9} -}; - -/** Initialize recognizer header */ -static void mrcp_recog_header_init(mrcp_recog_header_t *recog_header) -{ - recog_header->confidence_threshold = 0.0; - recog_header->sensitivity_level = 0.0; - recog_header->speed_vs_accuracy = 0.0; - recog_header->n_best_list_length = 0; - recog_header->no_input_timeout = 0; - recog_header->recognition_timeout = 0; - apt_string_reset(&recog_header->waveform_uri); - recog_header->completion_cause = RECOGNIZER_COMPLETION_CAUSE_COUNT; - apt_string_reset(&recog_header->recognizer_context_block); - recog_header->start_input_timers = FALSE; - recog_header->speech_complete_timeout = 0; - recog_header->speech_incomplete_timeout = 0; - recog_header->dtmf_interdigit_timeout = 0; - recog_header->dtmf_term_timeout = 0; - recog_header->dtmf_term_char = 0; - apt_string_reset(&recog_header->failed_uri); - apt_string_reset(&recog_header->failed_uri_cause); - recog_header->save_waveform = FALSE; - recog_header->new_audio_channel = FALSE; - apt_string_reset(&recog_header->speech_language); - /* initializes additionnal MRCPV2 recog header fields */ - apt_string_reset(&recog_header->input_type); - apt_string_reset(&recog_header->input_waveform_uri); - apt_string_reset(&recog_header->completion_reason); - apt_string_reset(&recog_header->media_type); - recog_header->ver_buffer_utterance = FALSE; - apt_string_reset(&recog_header->recognition_mode); - recog_header->cancel_if_queue = FALSE; - recog_header->hotword_max_duration = 0; - recog_header->hotword_min_duration = 0; - apt_string_reset(&recog_header->interpret_text); - recog_header->dtmf_buffer_time = 0; - recog_header->clear_dtmf_buffer = FALSE; - recog_header->early_no_match = FALSE; - recog_header->num_min_consistent_pronunciations = 0; - recog_header->consistency_threshold = 0.0; - recog_header->clash_threshold = 0.0; - apt_string_reset(&recog_header->personal_grammar_uri); - recog_header->enroll_utterance = FALSE; - apt_string_reset(&recog_header->phrase_id); - apt_string_reset(&recog_header->phrase_nl); - recog_header->weight = 0.0; - recog_header->save_best_waveform = FALSE; - apt_string_reset(&recog_header->new_phrase_id); - apt_string_reset(&recog_header->confusable_phrases_uri); - recog_header->abort_phrase_enrollment = FALSE; -} - -/** Allocate MRCP recognizer header */ -static void* mrcp_recog_header_allocate(mrcp_header_accessor_t *accessor, apr_pool_t *pool) -{ - mrcp_recog_header_t *recog_header = apr_palloc(pool,sizeof(mrcp_recog_header_t)); - mrcp_recog_header_init(recog_header); - accessor->data = recog_header; - return accessor->data; -} - -/** Parse MRCP recognizer header */ -static apt_bool_t mrcp_recog_header_parse(mrcp_recog_header_t *recog_header, apr_size_t id, const apt_str_t *value, apr_pool_t *pool) -{ - apt_bool_t status = TRUE; - switch(id) { - case RECOGNIZER_HEADER_N_BEST_LIST_LENGTH: - recog_header->n_best_list_length = apt_size_value_parse(value); - break; - case RECOGNIZER_HEADER_NO_INPUT_TIMEOUT: - recog_header->no_input_timeout = apt_size_value_parse(value); - break; - case RECOGNIZER_HEADER_RECOGNITION_TIMEOUT: - recog_header->recognition_timeout = apt_size_value_parse(value); - break; - case RECOGNIZER_HEADER_WAVEFORM_URI: - recog_header->waveform_uri = *value; - break; - case RECOGNIZER_HEADER_COMPLETION_CAUSE: - recog_header->completion_cause = apt_size_value_parse(value); - break; - case RECOGNIZER_HEADER_RECOGNIZER_CONTEXT_BLOCK: - recog_header->recognizer_context_block = *value; - break; - case RECOGNIZER_HEADER_START_INPUT_TIMERS: - apt_boolean_value_parse(value,&recog_header->start_input_timers); - break; - case RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT: - recog_header->speech_complete_timeout = apt_size_value_parse(value); - break; - case RECOGNIZER_HEADER_SPEECH_INCOMPLETE_TIMEOUT: - recog_header->speech_incomplete_timeout = apt_size_value_parse(value); - break; - case RECOGNIZER_HEADER_DTMF_INTERDIGIT_TIMEOUT: - recog_header->dtmf_interdigit_timeout = apt_size_value_parse(value); - break; - case RECOGNIZER_HEADER_DTMF_TERM_TIMEOUT: - recog_header->dtmf_term_timeout = apt_size_value_parse(value); - break; - case RECOGNIZER_HEADER_DTMF_TERM_CHAR: - recog_header->dtmf_term_char = *value->buf; - break; - case RECOGNIZER_HEADER_FAILED_URI: - recog_header->failed_uri = *value; - break; - case RECOGNIZER_HEADER_FAILED_URI_CAUSE: - recog_header->failed_uri_cause = *value; - break; - case RECOGNIZER_HEADER_SAVE_WAVEFORM: - apt_boolean_value_parse(value,&recog_header->save_waveform); - break; - case RECOGNIZER_HEADER_NEW_AUDIO_CHANNEL: - apt_boolean_value_parse(value,&recog_header->new_audio_channel); - break; - case RECOGNIZER_HEADER_SPEECH_LANGUAGE: - recog_header->speech_language = *value; - break; - case RECOGNIZER_HEADER_INPUT_TYPE: - recog_header->input_type = *value; - break; - case RECOGNIZER_HEADER_MEDIA_TYPE: - recog_header->media_type = *value; - break; - case RECOGNIZER_HEADER_INPUT_WAVEFORM_URI: - recog_header->input_waveform_uri = *value; - break; - case RECOGNIZER_HEADER_COMPLETION_REASON: - recog_header->completion_reason = *value; - break; - case RECOGNIZER_HEADER_VER_BUFFER_UTTERANCE: - apt_boolean_value_parse(value,&recog_header->ver_buffer_utterance); - break; - case RECOGNIZER_HEADER_RECOGNITION_MODE: - recog_header->recognition_mode = *value; - break; - case RECOGNIZER_HEADER_CANCEL_IF_QUEUE: - apt_boolean_value_parse(value,&recog_header->cancel_if_queue); - break; - case RECOGNIZER_HEADER_HOTWORD_MAX_DURATION: - recog_header->hotword_max_duration = apt_size_value_parse(value); - break; - case RECOGNIZER_HEADER_HOTWORD_MIN_DURATION: - recog_header->hotword_min_duration = apt_size_value_parse(value); - break; - case RECOGNIZER_HEADER_INTERPRET_TEXT: - recog_header->interpret_text = *value; - break; - case RECOGNIZER_HEADER_DTMF_BUFFER_TIME: - recog_header->dtmf_buffer_time = apt_size_value_parse(value); - break; - case RECOGNIZER_HEADER_CLEAR_DTMF_BUFFER: - apt_boolean_value_parse(value,&recog_header->clear_dtmf_buffer); - break; - case RECOGNIZER_HEADER_EARLY_NO_MATCH: - apt_boolean_value_parse(value,&recog_header->early_no_match); - break; - case RECOGNIZER_HEADER_NUM_MIN_CONSISTENT_PRONUNCIATIONS: - recog_header->num_min_consistent_pronunciations = apt_size_value_parse(value); - break; - case RECOGNIZER_HEADER_CONSISTENCY_THRESHOLD: - recog_header->consistency_threshold = apt_float_value_parse(value); - break; - case RECOGNIZER_HEADER_CLASH_THRESHOLD: - recog_header->clash_threshold = apt_float_value_parse(value); - break; - case RECOGNIZER_HEADER_PERSONAL_GRAMMAR_URI: - recog_header->personal_grammar_uri = *value; - break; - case RECOGNIZER_HEADER_ENROLL_UTTERANCE: - apt_boolean_value_parse(value,&recog_header->enroll_utterance); - break; - case RECOGNIZER_HEADER_PHRASE_ID: - recog_header->phrase_id = *value; - break; - case RECOGNIZER_HEADER_PHRASE_NL: - recog_header->phrase_nl = *value; - break; - case RECOGNIZER_HEADER_WEIGHT: - recog_header->weight = apt_float_value_parse(value); - break; - case RECOGNIZER_HEADER_SAVE_BEST_WAVEFORM: - apt_boolean_value_parse(value,&recog_header->save_best_waveform); - break; - case RECOGNIZER_HEADER_NEW_PHRASE_ID: - recog_header->new_phrase_id = *value; - break; - case RECOGNIZER_HEADER_CONFUSABLE_PHRASES_URI: - recog_header->confusable_phrases_uri = *value; - break; - case RECOGNIZER_HEADER_ABORT_PHRASE_ENROLLMENT: - apt_boolean_value_parse(value,&recog_header->abort_phrase_enrollment); - break; - default: - status = FALSE; - } - return status; -} - -static APR_INLINE float apt_size_value_parse_as_float(const apt_str_t *value) -{ - float f = (float)apt_size_value_parse(value); - return f / 100; -} - -static APR_INLINE apt_bool_t apt_size_value_generate_from_float(float value, apt_str_t *str, apr_pool_t *pool) -{ - apr_size_t s = (apr_size_t)((value + 0.001f) * 100); - return apt_size_value_generate(s,str,pool); -} - -/** Parse MRCPv1 recognizer header */ -static apt_bool_t mrcp_v1_recog_header_parse(mrcp_header_accessor_t *accessor, apr_size_t id, const apt_str_t *value, apr_pool_t *pool) -{ - mrcp_recog_header_t *recog_header = accessor->data; - if(id == RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD) { - recog_header->confidence_threshold = apt_size_value_parse_as_float(value); - return TRUE; - } - else if(id == RECOGNIZER_HEADER_SENSITIVITY_LEVEL) { - recog_header->sensitivity_level = apt_size_value_parse_as_float(value); - return TRUE; - } - else if(id == RECOGNIZER_HEADER_SPEED_VS_ACCURACY) { - recog_header->speed_vs_accuracy = apt_size_value_parse_as_float(value); - return TRUE; - } - return mrcp_recog_header_parse(recog_header,id,value,pool); -} - -/** Parse MRCPv2 recognizer header */ -static apt_bool_t mrcp_v2_recog_header_parse(mrcp_header_accessor_t *accessor, apr_size_t id, const apt_str_t *value, apr_pool_t *pool) -{ - mrcp_recog_header_t *recog_header = accessor->data; - if(id == RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD) { - recog_header->confidence_threshold = apt_float_value_parse(value); - return TRUE; - } - else if(id == RECOGNIZER_HEADER_SENSITIVITY_LEVEL) { - recog_header->sensitivity_level = apt_float_value_parse(value); - return TRUE; - } - else if(id == RECOGNIZER_HEADER_SPEED_VS_ACCURACY) { - recog_header->speed_vs_accuracy = apt_float_value_parse(value); - return TRUE; - } - return mrcp_recog_header_parse(recog_header,id,value,pool); -} - -/** Generate MRCP recognizer header */ -static apt_bool_t mrcp_recog_header_generate(const mrcp_recog_header_t *recog_header, apr_size_t id, apt_str_t *value, apr_pool_t *pool) -{ - switch(id) { - case RECOGNIZER_HEADER_N_BEST_LIST_LENGTH: - apt_size_value_generate(recog_header->n_best_list_length,value,pool); - break; - case RECOGNIZER_HEADER_NO_INPUT_TIMEOUT: - apt_size_value_generate(recog_header->no_input_timeout,value,pool); - break; - case RECOGNIZER_HEADER_RECOGNITION_TIMEOUT: - apt_size_value_generate(recog_header->recognition_timeout,value,pool); - break; - case RECOGNIZER_HEADER_WAVEFORM_URI: - *value = recog_header->waveform_uri; - break; - case RECOGNIZER_HEADER_RECOGNIZER_CONTEXT_BLOCK: - *value = recog_header->recognizer_context_block; - break; - case RECOGNIZER_HEADER_START_INPUT_TIMERS: - apt_boolean_value_generate(recog_header->start_input_timers,value,pool); - break; - case RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT: - apt_size_value_generate(recog_header->speech_complete_timeout,value,pool); - break; - case RECOGNIZER_HEADER_SPEECH_INCOMPLETE_TIMEOUT: - apt_size_value_generate(recog_header->speech_incomplete_timeout,value,pool); - break; - case RECOGNIZER_HEADER_DTMF_INTERDIGIT_TIMEOUT: - apt_size_value_generate(recog_header->dtmf_interdigit_timeout,value,pool); - break; - case RECOGNIZER_HEADER_DTMF_TERM_TIMEOUT: - apt_size_value_generate(recog_header->dtmf_term_timeout,value,pool); - break; - case RECOGNIZER_HEADER_DTMF_TERM_CHAR: - value->length = 1; - value->buf = apr_palloc(pool,value->length); - *value->buf = recog_header->dtmf_term_char; - break; - case RECOGNIZER_HEADER_FAILED_URI: - *value = recog_header->failed_uri; - break; - case RECOGNIZER_HEADER_FAILED_URI_CAUSE: - *value = recog_header->failed_uri_cause; - break; - case RECOGNIZER_HEADER_SAVE_WAVEFORM: - apt_boolean_value_generate(recog_header->save_waveform,value,pool); - break; - case RECOGNIZER_HEADER_NEW_AUDIO_CHANNEL: - apt_boolean_value_generate(recog_header->new_audio_channel,value,pool); - break; - case RECOGNIZER_HEADER_SPEECH_LANGUAGE: - *value = recog_header->speech_language; - break; - case RECOGNIZER_HEADER_INPUT_TYPE: - *value = recog_header->input_type; - break; - case RECOGNIZER_HEADER_INPUT_WAVEFORM_URI: - *value = recog_header->input_waveform_uri; - break; - case RECOGNIZER_HEADER_COMPLETION_REASON: - *value = recog_header->completion_reason; - break; - case RECOGNIZER_HEADER_MEDIA_TYPE: - *value = recog_header->media_type; - break; - case RECOGNIZER_HEADER_VER_BUFFER_UTTERANCE: - apt_boolean_value_generate(recog_header->ver_buffer_utterance,value,pool); - break; - case RECOGNIZER_HEADER_RECOGNITION_MODE: - *value = recog_header->recognition_mode; - break; - case RECOGNIZER_HEADER_CANCEL_IF_QUEUE: - apt_boolean_value_generate(recog_header->cancel_if_queue,value,pool); - break; - case RECOGNIZER_HEADER_HOTWORD_MAX_DURATION: - apt_size_value_generate(recog_header->hotword_max_duration,value,pool); - break; - case RECOGNIZER_HEADER_HOTWORD_MIN_DURATION: - apt_size_value_generate(recog_header->hotword_min_duration,value,pool); - break; - case RECOGNIZER_HEADER_INTERPRET_TEXT: - *value = recog_header->interpret_text; - break; - case RECOGNIZER_HEADER_DTMF_BUFFER_TIME: - apt_size_value_generate(recog_header->dtmf_buffer_time,value,pool); - break; - case RECOGNIZER_HEADER_CLEAR_DTMF_BUFFER: - apt_boolean_value_generate(recog_header->clear_dtmf_buffer,value,pool); - break; - case RECOGNIZER_HEADER_EARLY_NO_MATCH: - apt_boolean_value_generate(recog_header->early_no_match,value,pool); - break; - case RECOGNIZER_HEADER_NUM_MIN_CONSISTENT_PRONUNCIATIONS: - apt_size_value_generate(recog_header->num_min_consistent_pronunciations,value,pool); - break; - case RECOGNIZER_HEADER_CONSISTENCY_THRESHOLD: - apt_float_value_generate(recog_header->consistency_threshold,value,pool); - break; - case RECOGNIZER_HEADER_CLASH_THRESHOLD: - apt_float_value_generate(recog_header->clash_threshold,value,pool); - break; - case RECOGNIZER_HEADER_PERSONAL_GRAMMAR_URI: - *value = recog_header->personal_grammar_uri; - break; - case RECOGNIZER_HEADER_ENROLL_UTTERANCE: - apt_boolean_value_generate(recog_header->enroll_utterance,value,pool); - break; - case RECOGNIZER_HEADER_PHRASE_ID: - *value = recog_header->phrase_id; - break; - case RECOGNIZER_HEADER_PHRASE_NL: - *value = recog_header->phrase_nl; - break; - case RECOGNIZER_HEADER_WEIGHT: - apt_float_value_generate(recog_header->weight,value,pool); - break; - case RECOGNIZER_HEADER_SAVE_BEST_WAVEFORM: - apt_boolean_value_generate(recog_header->save_best_waveform,value,pool); - break; - case RECOGNIZER_HEADER_NEW_PHRASE_ID: - *value = recog_header->new_phrase_id; - break; - case RECOGNIZER_HEADER_CONFUSABLE_PHRASES_URI: - *value = recog_header->confusable_phrases_uri; - break; - case RECOGNIZER_HEADER_ABORT_PHRASE_ENROLLMENT: - apt_boolean_value_generate(recog_header->abort_phrase_enrollment,value,pool); - break; - default: - break; - } - return TRUE; -} - -/** Generate MRCPv1 recognizer header */ -static apt_bool_t mrcp_v1_recog_header_generate(const mrcp_header_accessor_t *accessor, apr_size_t id, apt_str_t *value, apr_pool_t *pool) -{ - mrcp_recog_header_t *recog_header = accessor->data; - if(id == RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD) { - return apt_size_value_generate_from_float(recog_header->confidence_threshold,value,pool); - } - else if(id == RECOGNIZER_HEADER_SENSITIVITY_LEVEL) { - return apt_size_value_generate_from_float(recog_header->sensitivity_level,value,pool); - } - else if(id == RECOGNIZER_HEADER_SPEED_VS_ACCURACY) { - return apt_size_value_generate_from_float(recog_header->speed_vs_accuracy,value,pool); - } - else if(id == RECOGNIZER_HEADER_COMPLETION_CAUSE) { - return apt_completion_cause_generate( - v1_completion_cause_string_table, - RECOGNIZER_COMPLETION_CAUSE_COUNT, - recog_header->completion_cause, - value, - pool); - } - return mrcp_recog_header_generate(recog_header,id,value,pool); -} - -/** Generate MRCPv2 recognizer header */ -static apt_bool_t mrcp_v2_recog_header_generate(const mrcp_header_accessor_t *accessor, apr_size_t id, apt_str_t *value, apr_pool_t *pool) -{ - mrcp_recog_header_t *recog_header = accessor->data; - if(id == RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD) { - return apt_float_value_generate(recog_header->confidence_threshold,value,pool); - } - else if(id == RECOGNIZER_HEADER_SENSITIVITY_LEVEL) { - return apt_float_value_generate(recog_header->sensitivity_level,value,pool); - } - else if(id == RECOGNIZER_HEADER_SPEED_VS_ACCURACY) { - return apt_float_value_generate(recog_header->speed_vs_accuracy,value,pool); - } - else if(id == RECOGNIZER_HEADER_COMPLETION_CAUSE) { - return apt_completion_cause_generate( - v2_completion_cause_string_table, - RECOGNIZER_COMPLETION_CAUSE_COUNT, - recog_header->completion_cause, - value, - pool); - } - return mrcp_recog_header_generate(recog_header,id,value,pool); -} - -/** Duplicate MRCP recognizer header */ -static apt_bool_t mrcp_recog_header_duplicate(mrcp_header_accessor_t *accessor, const mrcp_header_accessor_t *src, apr_size_t id, const apt_str_t *value, apr_pool_t *pool) -{ - mrcp_recog_header_t *recog_header = accessor->data; - const mrcp_recog_header_t *src_recog_header = src->data; - apt_bool_t status = TRUE; - - if(!recog_header || !src_recog_header) { - return FALSE; - } - - switch(id) { - case RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD: - recog_header->confidence_threshold = src_recog_header->confidence_threshold; - break; - case RECOGNIZER_HEADER_SENSITIVITY_LEVEL: - recog_header->sensitivity_level = src_recog_header->sensitivity_level; - break; - case RECOGNIZER_HEADER_SPEED_VS_ACCURACY: - recog_header->speed_vs_accuracy = src_recog_header->speed_vs_accuracy; - break; - case RECOGNIZER_HEADER_N_BEST_LIST_LENGTH: - recog_header->n_best_list_length = src_recog_header->n_best_list_length; - break; - case RECOGNIZER_HEADER_NO_INPUT_TIMEOUT: - recog_header->no_input_timeout = src_recog_header->no_input_timeout; - break; - case RECOGNIZER_HEADER_RECOGNITION_TIMEOUT: - recog_header->recognition_timeout = src_recog_header->recognition_timeout; - break; - case RECOGNIZER_HEADER_WAVEFORM_URI: - recog_header->waveform_uri = *value; - break; - case RECOGNIZER_HEADER_COMPLETION_CAUSE: - recog_header->completion_cause = src_recog_header->completion_cause; - break; - case RECOGNIZER_HEADER_RECOGNIZER_CONTEXT_BLOCK: - recog_header->recognizer_context_block = *value; - break; - case RECOGNIZER_HEADER_START_INPUT_TIMERS: - recog_header->start_input_timers = src_recog_header->start_input_timers; - break; - case RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT: - recog_header->speech_complete_timeout = src_recog_header->speech_complete_timeout; - break; - case RECOGNIZER_HEADER_SPEECH_INCOMPLETE_TIMEOUT: - recog_header->speech_incomplete_timeout = src_recog_header->speech_incomplete_timeout; - break; - case RECOGNIZER_HEADER_DTMF_INTERDIGIT_TIMEOUT: - recog_header->dtmf_interdigit_timeout = src_recog_header->dtmf_interdigit_timeout; - break; - case RECOGNIZER_HEADER_DTMF_TERM_TIMEOUT: - recog_header->dtmf_term_timeout = src_recog_header->dtmf_term_timeout; - break; - case RECOGNIZER_HEADER_DTMF_TERM_CHAR: - recog_header->dtmf_term_char = src_recog_header->dtmf_term_char; - break; - case RECOGNIZER_HEADER_FAILED_URI: - recog_header->failed_uri = *value; - break; - case RECOGNIZER_HEADER_FAILED_URI_CAUSE: - recog_header->failed_uri_cause = *value; - break; - case RECOGNIZER_HEADER_SAVE_WAVEFORM: - recog_header->save_waveform = src_recog_header->save_waveform; - break; - case RECOGNIZER_HEADER_NEW_AUDIO_CHANNEL: - recog_header->new_audio_channel = src_recog_header->new_audio_channel; - break; - case RECOGNIZER_HEADER_SPEECH_LANGUAGE: - recog_header->speech_language = *value; - break; - case RECOGNIZER_HEADER_INPUT_TYPE: - recog_header->input_type = *value; - break; - case RECOGNIZER_HEADER_INPUT_WAVEFORM_URI: - recog_header->input_waveform_uri = *value; - break; - case RECOGNIZER_HEADER_COMPLETION_REASON: - recog_header->completion_reason = *value; - break; - case RECOGNIZER_HEADER_MEDIA_TYPE: - recog_header->media_type = *value; - break; - case RECOGNIZER_HEADER_VER_BUFFER_UTTERANCE: - recog_header->ver_buffer_utterance = src_recog_header->ver_buffer_utterance; - break; - case RECOGNIZER_HEADER_RECOGNITION_MODE: - recog_header->recognition_mode = *value; - break; - case RECOGNIZER_HEADER_CANCEL_IF_QUEUE: - recog_header->cancel_if_queue = src_recog_header->cancel_if_queue; - break; - case RECOGNIZER_HEADER_HOTWORD_MAX_DURATION: - recog_header->hotword_max_duration = src_recog_header->hotword_max_duration; - break; - case RECOGNIZER_HEADER_HOTWORD_MIN_DURATION: - recog_header->hotword_min_duration = src_recog_header->hotword_min_duration; - break; - case RECOGNIZER_HEADER_INTERPRET_TEXT: - recog_header->interpret_text = *value; - break; - case RECOGNIZER_HEADER_DTMF_BUFFER_TIME: - recog_header->dtmf_buffer_time = src_recog_header->dtmf_buffer_time; - break; - case RECOGNIZER_HEADER_CLEAR_DTMF_BUFFER: - recog_header->clear_dtmf_buffer = src_recog_header->clear_dtmf_buffer; - break; - case RECOGNIZER_HEADER_EARLY_NO_MATCH: - recog_header->early_no_match = src_recog_header->early_no_match; - break; - case RECOGNIZER_HEADER_NUM_MIN_CONSISTENT_PRONUNCIATIONS: - recog_header->num_min_consistent_pronunciations = src_recog_header->num_min_consistent_pronunciations; - break; - case RECOGNIZER_HEADER_CONSISTENCY_THRESHOLD: - recog_header->consistency_threshold = src_recog_header->consistency_threshold; - break; - case RECOGNIZER_HEADER_CLASH_THRESHOLD: - recog_header->clash_threshold = src_recog_header->clash_threshold; - break; - case RECOGNIZER_HEADER_PERSONAL_GRAMMAR_URI: - recog_header->personal_grammar_uri = *value; - break; - case RECOGNIZER_HEADER_ENROLL_UTTERANCE: - recog_header->enroll_utterance = src_recog_header->enroll_utterance; - break; - case RECOGNIZER_HEADER_PHRASE_ID: - recog_header->phrase_id = *value; - break; - case RECOGNIZER_HEADER_PHRASE_NL: - recog_header->phrase_nl = *value; - break; - case RECOGNIZER_HEADER_WEIGHT: - recog_header->weight = src_recog_header->weight; - break; - case RECOGNIZER_HEADER_SAVE_BEST_WAVEFORM: - recog_header->save_best_waveform = src_recog_header->save_best_waveform; - break; - case RECOGNIZER_HEADER_NEW_PHRASE_ID: - recog_header->new_phrase_id = *value; - break; - case RECOGNIZER_HEADER_CONFUSABLE_PHRASES_URI: - recog_header->confusable_phrases_uri = *value; - break; - case RECOGNIZER_HEADER_ABORT_PHRASE_ENROLLMENT: - recog_header->abort_phrase_enrollment = src_recog_header->abort_phrase_enrollment; - break; - default: - status = FALSE; - } - return status; -} - -static const mrcp_header_vtable_t v1_vtable = { - mrcp_recog_header_allocate, - NULL, /* nothing to destroy */ - mrcp_v1_recog_header_parse, - mrcp_v1_recog_header_generate, - mrcp_recog_header_duplicate, - v1_recog_header_string_table, - RECOGNIZER_HEADER_COUNT -}; - -static const mrcp_header_vtable_t v2_vtable = { - mrcp_recog_header_allocate, - NULL, /* nothing to destroy */ - mrcp_v2_recog_header_parse, - mrcp_v2_recog_header_generate, - mrcp_recog_header_duplicate, - v2_recog_header_string_table, - RECOGNIZER_HEADER_COUNT -}; - -const mrcp_header_vtable_t* mrcp_recog_header_vtable_get(mrcp_version_e version) -{ - if(version == MRCP_VERSION_1) { - return &v1_vtable; - } - return &v2_vtable; -} - -MRCP_DECLARE(const apt_str_t*) mrcp_recog_completion_cause_get(mrcp_recog_completion_cause_e completion_cause, mrcp_version_e version) -{ - const apt_str_table_item_t *table = v2_completion_cause_string_table; - if(version == MRCP_VERSION_1) { - table = v1_completion_cause_string_table; - } - - return apt_string_table_str_get(table,RECOGNIZER_COMPLETION_CAUSE_COUNT,completion_cause); -} diff --git a/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_resource.c b/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_resource.c deleted file mode 100644 index 83a1a4e83e..0000000000 --- a/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_resource.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_recog_resource.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mrcp_recog_resource.h" -#include "mrcp_recog_header.h" -#include "mrcp_resource.h" - -/** String table of MRCP recognizer methods (mrcp_recognizer_method_id) */ -static const apt_str_table_item_t v1_recog_method_string_table[] = { - {{"SET-PARAMS", 10},10}, - {{"GET-PARAMS", 10},10}, - {{"DEFINE-GRAMMAR", 14},2}, - {{"RECOGNIZE", 9},7}, - {{"INTERPRET", 9},0}, - {{"GET-RESULT", 10},6}, - {{"RECOGNITION-START-TIMERS", 24},7}, - {{"STOP", 4},2}, - {{"START-PHRASE-ENROLLMENT", 23},2}, - {{"ENROLLMENT-ROLLBACK", 19},2}, - {{"END-PHRASE-ENROLLMENT", 21},5}, - {{"MODIFY-PHRASE", 13},0}, - {{"DELETE-PHRASE", 13},2} -}; - -/** String table of MRCPv2 recognizer methods (mrcp_recognizer_method_id) */ -static const apt_str_table_item_t v2_recog_method_string_table[] = { - {{"SET-PARAMS", 10},10}, - {{"GET-PARAMS", 10},10}, - {{"DEFINE-GRAMMAR", 14},2}, - {{"RECOGNIZE", 9},0}, - {{"INTERPRET", 9},0}, - {{"GET-RESULT", 10},6}, - {{"START-INPUT-TIMERS", 18},7}, - {{"STOP", 4},2}, - {{"START-PHRASE-ENROLLMENT", 23},6}, - {{"ENROLLMENT-ROLLBACK", 19},2}, - {{"END-PHRASE-ENROLLMENT", 21},5}, - {{"MODIFY-PHRASE", 13},0}, - {{"DELETE-PHRASE", 13},2} -}; - -/** String table of MRCP recognizer events (mrcp_recognizer_event_id) */ -static const apt_str_table_item_t v1_recog_event_string_table[] = { - {{"START-OF-SPEECH", 15},0}, - {{"RECOGNITION-COMPLETE", 20},0}, - {{"INTERPRETATION-COMPLETE", 23},0} -}; - -/** String table of MRCPv2 recognizer events (mrcp_recognizer_event_id) */ -static const apt_str_table_item_t v2_recog_event_string_table[] = { - {{"START-OF-INPUT", 14},0}, - {{"RECOGNITION-COMPLETE", 20},0}, - {{"INTERPRETATION-COMPLETE", 23},0} -}; - - -static APR_INLINE const apt_str_table_item_t* recog_method_string_table_get(mrcp_version_e version) -{ - if(version == MRCP_VERSION_1) { - return v1_recog_method_string_table; - } - return v2_recog_method_string_table; -} - -static APR_INLINE const apt_str_table_item_t* recog_event_string_table_get(mrcp_version_e version) -{ - if(version == MRCP_VERSION_1) { - return v1_recog_event_string_table; - } - return v2_recog_event_string_table; -} - -/** Create MRCP recognizer resource */ -MRCP_DECLARE(mrcp_resource_t*) mrcp_recog_resource_create(apr_pool_t *pool) -{ - mrcp_resource_t *resource = mrcp_resource_create(pool); - - resource->method_count = RECOGNIZER_METHOD_COUNT; - resource->event_count = RECOGNIZER_EVENT_COUNT; - resource->get_method_str_table = recog_method_string_table_get; - resource->get_event_str_table = recog_event_string_table_get; - resource->get_resource_header_vtable = mrcp_recog_header_vtable_get; - return resource; -} diff --git a/libs/unimrcp/libs/mrcp/resources/src/mrcp_recorder_header.c b/libs/unimrcp/libs/mrcp/resources/src/mrcp_recorder_header.c deleted file mode 100644 index 85f619524a..0000000000 --- a/libs/unimrcp/libs/mrcp/resources/src/mrcp_recorder_header.c +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_recorder_header.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mrcp_recorder_header.h" - -/** String table of recorder header fields (mrcp_recorder_header_id) */ -static const apt_str_table_item_t recorder_header_string_table[] = { - {{"Sensitivity-Level", 17},3}, - {{"No-Input-Timeout", 16},2}, - {{"Completion-Cause", 16},16}, - {{"Completion-Reason", 17},11}, - {{"Failed-Uri", 10},10}, - {{"Failed-Uri-Cause", 16},16}, - {{"Record-Uri", 10},0}, - {{"Media-Type", 10},2}, - {{"Max-Time", 8},2}, - {{"Trim-Length", 11},0}, - {{"Final-Silence", 13},1}, - {{"Capture-On-Speech", 17},2}, - {{"Ver-Buffer-Utterance", 20},0}, - {{"Start-Input-Timers", 18},1}, - {{"New-Audio-Channel", 17},2} -}; - -/** String table of recorder completion-cause fields (mrcp_recorder_completion_cause_e) */ -static const apt_str_table_item_t completion_cause_string_table[] = { - {{"success-silence", 15},8}, - {{"success-maxtime", 15},8}, - {{"no-input-timeout", 16},0}, - {{"uri-failure", 11},0}, - {{"error", 5},0} -}; - - -/** Initialize recorder header */ -static void mrcp_recorder_header_init(mrcp_recorder_header_t *recorder_header) -{ - recorder_header->sensitivity_level = 0.0; - recorder_header->no_input_timeout = 0; - recorder_header->completion_cause = RECORDER_COMPLETION_CAUSE_COUNT; - apt_string_reset(&recorder_header->completion_reason); - apt_string_reset(&recorder_header->failed_uri); - apt_string_reset(&recorder_header->failed_uri_cause); - apt_string_reset(&recorder_header->record_uri); - apt_string_reset(&recorder_header->media_type); - recorder_header->max_time = 0; - recorder_header->trim_length = 0; - recorder_header->final_silence = 0; - recorder_header->capture_on_speech = FALSE; - recorder_header->ver_buffer_utterance = FALSE; - recorder_header->start_input_timers = FALSE; - recorder_header->new_audio_channel = FALSE; -} - -/** Allocate MRCP recorder header */ -static void* mrcp_recorder_header_allocate(mrcp_header_accessor_t *accessor, apr_pool_t *pool) -{ - mrcp_recorder_header_t *recorder_header = apr_palloc(pool,sizeof(mrcp_recorder_header_t)); - mrcp_recorder_header_init(recorder_header); - accessor->data = recorder_header; - return accessor->data; -} - -/** Parse MRCP recorder header */ -static apt_bool_t mrcp_recorder_header_parse(mrcp_header_accessor_t *accessor, apr_size_t id, const apt_str_t *value, apr_pool_t *pool) -{ - apt_bool_t status = TRUE; - mrcp_recorder_header_t *recorder_header = accessor->data; - switch(id) { - case RECORDER_HEADER_SENSITIVITY_LEVEL: - recorder_header->sensitivity_level = apt_float_value_parse(value); - break; - case RECORDER_HEADER_NO_INPUT_TIMEOUT: - recorder_header->no_input_timeout = apt_size_value_parse(value); - break; - case RECORDER_HEADER_COMPLETION_CAUSE: - recorder_header->completion_cause = apt_size_value_parse(value); - break; - case RECORDER_HEADER_COMPLETION_REASON: - recorder_header->completion_reason = *value; - break; - case RECORDER_HEADER_FAILED_URI: - recorder_header->failed_uri = *value; - break; - case RECORDER_HEADER_FAILED_URI_CAUSE: - recorder_header->failed_uri_cause = *value; - break; - case RECORDER_HEADER_RECORD_URI: - recorder_header->record_uri = *value; - break; - case RECORDER_HEADER_MEDIA_TYPE: - recorder_header->media_type = *value; - break; - case RECORDER_HEADER_MAX_TIME: - recorder_header->max_time = apt_size_value_parse(value); - break; - case RECORDER_HEADER_TRIM_LENGTH: - recorder_header->trim_length = apt_size_value_parse(value); - break; - case RECORDER_HEADER_FINAL_SILENCE: - recorder_header->final_silence = apt_size_value_parse(value); - break; - case RECORDER_HEADER_CAPTURE_ON_SPEECH: - apt_boolean_value_parse(value,&recorder_header->capture_on_speech); - break; - case RECORDER_HEADER_VER_BUFFER_UTTERANCE: - apt_boolean_value_parse(value,&recorder_header->ver_buffer_utterance); - break; - case RECORDER_HEADER_START_INPUT_TIMERS: - apt_boolean_value_parse(value,&recorder_header->start_input_timers); - break; - case RECORDER_HEADER_NEW_AUDIO_CHANNEL: - apt_boolean_value_parse(value,&recorder_header->new_audio_channel); - break; - default: - status = FALSE; - } - return status; -} - -/** Generate MRCP recorder header */ -static apt_bool_t mrcp_recorder_header_generate(const mrcp_header_accessor_t *accessor, apr_size_t id, apt_str_t *value, apr_pool_t *pool) -{ - mrcp_recorder_header_t *recorder_header = accessor->data; - switch(id) { - case RECORDER_HEADER_SENSITIVITY_LEVEL: - apt_float_value_generate(recorder_header->sensitivity_level,value,pool); - break; - case RECORDER_HEADER_NO_INPUT_TIMEOUT: - apt_size_value_generate(recorder_header->no_input_timeout,value,pool); - break; - case RECORDER_HEADER_COMPLETION_CAUSE: - { - apt_completion_cause_generate( - completion_cause_string_table, - RECORDER_COMPLETION_CAUSE_COUNT, - recorder_header->completion_cause, - value, - pool); - break; - } - case RECORDER_HEADER_COMPLETION_REASON: - *value = recorder_header->completion_reason; - break; - case RECORDER_HEADER_FAILED_URI: - *value = recorder_header->failed_uri; - break; - case RECORDER_HEADER_FAILED_URI_CAUSE: - *value = recorder_header->failed_uri_cause; - break; - case RECORDER_HEADER_RECORD_URI: - *value = recorder_header->record_uri; - break; - case RECORDER_HEADER_MEDIA_TYPE: - *value = recorder_header->media_type; - break; - case RECORDER_HEADER_MAX_TIME: - apt_size_value_generate(recorder_header->max_time,value,pool); - break; - case RECORDER_HEADER_TRIM_LENGTH: - apt_size_value_generate(recorder_header->trim_length,value,pool); - break; - case RECORDER_HEADER_FINAL_SILENCE: - apt_size_value_generate(recorder_header->final_silence,value,pool); - break; - case RECORDER_HEADER_CAPTURE_ON_SPEECH: - apt_boolean_value_generate(recorder_header->capture_on_speech,value,pool); - break; - case RECORDER_HEADER_VER_BUFFER_UTTERANCE: - apt_boolean_value_generate(recorder_header->ver_buffer_utterance,value,pool); - break; - case RECORDER_HEADER_START_INPUT_TIMERS: - apt_boolean_value_generate(recorder_header->start_input_timers,value,pool); - break; - case RECORDER_HEADER_NEW_AUDIO_CHANNEL: - apt_boolean_value_generate(recorder_header->new_audio_channel,value,pool); - break; - default: - break; - } - return TRUE; -} - -/** Duplicate MRCP recorder header */ -static apt_bool_t mrcp_recorder_header_duplicate(mrcp_header_accessor_t *accessor, const mrcp_header_accessor_t *src, apr_size_t id, const apt_str_t *value, apr_pool_t *pool) -{ - mrcp_recorder_header_t *recorder_header = accessor->data; - const mrcp_recorder_header_t *src_recorder_header = src->data; - apt_bool_t status = TRUE; - - if(!recorder_header || !src_recorder_header) { - return FALSE; - } - - switch(id) { - case RECORDER_HEADER_SENSITIVITY_LEVEL: - recorder_header->sensitivity_level = src_recorder_header->sensitivity_level; - break; - case RECORDER_HEADER_NO_INPUT_TIMEOUT: - recorder_header->no_input_timeout = src_recorder_header->no_input_timeout; - break; - case RECORDER_HEADER_COMPLETION_CAUSE: - recorder_header->completion_cause = src_recorder_header->completion_cause; - break; - case RECORDER_HEADER_COMPLETION_REASON: - recorder_header->completion_reason = *value; - break; - case RECORDER_HEADER_FAILED_URI: - recorder_header->failed_uri = *value; - break; - case RECORDER_HEADER_FAILED_URI_CAUSE: - recorder_header->failed_uri_cause = *value; - break; - case RECORDER_HEADER_RECORD_URI: - recorder_header->record_uri = *value; - break; - case RECORDER_HEADER_MEDIA_TYPE: - recorder_header->media_type = *value; - break; - case RECORDER_HEADER_MAX_TIME: - recorder_header->max_time = src_recorder_header->max_time; - break; - case RECORDER_HEADER_TRIM_LENGTH: - recorder_header->trim_length = src_recorder_header->trim_length; - break; - case RECORDER_HEADER_FINAL_SILENCE: - recorder_header->final_silence = src_recorder_header->final_silence; - break; - case RECORDER_HEADER_CAPTURE_ON_SPEECH: - recorder_header->capture_on_speech = src_recorder_header->capture_on_speech; - break; - case RECORDER_HEADER_VER_BUFFER_UTTERANCE: - recorder_header->ver_buffer_utterance = src_recorder_header->ver_buffer_utterance; - break; - case RECORDER_HEADER_START_INPUT_TIMERS: - recorder_header->start_input_timers = src_recorder_header->start_input_timers; - break; - case RECORDER_HEADER_NEW_AUDIO_CHANNEL: - recorder_header->new_audio_channel = src_recorder_header->new_audio_channel; - break; - default: - status = FALSE; - } - return status; -} - -static const mrcp_header_vtable_t vtable = { - mrcp_recorder_header_allocate, - NULL, /* nothing to destroy */ - mrcp_recorder_header_parse, - mrcp_recorder_header_generate, - mrcp_recorder_header_duplicate, - recorder_header_string_table, - RECORDER_HEADER_COUNT -}; - -const mrcp_header_vtable_t* mrcp_recorder_header_vtable_get(mrcp_version_e version) -{ - return &vtable; -} - -MRCP_DECLARE(const apt_str_t*) mrcp_recorder_completion_cause_get( - mrcp_recorder_completion_cause_e completion_cause, - mrcp_version_e version) -{ - return apt_string_table_str_get(completion_cause_string_table,RECORDER_COMPLETION_CAUSE_COUNT,completion_cause); -} diff --git a/libs/unimrcp/libs/mrcp/resources/src/mrcp_recorder_resource.c b/libs/unimrcp/libs/mrcp/resources/src/mrcp_recorder_resource.c deleted file mode 100644 index 28f4844f4e..0000000000 --- a/libs/unimrcp/libs/mrcp/resources/src/mrcp_recorder_resource.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_recorder_resource.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mrcp_recorder_resource.h" -#include "mrcp_recorder_header.h" -#include "mrcp_resource.h" - -/** String table of MRCP recorder methods (mrcp_recorder_method_id) */ -static const apt_str_table_item_t recorder_method_string_table[] = { - {{"SET-PARAMS", 10},10}, - {{"GET-PARAMS", 10},0}, - {{"RECORD", 6},0}, - {{"STOP", 4},2}, - {{"START-INPUT-TIMERS", 18},2} -}; - -/** String table of MRCP recorder events (mrcp_recorder_event_id) */ -static const apt_str_table_item_t recorder_event_string_table[] = { - {{"START-OF-INPUT", 14},0}, - {{"RECORD-COMPLETE", 15},0} -}; - -static APR_INLINE const apt_str_table_item_t* recorder_method_string_table_get(mrcp_version_e version) -{ - return recorder_method_string_table; -} - -static APR_INLINE const apt_str_table_item_t* recorder_event_string_table_get(mrcp_version_e version) -{ - return recorder_event_string_table; -} - -/** Create MRCP recorder resource */ -MRCP_DECLARE(mrcp_resource_t*) mrcp_recorder_resource_create(apr_pool_t *pool) -{ - mrcp_resource_t *resource = mrcp_resource_create(pool); - - resource->method_count = RECORDER_METHOD_COUNT; - resource->event_count = RECORDER_EVENT_COUNT; - resource->get_method_str_table = recorder_method_string_table_get; - resource->get_event_str_table = recorder_event_string_table_get; - resource->get_resource_header_vtable = mrcp_recorder_header_vtable_get; - return resource; -} diff --git a/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_header.c b/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_header.c deleted file mode 100644 index 49e8c29ef3..0000000000 --- a/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_header.c +++ /dev/null @@ -1,563 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_synth_header.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mrcp_synth_header.h" - -/** String table of MRCP synthesizer header fields (mrcp_synthesizer_header_id) */ -static const apt_str_table_item_t synth_header_string_table[] = { - {{"Jump-Size", 9},0}, - {{"Kill-On-Barge-In", 16},0}, - {{"Speaker-Profile", 15},8}, - {{"Completion-Cause", 16},16}, - {{"Completion-Reason", 17},13}, - {{"Voice-Gender", 12},6}, - {{"Voice-Age", 9},6}, - {{"Voice-Variant", 13},6}, - {{"Voice-Name", 10},8}, - {{"Prosody-Volume", 14},8}, - {{"Prosody-Rate", 12},12}, - {{"Speech-Marker", 13},7}, - {{"Speech-Language", 15},7}, - {{"Fetch-Hint", 10},2}, - {{"Audio-Fetch-Hint", 16},0}, - {{"Failed-Uri", 10},10}, - {{"Failed-Uri_Cause", 16},10}, - {{"Speak-Restart", 13},13}, - {{"Speak-Length", 12},6}, - {{"Load-Lexicon", 12},2}, - {{"Lexicon-Search-Order",20},2} -}; - -/** String table of MRCP speech-unit fields (mrcp_speech_unit_t) */ -static const apt_str_table_item_t speech_unit_string_table[] = { - {{"Second", 6},2}, - {{"Word", 4},0}, - {{"Sentence", 8},2}, - {{"Paragraph",9},0} -}; - -/** String table of MRCP voice-gender fields (mrcp_voice_gender_t) */ -static const apt_str_table_item_t voice_gender_string_table[] = { - {{"male", 4},0}, - {{"female", 6},0}, - {{"neutral",7},0} -}; - -/** String table of MRCP prosody-volume fields (mrcp_prosody_volume_t) */ -static const apt_str_table_item_t prosody_volume_string_table[] = { - {{"silent", 6},1}, - {{"x-soft", 6},2}, - {{"soft", 4},3}, - {{"medium", 6},0}, - {{"loud", 4},0}, - {{"x-loud", 6},5}, - {{"default",7},0} -}; - -/** String table of MRCP prosody-rate fields (mrcp_prosody_rate_t) */ -static const apt_str_table_item_t prosody_rate_string_table[] = { - {{"x-slow", 6},3}, - {{"slow", 4},0}, - {{"medium", 6},0}, - {{"fast", 4},0}, - {{"x-fast", 6},4}, - {{"default",7},0} -}; - -/** String table of MRCP synthesizer completion-cause fields (mrcp_synthesizer_completion_cause_t) */ -static const apt_str_table_item_t completion_cause_string_table[] = { - {{"normal", 6},0}, - {{"barge-in", 8},0}, - {{"parse-failure", 13},0}, - {{"uri-failure", 11},0}, - {{"error", 5},0}, - {{"language-unsupported",20},4}, - {{"lexicon-load-failure",20},1}, - {{"cancelled", 9},0} -}; - - -static APR_INLINE apr_size_t apt_string_table_value_parse(const apt_str_table_item_t *string_table, size_t count, const apt_str_t *value) -{ - return apt_string_table_id_find(string_table,count,value); -} - -static apt_bool_t apt_string_table_value_pgenerate(const apt_str_table_item_t *string_table, apr_size_t count, apr_size_t id, apt_str_t *str, apr_pool_t *pool) -{ - const apt_str_t *name = apt_string_table_str_get(string_table,count,id); - if(!name) { - return FALSE; - } - - apt_string_copy(str,name,pool); - return TRUE; -} - -/** Parse MRCP prosody-rate value */ -static apt_bool_t mrcp_prosody_param_rate_parse(mrcp_prosody_rate_t *prosody_rate, const apt_str_t *value, apr_pool_t *pool) -{ - if(!value->length) { - return FALSE; - } - - /** For the rate attribute, relative changes are a number. (not preceded by a "+" or "-")(w3c ssml)*/ - if('0'<=value->buf[0] && value->buf[0]<='9') { - prosody_rate->type = PROSODY_RATE_TYPE_RELATIVE_CHANGE; - } - else { - prosody_rate->type = PROSODY_RATE_TYPE_LABEL; - } - - if(prosody_rate->type == PROSODY_RATE_TYPE_RELATIVE_CHANGE) { - prosody_rate->value.relative = apt_float_value_parse(value); - } - else { - prosody_rate->value.label = apt_string_table_value_parse(prosody_rate_string_table,PROSODY_RATE_COUNT,value); - } - - return TRUE; -} - -/** Generate MRCP prosody-rate value */ -static apt_bool_t mrcp_prosody_rate_generate(mrcp_prosody_rate_t *prosody_rate, apt_str_t *str, apr_pool_t *pool) -{ - if(prosody_rate->type == PROSODY_RATE_TYPE_LABEL) { - apt_string_table_value_pgenerate( - prosody_rate_string_table, - PROSODY_RATE_COUNT, - prosody_rate->value.label, - str, - pool); - } - else { - apt_float_value_generate(prosody_rate->value.relative,str,pool); - } - - return TRUE; -} - -/** Parse MRCP prosody-volume value */ -static apt_bool_t mrcp_prosody_param_volume_parse(mrcp_prosody_volume_t *prosody_volume, const apt_str_t *value, apr_pool_t *pool) -{ - if(!value->length) { - return FALSE; - } - - /** For the volume attribute, relative changes are a number preceded by "+" or "-" (w3c ssml)*/ - if(value->buf[0]=='+' || value->buf[0]=='-') { - prosody_volume->type = PROSODY_VOLUME_TYPE_RELATIVE_CHANGE; - } - else if('0'<=value->buf[0] && value->buf[0]<='9') { - prosody_volume->type = PROSODY_VOLUME_TYPE_NUMERIC; - } - else { - prosody_volume->type = PROSODY_VOLUME_TYPE_LABEL; - } - - if(prosody_volume->type == PROSODY_VOLUME_TYPE_RELATIVE_CHANGE) { - prosody_volume->value.relative = apt_float_value_parse(value); - } - else if(prosody_volume->type == PROSODY_VOLUME_TYPE_NUMERIC) { - prosody_volume->value.numeric = apt_float_value_parse(value); - } - else { - prosody_volume->value.label = apt_string_table_value_parse(prosody_volume_string_table,PROSODY_VOLUME_COUNT,value); - } - - return TRUE; -} - -/** Generate MRCP prosody-volume value */ -static apt_bool_t mrcp_prosody_volume_generate(mrcp_prosody_volume_t *prosody_volume, apt_str_t *str, apr_pool_t *pool) -{ - if(prosody_volume->type == PROSODY_VOLUME_TYPE_LABEL) { - apt_string_table_value_pgenerate( - prosody_volume_string_table, - PROSODY_VOLUME_COUNT, - prosody_volume->value.label, - str, - pool); - } - else if (prosody_volume->type == PROSODY_VOLUME_TYPE_NUMERIC) { - apt_float_value_generate(prosody_volume->value.numeric,str,pool); - } - else { - apt_float_value_generate(prosody_volume->value.relative,str,pool); - } - - return TRUE; -} - -/** Parse MRCP speech-length value */ -static apt_bool_t mrcp_speech_length_value_parse(mrcp_speech_length_value_t *speech_length, const apt_str_t *value, apr_pool_t *pool) -{ - if(!value->length) { - return FALSE; - } - - switch(*value->buf) { - case '+': speech_length->type = SPEECH_LENGTH_TYPE_NUMERIC_POSITIVE; break; - case '-': speech_length->type = SPEECH_LENGTH_TYPE_NUMERIC_NEGATIVE; break; - default : speech_length->type = SPEECH_LENGTH_TYPE_TEXT; - } - - if(speech_length->type == SPEECH_LENGTH_TYPE_TEXT) { - apt_string_copy(&speech_length->value.tag,value,pool); - } - else { - mrcp_numeric_speech_length_t *numeric = &speech_length->value.numeric; - apt_str_t str; - apt_text_stream_t stream; - stream.text = *value; - apt_text_stream_reset(&stream); - stream.pos++; - if(apt_text_field_read(&stream,APT_TOKEN_SP,TRUE,&str) == FALSE) { - return FALSE; - } - numeric->length = apt_size_value_parse(&str); - - if(apt_text_field_read(&stream,APT_TOKEN_SP,TRUE,&str) == FALSE) { - return FALSE; - } - numeric->unit = apt_string_table_value_parse(speech_unit_string_table,SPEECH_UNIT_COUNT,&str); - } - return TRUE; -} - -/** Generate MRCP speech-length value */ -static apt_bool_t mrcp_speech_length_generate(mrcp_speech_length_value_t *speech_length, apt_str_t *str, apr_pool_t *pool) -{ - if(speech_length->type == SPEECH_LENGTH_TYPE_TEXT) { - apt_str_t *tag = &speech_length->value.tag; - if(tag->length) { - apt_string_copy(str,tag,pool); - } - } - else { - const apt_str_t *unit_name = apt_string_table_str_get( - speech_unit_string_table, - SPEECH_UNIT_COUNT, - speech_length->value.numeric.unit); - if(!unit_name) { - return FALSE; - } - - str->buf = apr_psprintf(pool, "%c%"APR_SIZE_T_FMT" %s", - speech_length->type == SPEECH_LENGTH_TYPE_NUMERIC_POSITIVE ? '+' : '-', - speech_length->value.numeric.length, - unit_name->buf); - str->length = strlen(str->buf); - } - return TRUE; -} - -/** Initialize synthesizer header */ -static void mrcp_synth_header_init(mrcp_synth_header_t *synth_header) -{ - synth_header->jump_size.type = SPEECH_LENGTH_TYPE_UNKNOWN; - synth_header->kill_on_barge_in = FALSE; - apt_string_reset(&synth_header->speaker_profile); - synth_header->completion_cause = SYNTHESIZER_COMPLETION_CAUSE_UNKNOWN; - apt_string_reset(&synth_header->completion_reason); - synth_header->voice_param.gender = VOICE_GENDER_UNKNOWN; - synth_header->voice_param.age = 0; - synth_header->voice_param.variant = 0; - apt_string_reset(&synth_header->voice_param.name); - synth_header->prosody_param.volume.type = PROSODY_VOLUME_TYPE_UNKNOWN; - synth_header->prosody_param.rate.type = PROSODY_RATE_TYPE_UNKNOWN; - apt_string_reset(&synth_header->speech_marker); - apt_string_reset(&synth_header->speech_language); - apt_string_reset(&synth_header->fetch_hint); - apt_string_reset(&synth_header->audio_fetch_hint); - apt_string_reset(&synth_header->failed_uri); - apt_string_reset(&synth_header->failed_uri_cause); - synth_header->speak_restart = FALSE; - synth_header->speak_length.type = SPEECH_LENGTH_TYPE_UNKNOWN; - synth_header->load_lexicon = FALSE; - apt_string_reset(&synth_header->lexicon_search_order); -} - - -/** Allocate MRCP synthesizer header */ -static void* mrcp_synth_header_allocate(mrcp_header_accessor_t *accessor, apr_pool_t *pool) -{ - mrcp_synth_header_t *synth_header = apr_palloc(pool,sizeof(mrcp_synth_header_t)); - mrcp_synth_header_init(synth_header); - accessor->data = synth_header; - return accessor->data; -} - -/** Parse MRCP synthesizer header */ -static apt_bool_t mrcp_synth_header_parse(mrcp_header_accessor_t *accessor, size_t id, const apt_str_t *value, apr_pool_t *pool) -{ - apt_bool_t status = TRUE; - mrcp_synth_header_t *synth_header = accessor->data; - switch(id) { - case SYNTHESIZER_HEADER_JUMP_SIZE: - mrcp_speech_length_value_parse(&synth_header->jump_size,value,pool); - break; - case SYNTHESIZER_HEADER_KILL_ON_BARGE_IN: - apt_boolean_value_parse(value,&synth_header->kill_on_barge_in); - break; - case SYNTHESIZER_HEADER_SPEAKER_PROFILE: - synth_header->speaker_profile = *value; - break; - case SYNTHESIZER_HEADER_COMPLETION_CAUSE: - synth_header->completion_cause = apt_size_value_parse(value); - break; - case SYNTHESIZER_HEADER_COMPLETION_REASON: - synth_header->completion_reason = *value; - break; - case SYNTHESIZER_HEADER_VOICE_GENDER: - synth_header->voice_param.gender = apt_string_table_value_parse(voice_gender_string_table,VOICE_GENDER_COUNT,value); - break; - case SYNTHESIZER_HEADER_VOICE_AGE: - synth_header->voice_param.age = apt_size_value_parse(value); - break; - case SYNTHESIZER_HEADER_VOICE_VARIANT: - synth_header->voice_param.variant = apt_size_value_parse(value); - break; - case SYNTHESIZER_HEADER_VOICE_NAME: - synth_header->voice_param.name = *value; - break; - case SYNTHESIZER_HEADER_PROSODY_VOLUME: - mrcp_prosody_param_volume_parse(&synth_header->prosody_param.volume,value,pool); - break; - case SYNTHESIZER_HEADER_PROSODY_RATE: - mrcp_prosody_param_rate_parse(&synth_header->prosody_param.rate,value,pool); - break; - case SYNTHESIZER_HEADER_SPEECH_MARKER: - synth_header->speech_marker = *value; - break; - case SYNTHESIZER_HEADER_SPEECH_LANGUAGE: - synth_header->speech_language = *value; - break; - case SYNTHESIZER_HEADER_FETCH_HINT: - synth_header->fetch_hint = *value; - break; - case SYNTHESIZER_HEADER_AUDIO_FETCH_HINT: - synth_header->audio_fetch_hint = *value; - break; - case SYNTHESIZER_HEADER_FAILED_URI: - synth_header->failed_uri = *value; - break; - case SYNTHESIZER_HEADER_FAILED_URI_CAUSE: - synth_header->failed_uri_cause = *value; - break; - case SYNTHESIZER_HEADER_SPEAK_RESTART: - apt_boolean_value_parse(value,&synth_header->speak_restart); - break; - case SYNTHESIZER_HEADER_SPEAK_LENGTH: - mrcp_speech_length_value_parse(&synth_header->speak_length,value,pool); - break; - case SYNTHESIZER_HEADER_LOAD_LEXICON: - apt_boolean_value_parse(value,&synth_header->load_lexicon); - break; - case SYNTHESIZER_HEADER_LEXICON_SEARCH_ORDER: - synth_header->lexicon_search_order = *value; - break; - default: - status = FALSE; - } - return status; -} - -/** Generate MRCP synthesizer header */ -static apt_bool_t mrcp_synth_header_generate(const mrcp_header_accessor_t *accessor, size_t id, apt_str_t *value, apr_pool_t *pool) -{ - mrcp_synth_header_t *synth_header = accessor->data; - switch(id) { - case SYNTHESIZER_HEADER_JUMP_SIZE: - mrcp_speech_length_generate(&synth_header->jump_size,value,pool); - break; - case SYNTHESIZER_HEADER_KILL_ON_BARGE_IN: - apt_boolean_value_generate(synth_header->kill_on_barge_in,value,pool); - break; - case SYNTHESIZER_HEADER_SPEAKER_PROFILE: - *value = synth_header->speaker_profile,value; - break; - case SYNTHESIZER_HEADER_COMPLETION_CAUSE: - apt_completion_cause_generate( - completion_cause_string_table, - SYNTHESIZER_COMPLETION_CAUSE_COUNT, - synth_header->completion_cause, - value, - pool); - break; - case SYNTHESIZER_HEADER_COMPLETION_REASON: - *value = synth_header->completion_reason; - break; - case SYNTHESIZER_HEADER_VOICE_GENDER: - apt_string_table_value_pgenerate( - voice_gender_string_table, - VOICE_GENDER_COUNT, - synth_header->voice_param.gender, - value, - pool); - break; - case SYNTHESIZER_HEADER_VOICE_AGE: - apt_size_value_generate(synth_header->voice_param.age,value,pool); - break; - case SYNTHESIZER_HEADER_VOICE_VARIANT: - apt_size_value_generate(synth_header->voice_param.variant,value,pool); - break; - case SYNTHESIZER_HEADER_VOICE_NAME: - *value = synth_header->voice_param.name,value; - break; - case SYNTHESIZER_HEADER_PROSODY_VOLUME: - mrcp_prosody_volume_generate(&synth_header->prosody_param.volume,value,pool); - break; - case SYNTHESIZER_HEADER_PROSODY_RATE: - mrcp_prosody_rate_generate(&synth_header->prosody_param.rate,value,pool); - break; - case SYNTHESIZER_HEADER_SPEECH_MARKER: - *value = synth_header->speech_marker; - break; - case SYNTHESIZER_HEADER_SPEECH_LANGUAGE: - *value = synth_header->speech_language; - break; - case SYNTHESIZER_HEADER_FETCH_HINT: - *value = synth_header->fetch_hint; - break; - case SYNTHESIZER_HEADER_AUDIO_FETCH_HINT: - *value = synth_header->audio_fetch_hint; - break; - case SYNTHESIZER_HEADER_FAILED_URI: - *value = synth_header->failed_uri; - break; - case SYNTHESIZER_HEADER_FAILED_URI_CAUSE: - *value = synth_header->failed_uri_cause; - break; - case SYNTHESIZER_HEADER_SPEAK_RESTART: - apt_boolean_value_generate(synth_header->speak_restart,value,pool); - break; - case SYNTHESIZER_HEADER_SPEAK_LENGTH: - mrcp_speech_length_generate(&synth_header->speak_length,value,pool); - break; - case SYNTHESIZER_HEADER_LOAD_LEXICON: - apt_boolean_value_generate(synth_header->load_lexicon,value,pool); - break; - case SYNTHESIZER_HEADER_LEXICON_SEARCH_ORDER: - *value = synth_header->lexicon_search_order; - break; - default: - break; - } - return TRUE; -} - -/** Duplicate MRCP synthesizer header */ -static apt_bool_t mrcp_synth_header_duplicate(mrcp_header_accessor_t *accessor, const mrcp_header_accessor_t *src, size_t id, const apt_str_t *value, apr_pool_t *pool) -{ - mrcp_synth_header_t *synth_header = accessor->data; - const mrcp_synth_header_t *src_synth_header = src->data; - apt_bool_t status = TRUE; - - if(!synth_header || !src_synth_header) { - return FALSE; - } - - switch(id) { - case SYNTHESIZER_HEADER_JUMP_SIZE: - synth_header->jump_size = src_synth_header->jump_size; - break; - case SYNTHESIZER_HEADER_KILL_ON_BARGE_IN: - synth_header->kill_on_barge_in = src_synth_header->kill_on_barge_in; - break; - case SYNTHESIZER_HEADER_SPEAKER_PROFILE: - synth_header->speaker_profile = *value; - break; - case SYNTHESIZER_HEADER_COMPLETION_CAUSE: - synth_header->completion_cause = src_synth_header->completion_cause; - break; - case SYNTHESIZER_HEADER_COMPLETION_REASON: - synth_header->completion_reason = *value; - break; - case SYNTHESIZER_HEADER_VOICE_GENDER: - synth_header->voice_param.gender = src_synth_header->voice_param.gender; - break; - case SYNTHESIZER_HEADER_VOICE_AGE: - synth_header->voice_param.age = src_synth_header->voice_param.age; - break; - case SYNTHESIZER_HEADER_VOICE_VARIANT: - synth_header->voice_param.variant = src_synth_header->voice_param.variant; - break; - case SYNTHESIZER_HEADER_VOICE_NAME: - synth_header->voice_param.name = *value; - break; - case SYNTHESIZER_HEADER_PROSODY_VOLUME: - synth_header->prosody_param.volume = src_synth_header->prosody_param.volume; - break; - case SYNTHESIZER_HEADER_PROSODY_RATE: - synth_header->prosody_param.rate = src_synth_header->prosody_param.rate; - break; - case SYNTHESIZER_HEADER_SPEECH_MARKER: - synth_header->speech_marker = *value; - break; - case SYNTHESIZER_HEADER_SPEECH_LANGUAGE: - synth_header->speech_language = *value; - break; - case SYNTHESIZER_HEADER_FETCH_HINT: - synth_header->fetch_hint = *value; - break; - case SYNTHESIZER_HEADER_AUDIO_FETCH_HINT: - synth_header->audio_fetch_hint = *value; - break; - case SYNTHESIZER_HEADER_FAILED_URI: - synth_header->failed_uri = *value; - break; - case SYNTHESIZER_HEADER_FAILED_URI_CAUSE: - synth_header->failed_uri_cause = *value; - break; - case SYNTHESIZER_HEADER_SPEAK_RESTART: - synth_header->speak_restart = src_synth_header->speak_restart; - break; - case SYNTHESIZER_HEADER_SPEAK_LENGTH: - synth_header->speak_length = src_synth_header->speak_length; - break; - case SYNTHESIZER_HEADER_LOAD_LEXICON: - synth_header->load_lexicon = src_synth_header->load_lexicon; - break; - case SYNTHESIZER_HEADER_LEXICON_SEARCH_ORDER: - synth_header->lexicon_search_order = *value; - break; - default: - status = FALSE; - } - return status; -} - -static const mrcp_header_vtable_t vtable = { - mrcp_synth_header_allocate, - NULL, /* nothing to destroy */ - mrcp_synth_header_parse, - mrcp_synth_header_generate, - mrcp_synth_header_duplicate, - synth_header_string_table, - SYNTHESIZER_HEADER_COUNT -}; - -const mrcp_header_vtable_t* mrcp_synth_header_vtable_get(mrcp_version_e version) -{ - return &vtable; -} - -MRCP_DECLARE(const apt_str_t*) mrcp_synth_completion_cause_get(mrcp_synth_completion_cause_e completion_cause, mrcp_version_e version) -{ - return apt_string_table_str_get(completion_cause_string_table,SYNTHESIZER_COMPLETION_CAUSE_COUNT,completion_cause); -} diff --git a/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_resource.c b/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_resource.c deleted file mode 100644 index 795672043c..0000000000 --- a/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_resource.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_synth_resource.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mrcp_synth_resource.h" -#include "mrcp_synth_header.h" -#include "mrcp_resource.h" - -/** String table of MRCP synthesizer methods (mrcp_synthesizer_method_id) */ -static const apt_str_table_item_t synth_method_string_table[] = { - {{"SET-PARAMS", 10},10}, - {{"GET-PARAMS", 10},0}, - {{"SPEAK", 5},1}, - {{"STOP", 4},1}, - {{"PAUSE", 5},0}, - {{"RESUME", 6},0}, - {{"BARGE-IN-OCCURRED",17},0}, - {{"CONTROL", 7},0}, - {{"DEFINE-LEXICON", 14},0} -}; - -/** String table of MRCP synthesizer events (mrcp_synthesizer_event_id) */ -static const apt_str_table_item_t synth_event_string_table[] = { - {{"SPEECH-MARKER", 13},3}, - {{"SPEAK-COMPLETE",14},3} -}; - -static APR_INLINE const apt_str_table_item_t* synth_method_string_table_get(mrcp_version_e version) -{ - return synth_method_string_table; -} - -static APR_INLINE const apt_str_table_item_t* synth_event_string_table_get(mrcp_version_e version) -{ - return synth_event_string_table; -} - -/** Create MRCP synthesizer resource */ -MRCP_DECLARE(mrcp_resource_t*) mrcp_synth_resource_create(apr_pool_t *pool) -{ - mrcp_resource_t *resource = mrcp_resource_create(pool); - - resource->method_count = SYNTHESIZER_METHOD_COUNT; - resource->event_count = SYNTHESIZER_EVENT_COUNT; - resource->get_method_str_table = synth_method_string_table_get; - resource->get_event_str_table = synth_event_string_table_get; - resource->get_resource_header_vtable = mrcp_synth_header_vtable_get; - return resource; -} diff --git a/libs/unimrcp/libs/mrcp/resources/src/mrcp_verifier_header.c b/libs/unimrcp/libs/mrcp/resources/src/mrcp_verifier_header.c deleted file mode 100644 index a0c32d0424..0000000000 --- a/libs/unimrcp/libs/mrcp/resources/src/mrcp_verifier_header.c +++ /dev/null @@ -1,352 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: - */ - -#include "mrcp_verifier_header.h" - -/** String table of MRCP verifier header fields (mrcp_verifier_header_id) */ -static const apt_str_table_item_t verifier_header_string_table[] = { - {{"Repository-URI", 14},0}, - {{"Voiceprint-Identifier", 21},12}, - {{"Verification-Mode", 17},6}, - {{"Adapt-Model", 11},1}, - {{"Abort-Model", 11},11}, - {{"Min-Verification-Score", 22},1}, - {{"Num-Min-Verification-Phrases",28},6}, - {{"Num-Max-Verification-Phrases",28},5}, - {{"No-Input-Timeout", 16},2}, - {{"Save-Waveform", 13},4}, - {{"Media-Type", 10},2}, - {{"Waveform-URI", 12},0}, - {{"Voiceprint-Exists", 17},11}, - {{"Ver-Buffer-Utterance", 20},4}, - {{"Input-Waveform-URI", 18},0}, - {{"Completion-Cause", 16},11}, - {{"Completion-Reason", 17},15}, - {{"Speech-Complete-Timeout", 23},1}, - {{"New-Audio-Channel", 17},2}, - {{"Abort-Verification", 18},6}, - {{"Start-Input-Timers", 18},1} -}; - -/** String table of MRCP verifier completion-cause fields (mrcp_verifier_completion_cause_e) */ -static const apt_str_table_item_t completion_cause_string_table[] = { - {{"success", 7},2}, - {{"error", 5},0}, - {{"no-input-timeout", 16},0}, - {{"too-much-speech-timeout",23},0}, - {{"speech-too-early", 16},9}, - {{"buffer-empty", 12},0}, - {{"out-of-sequence", 15},0}, - {{"repository-uri-failure", 22},15}, - {{"repository-uri-missing", 22},15}, - {{"voiceprint-id-missing", 21},14}, - {{"voiceprint-id-not-exist",23},14}, - {{"speech-not-usable", 17},7} -}; - - -/** Initialize verifier header */ -static void mrcp_verifier_header_init(mrcp_verifier_header_t *verifier_header) -{ - apt_string_reset(&verifier_header->repository_uri); - apt_string_reset(&verifier_header->voiceprint_identifier); - apt_string_reset(&verifier_header->verification_mode); - verifier_header->adapt_model = FALSE; - verifier_header->abort_model = FALSE; - verifier_header->min_verification_score = 0.0; - verifier_header->num_min_verification_phrases = 0; - verifier_header->num_max_verification_phrases = 0; - verifier_header->no_input_timeout = 0; - verifier_header->save_waveform = FALSE; - apt_string_reset(&verifier_header->media_type); - apt_string_reset(&verifier_header->waveform_uri); - verifier_header->voiceprint_exists = FALSE; - verifier_header->ver_buffer_utterance = FALSE; - apt_string_reset(&verifier_header->input_waveform_uri); - verifier_header->completion_cause = VERIFIER_COMPLETION_CAUSE_UNKNOWN; - apt_string_reset(&verifier_header->completion_reason); - verifier_header->speech_complete_timeout = 0; - verifier_header->new_audio_channel = FALSE; - verifier_header->abort_verification = FALSE; - verifier_header->start_input_timers = FALSE; -} - -/** Allocate MRCP verifier header */ -static void* mrcp_verifier_header_allocate(mrcp_header_accessor_t *accessor, apr_pool_t *pool) -{ - mrcp_verifier_header_t *verifier_header = apr_palloc(pool,sizeof(mrcp_verifier_header_t)); - mrcp_verifier_header_init(verifier_header); - accessor->data = verifier_header; - return accessor->data; -} - -/** Parse MRCP verifier header */ -static apt_bool_t mrcp_verifier_header_parse(mrcp_header_accessor_t *accessor, apr_size_t id, const apt_str_t *value, apr_pool_t *pool) -{ - mrcp_verifier_header_t *verifier_header = accessor->data; - apt_bool_t status = TRUE; - switch(id) { - case VERIFIER_HEADER_REPOSITORY_URI: - verifier_header->repository_uri = *value; - break; - case VERIFIER_HEADER_VOICEPRINT_IDENTIFIER: - verifier_header->voiceprint_identifier = *value; - break; - case VERIFIER_HEADER_VERIFICATION_MODE: - verifier_header->verification_mode = *value; - break; - case VERIFIER_HEADER_ADAPT_MODEL: - apt_boolean_value_parse(value,&verifier_header->adapt_model); - break; - case VERIFIER_HEADER_ABORT_MODEL: - apt_boolean_value_parse(value,&verifier_header->abort_model); - break; - case VERIFIER_HEADER_MIN_VERIFICATION_SCORE: - verifier_header->min_verification_score = apt_float_value_parse(value); - break; - case VERIFIER_HEADER_NUM_MIN_VERIFICATION_PHRASES: - verifier_header->num_min_verification_phrases = apt_size_value_parse(value); - break; - case VERIFIER_HEADER_NUM_MAX_VERIFICATION_PHRASES: - verifier_header->num_max_verification_phrases = apt_size_value_parse(value); - break; - case VERIFIER_HEADER_NO_INPUT_TIMEOUT: - verifier_header->no_input_timeout = apt_size_value_parse(value); - break; - case VERIFIER_HEADER_SAVE_WAVEFORM: - apt_boolean_value_parse(value,&verifier_header->save_waveform); - break; - case VERIFIER_HEADER_MEDIA_TYPE: - verifier_header->media_type = *value; - break; - case VERIFIER_HEADER_WAVEFORM_URI: - verifier_header->waveform_uri = *value; - break; - case VERIFIER_HEADER_VOICEPRINT_EXISTS: - apt_boolean_value_parse(value,&verifier_header->voiceprint_exists); - break; - case VERIFIER_HEADER_VER_BUFFER_UTTERANCE: - apt_boolean_value_parse(value,&verifier_header->ver_buffer_utterance); - break; - case VERIFIER_HEADER_INPUT_WAVEFORM_URI: - verifier_header->input_waveform_uri = *value; - break; - case VERIFIER_HEADER_COMPLETION_CAUSE: - verifier_header->completion_cause = apt_size_value_parse(value); - break; - case VERIFIER_HEADER_COMPLETION_REASON: - verifier_header->completion_reason = *value; - break; - case VERIFIER_HEADER_SPEECH_COMPLETE_TIMEOUT: - verifier_header->speech_complete_timeout = apt_size_value_parse(value); - break; - case VERIFIER_HEADER_NEW_AUDIO_CHANNEL: - apt_boolean_value_parse(value,&verifier_header->new_audio_channel); - break; - case VERIFIER_HEADER_ABORT_VERIFICATION: - apt_boolean_value_parse(value,&verifier_header->abort_verification); - break; - case VERIFIER_HEADER_START_INPUT_TIMERS: - apt_boolean_value_parse(value,&verifier_header->start_input_timers); - break; - default: - status = FALSE; - } - return status; -} - -/** Generate MRCP verifier header */ -static apt_bool_t mrcp_verifier_header_generate(const mrcp_header_accessor_t *accessor, apr_size_t id, apt_str_t *value, apr_pool_t *pool) -{ - mrcp_verifier_header_t *verifier_header = accessor->data; - switch(id) { - case VERIFIER_HEADER_REPOSITORY_URI: - *value = verifier_header->repository_uri; - break; - case VERIFIER_HEADER_VOICEPRINT_IDENTIFIER: - *value = verifier_header->voiceprint_identifier; - break; - case VERIFIER_HEADER_VERIFICATION_MODE: - *value = verifier_header->verification_mode; - break; - case VERIFIER_HEADER_ADAPT_MODEL: - apt_boolean_value_generate(verifier_header->adapt_model,value,pool); - break; - case VERIFIER_HEADER_ABORT_MODEL: - apt_boolean_value_generate(verifier_header->abort_model,value,pool); - break; - case VERIFIER_HEADER_MIN_VERIFICATION_SCORE: - apt_float_value_generate(verifier_header->min_verification_score,value,pool); - break; - case VERIFIER_HEADER_NUM_MIN_VERIFICATION_PHRASES: - apt_size_value_generate(verifier_header->num_min_verification_phrases,value,pool); - break; - case VERIFIER_HEADER_NUM_MAX_VERIFICATION_PHRASES: - apt_size_value_generate(verifier_header->num_max_verification_phrases,value,pool); - break; - case VERIFIER_HEADER_NO_INPUT_TIMEOUT: - apt_size_value_generate(verifier_header->no_input_timeout,value,pool); - break; - case VERIFIER_HEADER_SAVE_WAVEFORM: - apt_boolean_value_generate(verifier_header->save_waveform,value,pool); - break; - case VERIFIER_HEADER_MEDIA_TYPE: - *value = verifier_header->media_type; - break; - case VERIFIER_HEADER_WAVEFORM_URI: - *value = verifier_header->waveform_uri; - break; - case VERIFIER_HEADER_VOICEPRINT_EXISTS: - apt_boolean_value_generate(verifier_header->voiceprint_exists,value,pool); - break; - case VERIFIER_HEADER_VER_BUFFER_UTTERANCE: - apt_boolean_value_generate(verifier_header->ver_buffer_utterance,value,pool); - break; - case VERIFIER_HEADER_INPUT_WAVEFORM_URI: - *value = verifier_header->input_waveform_uri; - break; - case VERIFIER_HEADER_COMPLETION_CAUSE: - apt_completion_cause_generate( - completion_cause_string_table, - VERIFIER_COMPLETION_CAUSE_COUNT, - verifier_header->completion_cause, - value, - pool); - break; - case VERIFIER_HEADER_COMPLETION_REASON: - *value = verifier_header->completion_reason; - break; - case VERIFIER_HEADER_SPEECH_COMPLETE_TIMEOUT: - apt_size_value_generate(verifier_header->speech_complete_timeout,value,pool); - break; - case VERIFIER_HEADER_NEW_AUDIO_CHANNEL: - apt_boolean_value_generate(verifier_header->new_audio_channel,value,pool); - break; - case VERIFIER_HEADER_ABORT_VERIFICATION: - apt_boolean_value_generate(verifier_header->abort_verification,value,pool); - break; - case VERIFIER_HEADER_START_INPUT_TIMERS: - apt_boolean_value_generate(verifier_header->start_input_timers,value,pool); - break; - default: - break; - } - return TRUE; -} - -/** Duplicate MRCP verifier header */ -static apt_bool_t mrcp_verifier_header_duplicate(mrcp_header_accessor_t *accessor, const mrcp_header_accessor_t *src, apr_size_t id, const apt_str_t *value, apr_pool_t *pool) -{ - mrcp_verifier_header_t *verifier_header = accessor->data; - const mrcp_verifier_header_t *src_verifier_header = src->data; - apt_bool_t status = TRUE; - - if(!verifier_header || !src_verifier_header) { - return FALSE; - } - - switch(id) { - case VERIFIER_HEADER_REPOSITORY_URI: - verifier_header->repository_uri = *value; - break; - case VERIFIER_HEADER_VOICEPRINT_IDENTIFIER: - verifier_header->voiceprint_identifier = *value; - break; - case VERIFIER_HEADER_VERIFICATION_MODE: - verifier_header->verification_mode = *value; - break; - case VERIFIER_HEADER_ADAPT_MODEL: - verifier_header->adapt_model = src_verifier_header->adapt_model; - break; - case VERIFIER_HEADER_ABORT_MODEL: - verifier_header->abort_model = src_verifier_header->abort_model; - break; - case VERIFIER_HEADER_MIN_VERIFICATION_SCORE: - verifier_header->min_verification_score = src_verifier_header->min_verification_score; - break; - case VERIFIER_HEADER_NUM_MIN_VERIFICATION_PHRASES: - verifier_header->num_min_verification_phrases = src_verifier_header->num_min_verification_phrases; - break; - case VERIFIER_HEADER_NUM_MAX_VERIFICATION_PHRASES: - verifier_header->num_max_verification_phrases = src_verifier_header->num_max_verification_phrases; - break; - case VERIFIER_HEADER_NO_INPUT_TIMEOUT: - verifier_header->no_input_timeout = src_verifier_header->no_input_timeout; - break; - case VERIFIER_HEADER_SAVE_WAVEFORM: - verifier_header->save_waveform = src_verifier_header->save_waveform; - break; - case VERIFIER_HEADER_MEDIA_TYPE: - verifier_header->media_type = *value; - break; - case VERIFIER_HEADER_WAVEFORM_URI: - verifier_header->waveform_uri = *value; - break; - case VERIFIER_HEADER_VOICEPRINT_EXISTS: - verifier_header->voiceprint_exists = src_verifier_header->voiceprint_exists; - break; - case VERIFIER_HEADER_VER_BUFFER_UTTERANCE: - verifier_header->ver_buffer_utterance = src_verifier_header->ver_buffer_utterance; - break; - case VERIFIER_HEADER_INPUT_WAVEFORM_URI: - verifier_header->input_waveform_uri = *value; - break; - case VERIFIER_HEADER_COMPLETION_CAUSE: - verifier_header->completion_cause = src_verifier_header->completion_cause; - break; - case VERIFIER_HEADER_COMPLETION_REASON: - verifier_header->completion_reason = *value; - break; - case VERIFIER_HEADER_SPEECH_COMPLETE_TIMEOUT: - verifier_header->speech_complete_timeout = src_verifier_header->speech_complete_timeout; - break; - case VERIFIER_HEADER_NEW_AUDIO_CHANNEL: - verifier_header->new_audio_channel = src_verifier_header->new_audio_channel; - break; - case VERIFIER_HEADER_ABORT_VERIFICATION: - verifier_header->abort_verification = src_verifier_header->abort_verification; - break; - case VERIFIER_HEADER_START_INPUT_TIMERS: - verifier_header->start_input_timers = src_verifier_header->start_input_timers; - break; - default: - status = FALSE; - } - return status; -} - -static const mrcp_header_vtable_t header_vtable = { - mrcp_verifier_header_allocate, - NULL, /* nothing to destroy */ - mrcp_verifier_header_parse, - mrcp_verifier_header_generate, - mrcp_verifier_header_duplicate, - verifier_header_string_table, - VERIFIER_HEADER_COUNT -}; - -const mrcp_header_vtable_t* mrcp_verifier_header_vtable_get(mrcp_version_e version) -{ - return &header_vtable; -} - -MRCP_DECLARE(const apt_str_t*) mrcp_verifier_completion_cause_get(mrcp_verifier_completion_cause_e completion_cause, mrcp_version_e version) -{ - const apt_str_table_item_t *table = completion_cause_string_table; - return apt_string_table_str_get(table,VERIFIER_COMPLETION_CAUSE_COUNT,completion_cause); -} diff --git a/libs/unimrcp/libs/mrcp/resources/src/mrcp_verifier_resource.c b/libs/unimrcp/libs/mrcp/resources/src/mrcp_verifier_resource.c deleted file mode 100644 index 6f430a6619..0000000000 --- a/libs/unimrcp/libs/mrcp/resources/src/mrcp_verifier_resource.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: - */ - -#include "mrcp_verifier_resource.h" -#include "mrcp_verifier_header.h" -#include "mrcp_resource.h" - -/** String table of MRCP verifier methods (mrcp_verifier_method_id) */ -static const apt_str_table_item_t verifier_method_string_table[] = { - {{"SET-PARAMS", 10},10}, - {{"GET-PARAMS", 10},10}, - {{"START-SESSION", 13},8}, - {{"END-SESSION", 11},0}, - {{"QUERY-VOICEPRINT", 16},0}, - {{"DELETE-VOICEPRINT", 17},0}, - {{"VERIFY", 6},6}, - {{"VERIFY-FROM-BUFFER", 18},7}, - {{"VERIFY-ROLLBACK", 15},7}, - {{"STOP", 4},2}, - {{"CLEAR-BUFFER", 12},0}, - {{"START-INPUT-TIMERS", 18},6}, - {{"GET-INTERMEDIATE-RESULT",23},4}, -}; - -/** String table of MRCP verifier events (mrcp_verifier_event_id) */ -static const apt_str_table_item_t verifier_event_string_table[] = { - {{"START-OF-INPUT", 14},0}, - {{"VERIFICATION-COMPLETE",21},0}, -}; - -static APR_INLINE const apt_str_table_item_t* verifier_method_string_table_get(mrcp_version_e version) -{ - return verifier_method_string_table; -} - -static APR_INLINE const apt_str_table_item_t* verifier_event_string_table_get(mrcp_version_e version) -{ - return verifier_event_string_table; -} - - -/** Create MRCP verifier resource */ -MRCP_DECLARE(mrcp_resource_t*) mrcp_verifier_resource_create(apr_pool_t *pool) -{ - mrcp_resource_t *resource = mrcp_resource_create(pool); - - resource->method_count = VERIFIER_METHOD_COUNT; - resource->event_count = VERIFIER_EVENT_COUNT; - resource->get_method_str_table = verifier_method_string_table_get; - resource->get_event_str_table = verifier_event_string_table_get; - resource->get_resource_header_vtable = mrcp_verifier_header_vtable_get; - return resource; -} diff --git a/libs/unimrcp/libs/mrcpv2-transport/Makefile.am b/libs/unimrcp/libs/mrcpv2-transport/Makefile.am deleted file mode 100644 index c2ffac4ef0..0000000000 --- a/libs/unimrcp/libs/mrcpv2-transport/Makefile.am +++ /dev/null @@ -1,23 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -AM_CPPFLAGS = -I$(top_srcdir)/libs/mrcpv2-transport/include \ - -I$(top_srcdir)/libs/mrcp/include \ - -I$(top_srcdir)/libs/mrcp/message/include \ - -I$(top_srcdir)/libs/mrcp/control/include \ - -I$(top_srcdir)/libs/apr-toolkit/include \ - $(UNIMRCP_APR_INCLUDES) - -noinst_LTLIBRARIES = libmrcpv2transport.la - -include_HEADERS = include/mrcp_connection_types.h \ - include/mrcp_control_descriptor.h \ - include/mrcp_connection.h \ - include/mrcp_client_connection.h \ - include/mrcp_server_connection.h \ - include/mrcp_ca_factory.h - -libmrcpv2transport_la_SOURCES = src/mrcp_control_descriptor.c \ - src/mrcp_connection.c \ - src/mrcp_client_connection.c \ - src/mrcp_server_connection.c \ - src/mrcp_ca_factory.c diff --git a/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_ca_factory.h b/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_ca_factory.h deleted file mode 100644 index 599a4e60b7..0000000000 --- a/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_ca_factory.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_ca_factory.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_CA_FACTORY_H -#define MRCP_CA_FACTORY_H - -/** - * @file mrcp_ca_factory.h - * @brief Factory of MRCPv2 Connection Agents - */ - -#include "mrcp_connection_types.h" - -APT_BEGIN_EXTERN_C - -/** Create factory of connection agents. */ -MRCP_DECLARE(mrcp_ca_factory_t*) mrcp_ca_factory_create(apr_pool_t *pool); - -/** Add connection agent to factory. */ -MRCP_DECLARE(apt_bool_t) mrcp_ca_factory_agent_add(mrcp_ca_factory_t *mpf_factory, mrcp_connection_agent_t *agent); - -/** Determine whether factory is empty. */ -MRCP_DECLARE(apt_bool_t) mrcp_ca_factory_is_empty(const mrcp_ca_factory_t *factory); - -/** Select next available agent. */ -MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_ca_factory_agent_select(mrcp_ca_factory_t *factory); - -APT_END_EXTERN_C - -#endif /* MRCP_CA_FACTORY_H */ diff --git a/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_client_connection.h b/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_client_connection.h deleted file mode 100644 index fd762bb1f9..0000000000 --- a/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_client_connection.h +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_client_connection.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_CLIENT_CONNECTION_H -#define MRCP_CLIENT_CONNECTION_H - -/** - * @file mrcp_client_connection.h - * @brief MRCPv2 Client Connection - */ - -#include "apt_task.h" -#include "mrcp_connection_types.h" - -APT_BEGIN_EXTERN_C - -/** - * Create connection agent. - * @param id the identifier of the agent - * @param max_connection_count the number of max MRCPv2 connections - * @param offer_new_connection the connection establishment policy in o/a - * @param pool the pool to allocate memory from - */ -MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_client_connection_agent_create( - const char *id, - apr_size_t max_connection_count, - apt_bool_t offer_new_connection, - apr_pool_t *pool); - -/** - * Destroy connection agent. - * @param agent the agent to destroy - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_connection_agent_destroy(mrcp_connection_agent_t *agent); - -/** - * Start connection agent and wait for incoming requests. - * @param agent the agent to start - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_connection_agent_start(mrcp_connection_agent_t *agent); - -/** - * Terminate connection agent. - * @param agent the agent to terminate - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_connection_agent_terminate(mrcp_connection_agent_t *agent); - - -/** - * Set connection event handler. - * @param agent the agent to set event hadler for - * @param obj the external object to associate with the agent - * @param vtable the event handler virtual methods - */ -MRCP_DECLARE(void) mrcp_client_connection_agent_handler_set( - mrcp_connection_agent_t *agent, - void *obj, - const mrcp_connection_event_vtable_t *vtable); - -/** - * Set MRCP resource factory. - * @param agent the agent to set resource factory for - * @param resource_factory the MRCP resource factory to set - */ -MRCP_DECLARE(void) mrcp_client_connection_resource_factory_set( - mrcp_connection_agent_t *agent, - const mrcp_resource_factory_t *resource_factory); -/** - * Set rx buffer size. - * @param agent the agent to set buffer size for - * @param size the size of rx buffer to set - */ -MRCP_DECLARE(void) mrcp_client_connection_rx_size_set( - mrcp_connection_agent_t *agent, - apr_size_t size); - -/** - * Set tx buffer size. - * @param agent the agent to set buffer size for - * @param size the size of the rx buffer to set - */ -MRCP_DECLARE(void) mrcp_client_connection_tx_size_set( - mrcp_connection_agent_t *agent, - apr_size_t size); -/** - * Set request timeout. - * @param agent the agent to set timeout for - * @param timeout the timeout to set - */ -MRCP_DECLARE(void) mrcp_client_connection_timeout_set( - mrcp_connection_agent_t *agent, - apr_size_t timeout); - -/** - * Get task. - * @param agent the agent to get task from - */ -MRCP_DECLARE(apt_task_t*) mrcp_client_connection_agent_task_get(const mrcp_connection_agent_t *agent); - -/** - * Get external object. - * @param agent the agent to get object from - */ -MRCP_DECLARE(void*) mrcp_client_connection_agent_object_get(const mrcp_connection_agent_t *agent); - -/** - * Get string identifier. - * @param agent the agent to get identifier of - */ -MRCP_DECLARE(const char*) mrcp_client_connection_agent_id_get(const mrcp_connection_agent_t *agent); - - -/** - * Create control channel. - * @param agent the agent to create channel for - * @param obj the external object to associate with the control channel - * @param pool the pool to allocate memory from - */ -MRCP_DECLARE(mrcp_control_channel_t*) mrcp_client_control_channel_create( - mrcp_connection_agent_t *agent, - void *obj, - apr_pool_t *pool); - -/** - * Add MRCPv2 control channel. - * @param channel the control channel to add - * @param descriptor the control descriptor - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_control_channel_add( - mrcp_control_channel_t *channel, - mrcp_control_descriptor_t *descriptor); - -/** - * Modify MRCPv2 control channel. - * @param channel the control channel to modify - * @param descriptor the control descriptor - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_control_channel_modify( - mrcp_control_channel_t *channel, - mrcp_control_descriptor_t *descriptor); - -/** - * Remove MRCPv2 control channel. - * @param channel the control channel to remove - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_control_channel_remove(mrcp_control_channel_t *channel); - -/** - * Destroy MRCPv2 control channel. - * @param channel the control channel to destroy - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_control_channel_destroy(mrcp_control_channel_t *channel); - -/** - * Send MRCPv2 message. - * @param channel the control channel to send message through - * @param message the message to send - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_control_message_send(mrcp_control_channel_t *channel, mrcp_message_t *message); - -/** - * Set the logger object. - * @param channel the control channel to set the object for - * @param log_obj the object to set - */ -MRCP_DECLARE(void) mrcp_client_control_channel_log_obj_set(mrcp_control_channel_t *channel, void *log_obj); - - -APT_END_EXTERN_C - -#endif /* MRCP_CLIENT_CONNECTION_H */ diff --git a/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_connection.h b/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_connection.h deleted file mode 100644 index fd2f39dca0..0000000000 --- a/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_connection.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_connection.h 2170 2014-09-09 05:19:48Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_CONNECTION_H -#define MRCP_CONNECTION_H - -/** - * @file mrcp_connection.h - * @brief MRCP Connection - */ - -#include -#include -#ifdef WIN32 -#pragma warning(disable: 4127) -#endif -#include -#include "mrcp_connection_types.h" -#include "mrcp_stream.h" - -APT_BEGIN_EXTERN_C - -/** Size of the buffer used for MRCP rx/tx stream */ -#define MRCP_STREAM_BUFFER_SIZE 1024 - -/** MRCPv2 connection */ -struct mrcp_connection_t { - /** Ring entry */ - APR_RING_ENTRY(mrcp_connection_t) link; - - /** Memory pool */ - apr_pool_t *pool; - - /** Accepted/Connected socket */ - apr_socket_t *sock; - /** Socket poll descriptor */ - apr_pollfd_t sock_pfd; - /** Local sockaddr */ - apr_sockaddr_t *l_sockaddr; - /** Remote sockaddr */ - apr_sockaddr_t *r_sockaddr; - /** Remote IP */ - apt_str_t remote_ip; - /** String identifier used for traces */ - const char *id; - /** Transparently dump whatever received/sent on transport layer, - if verbose is set to TRUE (default) */ - apt_bool_t verbose; - - /** Reference count */ - apr_size_t access_count; - /** Opaque agent */ - void *agent; - - /** Table of control channels */ - apr_hash_t *channel_table; - - /** Rx buffer */ - char *rx_buffer; - /** Rx buffer size */ - apr_size_t rx_buffer_size; - /** Rx stream */ - apt_text_stream_t rx_stream; - /** MRCP parser to parser MRCP messages out of rx stream */ - mrcp_parser_t *parser; - - /** Tx buffer */ - char *tx_buffer; - /** Tx buffer size */ - apr_size_t tx_buffer_size; - /** MRCP generator to generate MRCP messages into tx stream */ - mrcp_generator_t *generator; -}; - -/** Create MRCP connection. */ -mrcp_connection_t* mrcp_connection_create(void); - -/** Destroy MRCP connection. */ -void mrcp_connection_destroy(mrcp_connection_t *connection); - -/** Add Control Channel to MRCP connection. */ -apt_bool_t mrcp_connection_channel_add(mrcp_connection_t *connection, mrcp_control_channel_t *channel); - -/** Find Control Channel by Channel Identifier. */ -mrcp_control_channel_t* mrcp_connection_channel_find(const mrcp_connection_t *connection, const apt_str_t *identifier); - -/** Remove Control Channel from MRCP connection. */ -apt_bool_t mrcp_connection_channel_remove(mrcp_connection_t *connection, mrcp_control_channel_t *channel); - -/** Raise disconnect event for each channel from the specified connection. */ -apt_bool_t mrcp_connection_disconnect_raise(mrcp_connection_t *connection, const mrcp_connection_event_vtable_t *vtable); - -APT_END_EXTERN_C - -#endif /* MRCP_CONNECTION_H */ diff --git a/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_connection_types.h b/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_connection_types.h deleted file mode 100644 index 6f98564dbd..0000000000 --- a/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_connection_types.h +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_connection_types.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_CONNECTION_TYPES_H -#define MRCP_CONNECTION_TYPES_H - -/** - * @file mrcp_connection_types.h - * @brief MRCP Connection Types Declaration - */ - -#include -#include "apt_string.h" -#include "apt_timer_queue.h" -#include "mrcp_types.h" - -APT_BEGIN_EXTERN_C - -/** Opaque MRCPv2 control descriptor declaration */ -typedef struct mrcp_control_descriptor_t mrcp_control_descriptor_t; - -/** Opaque MRCPv2 connection declaration */ -typedef struct mrcp_connection_t mrcp_connection_t; - -/** Opaque MRCPv2 control channel declaration */ -typedef struct mrcp_control_channel_t mrcp_control_channel_t; - -/** Opaque MRCPv2 connection agent declaration */ -typedef struct mrcp_connection_agent_t mrcp_connection_agent_t; - -/** Opaque MRCPv2 connection agent factory declaration */ -typedef struct mrcp_ca_factory_t mrcp_ca_factory_t; - -/** MRCPv2 connection event vtable declaration */ -typedef struct mrcp_connection_event_vtable_t mrcp_connection_event_vtable_t; - -/** MRCPv2 connection event vtable */ -struct mrcp_connection_event_vtable_t { - /** Channel add event handler */ - apt_bool_t (*on_add)(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status); - /** Channel modify event handler */ - apt_bool_t (*on_modify)(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status); - /** Channel remove event handler */ - apt_bool_t (*on_remove)(mrcp_control_channel_t *channel, apt_bool_t status); - /** Message receive event handler */ - apt_bool_t (*on_receive)(mrcp_control_channel_t *channel, mrcp_message_t *message); - /** Disconnect event handler */ - apt_bool_t (*on_disconnect)(mrcp_control_channel_t *channel); -}; - -/** MRCPv2 control channel */ -struct mrcp_control_channel_t { - /** MRCPv2 Connection agent */ - mrcp_connection_agent_t *agent; - /** MRCPv2 (shared) connection */ - mrcp_connection_t *connection; - /** Request sent to the server and waiting for a response */ - mrcp_message_t *active_request; - /** Timer used for request timeouts */ - apt_timer_t *request_timer; - /** Indicate removed connection (safe to destroy) */ - apt_bool_t removed; - /** External object associated with the channel */ - void *obj; - /** External logger object associated with the channel */ - void *log_obj; - /** Pool to allocate memory from */ - apr_pool_t *pool; - /** Channel identifier (id at resource) */ - apt_str_t identifier; -}; - -/** Send channel add response */ -static APR_INLINE apt_bool_t mrcp_control_channel_add_respond( - const mrcp_connection_event_vtable_t *vtable, - mrcp_control_channel_t *channel, - mrcp_control_descriptor_t *descriptor, - apt_bool_t status) -{ - if(vtable && vtable->on_add) { - return vtable->on_add(channel,descriptor,status); - } - return FALSE; -} - -/** Send channel modify response */ -static APR_INLINE apt_bool_t mrcp_control_channel_modify_respond( - const mrcp_connection_event_vtable_t *vtable, - mrcp_control_channel_t *channel, - mrcp_control_descriptor_t *descriptor, - apt_bool_t status) -{ - if(vtable && vtable->on_modify) { - return vtable->on_modify(channel,descriptor,status); - } - return FALSE; -} - -/** Send channel remove response */ -static APR_INLINE apt_bool_t mrcp_control_channel_remove_respond( - const mrcp_connection_event_vtable_t *vtable, - mrcp_control_channel_t *channel, - apt_bool_t status) -{ - if(vtable && vtable->on_remove) { - return vtable->on_remove(channel,status); - } - return FALSE; -} - -/** Send MRCP message receive event */ -static APR_INLINE apt_bool_t mrcp_connection_message_receive( - const mrcp_connection_event_vtable_t *vtable, - mrcp_control_channel_t *channel, - mrcp_message_t *message) -{ - if(vtable && vtable->on_receive) { - return vtable->on_receive(channel,message); - } - return FALSE; -} - -APT_END_EXTERN_C - -#endif /* MRCP_CONNECTION_TYPES_H */ diff --git a/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_control_descriptor.h b/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_control_descriptor.h deleted file mode 100644 index 9597970ddf..0000000000 --- a/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_control_descriptor.h +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_control_descriptor.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_CONTROL_DESCRIPTOR_H -#define MRCP_CONTROL_DESCRIPTOR_H - -/** - * @file mrcp_control_descriptor.h - * @brief MRCPv2 Control Descriptor - */ - -#include -#include "apt_string.h" -#include "mrcp_connection_types.h" - -APT_BEGIN_EXTERN_C - -/** TCP discard port used in offer/answer */ -#define TCP_DISCARD_PORT 9 - - -/** MRCPv2 proto transport */ -typedef enum { - MRCP_PROTO_TCP, - MRCP_PROTO_TLS, - - MRCP_PROTO_COUNT, - MRCP_PROTO_UNKNOWN = MRCP_PROTO_COUNT -}mrcp_proto_type_e; - - -/** MRCPv2 attributes */ -typedef enum { - MRCP_ATTRIB_SETUP, - MRCP_ATTRIB_CONNECTION, - MRCP_ATTRIB_RESOURCE, - MRCP_ATTRIB_CHANNEL, - MRCP_ATTRIB_CMID, - - MRCP_ATTRIB_COUNT, - MRCP_ATTRIB_UNKNOWN = MRCP_ATTRIB_COUNT -}mrcp_attrib_e; - - -/** MRCPv2 setup attributes */ -typedef enum { - MRCP_SETUP_TYPE_ACTIVE, - MRCP_SETUP_TYPE_PASSIVE, - - MRCP_SETUP_TYPE_COUNT, - MRCP_SETUP_TYPE_UNKNOWN = MRCP_SETUP_TYPE_COUNT -} mrcp_setup_type_e; - -/** MRCPv2 connection attributes */ -typedef enum { - MRCP_CONNECTION_TYPE_NEW, - MRCP_CONNECTION_TYPE_EXISTING, - - MRCP_CONNECTION_TYPE_COUNT, - MRCP_CONNECTION_TYPE_UNKNOWN = MRCP_CONNECTION_TYPE_COUNT -} mrcp_connection_type_e; - - -/** MRCPv2 control descriptor */ -struct mrcp_control_descriptor_t { - /** IP address */ - apt_str_t ip; - /** Port */ - apr_port_t port; - /** Protocol type */ - mrcp_proto_type_e proto; - /** Setup type */ - mrcp_setup_type_e setup_type; - /** Connection type */ - mrcp_connection_type_e connection_type; - /** Resource name */ - apt_str_t resource_name; - /** Session identifier */ - apt_str_t session_id; - /** Array of cmid attributes */ - apr_array_header_t *cmid_arr; - /** Base identifier */ - apr_size_t id; -}; - - -/** Create MRCP control descriptor */ -MRCP_DECLARE(mrcp_control_descriptor_t*) mrcp_control_descriptor_create(apr_pool_t *pool); - -/** Create MRCP control offer */ -MRCP_DECLARE(mrcp_control_descriptor_t*) mrcp_control_offer_create(apr_pool_t *pool); - -/** Create MRCP control answer */ -MRCP_DECLARE(mrcp_control_descriptor_t*) mrcp_control_answer_create(mrcp_control_descriptor_t *offer, apr_pool_t *pool); - -/** Add cmid to cmid_arr */ -MRCP_DECLARE(void) mrcp_cmid_add(apr_array_header_t *cmid_arr, apr_size_t cmid); - -/** Find cmid in cmid_arr */ -MRCP_DECLARE(apt_bool_t) mrcp_cmid_find(const apr_array_header_t *cmid_arr, apr_size_t cmid); - -/** Get MRCP protocol transport name by identifier */ -MRCP_DECLARE(const apt_str_t*) mrcp_proto_get(mrcp_proto_type_e proto); - -/** Find MRCP protocol transport identifier by name */ -MRCP_DECLARE(mrcp_proto_type_e) mrcp_proto_find(const apt_str_t *attrib); - - -/** Get MRCP attribute name by identifier */ -MRCP_DECLARE(const apt_str_t*) mrcp_attrib_str_get(mrcp_attrib_e attrib_id); - -/** Find MRCP attribute identifier by name */ -MRCP_DECLARE(mrcp_attrib_e) mrcp_attrib_id_find(const apt_str_t *attrib); - - -/** Get MRCP setup type name by identifier */ -MRCP_DECLARE(const apt_str_t*) mrcp_setup_type_get(mrcp_setup_type_e setup_type); - -/** Find MRCP setup type identifier by name */ -MRCP_DECLARE(mrcp_setup_type_e) mrcp_setup_type_find(const apt_str_t *attrib); - - -/** Get MRCP connection type name by identifier */ -MRCP_DECLARE(const apt_str_t*) mrcp_connection_type_get(mrcp_connection_type_e connection_type); - -/** Find MRCP connection type identifier by name */ -MRCP_DECLARE(mrcp_connection_type_e) mrcp_connection_type_find(const apt_str_t *attrib); - - -APT_END_EXTERN_C - -#endif /* MRCP_CONTROL_DESCRIPTOR_H */ diff --git a/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_server_connection.h b/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_server_connection.h deleted file mode 100644 index df99cc1a40..0000000000 --- a/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_server_connection.h +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_server_connection.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_SERVER_CONNECTION_H -#define MRCP_SERVER_CONNECTION_H - -/** - * @file mrcp_server_connection.h - * @brief MRCPv2 Server Connection - */ - -#include "apt_task.h" -#include "mrcp_connection_types.h" - -APT_BEGIN_EXTERN_C - -/** - * Create connection agent. - * @param id the identifier of the engine - * @param listen_ip the IP address to listen on - * @param listen_port the port to listen on - * @param max_connection_count the number of max MRCPv2 connections - * @param force_new_connection the policy used in o/a for connection establishment - * @param pool the pool to allocate memory from - */ -MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_server_connection_agent_create( - const char *id, - const char *listen_ip, - apr_port_t listen_port, - apr_size_t max_connection_count, - apt_bool_t force_new_connection, - apr_pool_t *pool); - -/** - * Destroy connection agent. - * @param agent the agent to destroy - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_connection_agent_destroy(mrcp_connection_agent_t *agent); - -/** - * Start connection agent and wait for incoming requests. - * @param agent the agent to start - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_connection_agent_start(mrcp_connection_agent_t *agent); - -/** - * Terminate connection agent. - * @param agent the agent to terminate - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_connection_agent_terminate(mrcp_connection_agent_t *agent); - -/** - * Set connection event handler. - * @param agent the agent to set event hadler for - * @param obj the external object to associate with the agent - * @param vtable the event handler virtual methods - */ -MRCP_DECLARE(void) mrcp_server_connection_agent_handler_set( - mrcp_connection_agent_t *agent, - void *obj, - const mrcp_connection_event_vtable_t *vtable); - -/** - * Set MRCP resource factory. - * @param agent the agent to set resource factory for - * @param resource_factory the MRCP resource factory to set - */ -MRCP_DECLARE(void) mrcp_server_connection_resource_factory_set( - mrcp_connection_agent_t *agent, - const mrcp_resource_factory_t *resource_factory); - -/** - * Set rx buffer size. - * @param agent the agent to set buffer size for - * @param size the size of rx buffer to set - */ -MRCP_DECLARE(void) mrcp_server_connection_rx_size_set( - mrcp_connection_agent_t *agent, - apr_size_t size); - -/** - * Set tx buffer size. - * @param agent the agent to set buffer size for - * @param size the size of the rx buffer to set - */ -MRCP_DECLARE(void) mrcp_server_connection_tx_size_set( - mrcp_connection_agent_t *agent, - apr_size_t size); - -/** - * Get task. - * @param agent the agent to get task from - */ -MRCP_DECLARE(apt_task_t*) mrcp_server_connection_agent_task_get(const mrcp_connection_agent_t *agent); - -/** - * Get external object. - * @param agent the agent to get object from - */ -MRCP_DECLARE(void*) mrcp_server_connection_agent_object_get(const mrcp_connection_agent_t *agent); - -/** - * Get string identifier. - * @param agent the agent to get identifier of - */ -MRCP_DECLARE(const char*) mrcp_server_connection_agent_id_get(const mrcp_connection_agent_t *agent); - - -/** - * Create control channel. - * @param agent the agent to create channel for - * @param obj the external object to associate with the control channel - * @param pool the pool to allocate memory from - */ -MRCP_DECLARE(mrcp_control_channel_t*) mrcp_server_control_channel_create( - mrcp_connection_agent_t *agent, - void *obj, - apr_pool_t *pool); - -/** - * Add MRCPv2 control channel. - * @param channel the control channel to add - * @param descriptor the control descriptor - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_control_channel_add( - mrcp_control_channel_t *channel, - mrcp_control_descriptor_t *descriptor); - -/** - * Modify MRCPv2 control channel. - * @param channel the control channel to modify - * @param descriptor the control descriptor - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_control_channel_modify( - mrcp_control_channel_t *channel, - mrcp_control_descriptor_t *descriptor); - -/** - * Remove MRCPv2 control channel. - * @param channel the control channel to remove - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_control_channel_remove(mrcp_control_channel_t *channel); - -/** - * Destroy MRCPv2 control channel. - * @param channel the control channel to destroy - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_control_channel_destroy(mrcp_control_channel_t *channel); - -/** - * Send MRCPv2 message. - * @param channel the control channel to send message through - * @param message the message to send - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_control_message_send(mrcp_control_channel_t *channel, mrcp_message_t *message); - - -APT_END_EXTERN_C - -#endif /* MRCP_SERVER_CONNECTION_H */ diff --git a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj.filters b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj.filters deleted file mode 100644 index 576ef8ae7e..0000000000 --- a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj.filters +++ /dev/null @@ -1,47 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {a92d3b8c-d54d-416c-b458-dc57ac24d2e9} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - include - - - include - - - include - - - include - - - include - - - - - src - - - src - - - src - - - src - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2017.vcxproj b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2017.vcxproj deleted file mode 100644 index 40a20105bf..0000000000 --- a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2017.vcxproj +++ /dev/null @@ -1,134 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - mrcpv2transport - {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA} - mrcpv2transport - Win32Proj - - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(SolutionDir)$(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(SolutionDir)$(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - - - - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) - - - - - X64 - - - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) - ProgramDatabase - - - - - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) - - - - - X64 - - - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) - - - - - - - - - - - - - - - - - - - {f6c55d93-b927-4483-bb69-15aef3dd2dff} - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcproj b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcproj deleted file mode 100644 index 526f1e36a3..0000000000 --- a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcproj +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcxproj b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcxproj deleted file mode 100644 index 4d99d355c3..0000000000 --- a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcxproj +++ /dev/null @@ -1,125 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA} - mrcpv2transport - Win32Proj - - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - X64 - - - ProgramDatabase - - - - - X64 - - - - - - - - - - - - - - - - - - - - {1c320193-46a6-4b34-9c56-8ab584fc1b56} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcxproj.filters b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcxproj.filters deleted file mode 100644 index d573ce6367..0000000000 --- a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcxproj.filters +++ /dev/null @@ -1,50 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {119450fa-653a-4fdc-9017-a4350ff3066c} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - include - - - include - - - include - - - include - - - include - - - include - - - - - src - - - src - - - src - - - src - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_ca_factory.c b/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_ca_factory.c deleted file mode 100644 index b588ee200c..0000000000 --- a/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_ca_factory.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_ca_factory.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include "mrcp_ca_factory.h" - -/** Factory of MRCPv2 connection agents */ -struct mrcp_ca_factory_t { - /** Array of pointers to agents */ - apr_array_header_t *agent_arr; - /** Index of the current agent */ - int index; -}; - -/** Create factory of connection agents. */ -MRCP_DECLARE(mrcp_ca_factory_t*) mrcp_ca_factory_create(apr_pool_t *pool) -{ - mrcp_ca_factory_t *factory = apr_palloc(pool,sizeof(mrcp_ca_factory_t)); - factory->agent_arr = apr_array_make(pool,1,sizeof(mrcp_connection_agent_t*)); - factory->index = 0; - return factory; -} - -/** Add connection agent to factory. */ -MRCP_DECLARE(apt_bool_t) mrcp_ca_factory_agent_add(mrcp_ca_factory_t *factory, mrcp_connection_agent_t *agent) -{ - mrcp_connection_agent_t **slot; - if(!agent) - return FALSE; - - slot = apr_array_push(factory->agent_arr); - *slot = agent; - return TRUE; -} - -/** Determine whether factory is empty. */ -MRCP_DECLARE(apt_bool_t) mrcp_ca_factory_is_empty(const mrcp_ca_factory_t *factory) -{ - return apr_is_empty_array(factory->agent_arr); -} - -/** Select next available agent. */ -MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_ca_factory_agent_select(mrcp_ca_factory_t *factory) -{ - mrcp_connection_agent_t *agent = APR_ARRAY_IDX(factory->agent_arr, factory->index, mrcp_connection_agent_t*); - if(++factory->index == factory->agent_arr->nelts) { - factory->index = 0; - } - return agent; -} diff --git a/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_client_connection.c b/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_client_connection.c deleted file mode 100644 index 359df52f47..0000000000 --- a/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_client_connection.c +++ /dev/null @@ -1,696 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_client_connection.c 2249 2014-11-19 05:26:24Z achaloyan@gmail.com $ - */ - -#include "mrcp_connection.h" -#include "mrcp_client_connection.h" -#include "mrcp_control_descriptor.h" -#include "mrcp_resource_factory.h" -#include "mrcp_message.h" -#include "apt_text_stream.h" -#include "apt_poller_task.h" -#include "apt_log.h" - - -struct mrcp_connection_agent_t { - /** List (ring) of MRCP connections */ - APR_RING_HEAD(mrcp_connection_head_t, mrcp_connection_t) connection_list; - - apr_pool_t *pool; - apt_poller_task_t *task; - const mrcp_resource_factory_t *resource_factory; - - apr_uint32_t request_timeout; - apt_bool_t offer_new_connection; - apr_size_t tx_buffer_size; - apr_size_t rx_buffer_size; - - void *obj; - const mrcp_connection_event_vtable_t *vtable; -}; - -typedef enum { - CONNECTION_TASK_MSG_ADD_CHANNEL, - CONNECTION_TASK_MSG_MODIFY_CHANNEL, - CONNECTION_TASK_MSG_REMOVE_CHANNEL, - CONNECTION_TASK_MSG_SEND_MESSAGE -} connection_task_msg_type_e; - -typedef struct connection_task_msg_t connection_task_msg_t; -struct connection_task_msg_t { - connection_task_msg_type_e type; - mrcp_connection_agent_t *agent; - mrcp_control_channel_t *channel; - mrcp_control_descriptor_t *descriptor; - mrcp_message_t *message; -}; - - -static apt_bool_t mrcp_client_agent_msg_process(apt_task_t *task, apt_task_msg_t *task_msg); -static apt_bool_t mrcp_client_poller_signal_process(void *obj, const apr_pollfd_t *descriptor); -static void mrcp_client_timer_proc(apt_timer_t *timer, void *obj); - -/** Create connection agent. */ -MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_client_connection_agent_create( - const char *id, - apr_size_t max_connection_count, - apt_bool_t offer_new_connection, - apr_pool_t *pool) -{ - apt_task_t *task; - apt_task_vtable_t *vtable; - apt_task_msg_pool_t *msg_pool; - mrcp_connection_agent_t *agent; - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create MRCPv2 Agent [%s] [%"APR_SIZE_T_FMT"]", - id, max_connection_count); - agent = apr_palloc(pool,sizeof(mrcp_connection_agent_t)); - agent->pool = pool; - agent->request_timeout = 0; - agent->offer_new_connection = offer_new_connection; - agent->rx_buffer_size = MRCP_STREAM_BUFFER_SIZE; - agent->tx_buffer_size = MRCP_STREAM_BUFFER_SIZE; - - msg_pool = apt_task_msg_pool_create_dynamic(sizeof(connection_task_msg_t),pool); - - agent->task = apt_poller_task_create( - max_connection_count, - mrcp_client_poller_signal_process, - agent, - msg_pool, - pool); - if(!agent->task) { - return NULL; - } - - task = apt_poller_task_base_get(agent->task); - if(task) { - apt_task_name_set(task,id); - } - - vtable = apt_poller_task_vtable_get(agent->task); - if(vtable) { - vtable->process_msg = mrcp_client_agent_msg_process; - } - - APR_RING_INIT(&agent->connection_list, mrcp_connection_t, link); - return agent; -} - -/** Destroy connection agent. */ -MRCP_DECLARE(apt_bool_t) mrcp_client_connection_agent_destroy(mrcp_connection_agent_t *agent) -{ - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy MRCPv2 Agent [%s]", - mrcp_client_connection_agent_id_get(agent)); - return apt_poller_task_destroy(agent->task); -} - -/** Start connection agent. */ -MRCP_DECLARE(apt_bool_t) mrcp_client_connection_agent_start(mrcp_connection_agent_t *agent) -{ - return apt_poller_task_start(agent->task); -} - -/** Terminate connection agent. */ -MRCP_DECLARE(apt_bool_t) mrcp_client_connection_agent_terminate(mrcp_connection_agent_t *agent) -{ - return apt_poller_task_terminate(agent->task); -} - -/** Set connection event handler. */ -MRCP_DECLARE(void) mrcp_client_connection_agent_handler_set( - mrcp_connection_agent_t *agent, - void *obj, - const mrcp_connection_event_vtable_t *vtable) -{ - agent->obj = obj; - agent->vtable = vtable; -} - -/** Set MRCP resource factory */ -MRCP_DECLARE(void) mrcp_client_connection_resource_factory_set( - mrcp_connection_agent_t *agent, - const mrcp_resource_factory_t *resource_factroy) -{ - agent->resource_factory = resource_factroy; -} - -/** Set rx buffer size */ -MRCP_DECLARE(void) mrcp_client_connection_rx_size_set( - mrcp_connection_agent_t *agent, - apr_size_t size) -{ - if(size < MRCP_STREAM_BUFFER_SIZE) { - size = MRCP_STREAM_BUFFER_SIZE; - } - agent->rx_buffer_size = size; -} - -/** Set tx buffer size */ -MRCP_DECLARE(void) mrcp_client_connection_tx_size_set( - mrcp_connection_agent_t *agent, - apr_size_t size) -{ - if(size < MRCP_STREAM_BUFFER_SIZE) { - size = MRCP_STREAM_BUFFER_SIZE; - } - agent->tx_buffer_size = size; -} - -/** Set request timeout */ -MRCP_DECLARE(void) mrcp_client_connection_timeout_set( - mrcp_connection_agent_t *agent, - apr_size_t timeout) -{ - agent->request_timeout = (apr_uint32_t)timeout; -} - -/** Get task */ -MRCP_DECLARE(apt_task_t*) mrcp_client_connection_agent_task_get(const mrcp_connection_agent_t *agent) -{ - return apt_poller_task_base_get(agent->task); -} - -/** Get external object */ -MRCP_DECLARE(void*) mrcp_client_connection_agent_object_get(const mrcp_connection_agent_t *agent) -{ - return agent->obj; -} - -/** Get string identifier */ -MRCP_DECLARE(const char*) mrcp_client_connection_agent_id_get(const mrcp_connection_agent_t *agent) -{ - apt_task_t *task = apt_poller_task_base_get(agent->task); - return apt_task_name_get(task); -} - - -/** Create control channel */ -MRCP_DECLARE(mrcp_control_channel_t*) mrcp_client_control_channel_create(mrcp_connection_agent_t *agent, void *obj, apr_pool_t *pool) -{ - mrcp_control_channel_t *channel = apr_palloc(pool,sizeof(mrcp_control_channel_t)); - channel->agent = agent; - channel->connection = NULL; - channel->active_request = NULL; - channel->request_timer = NULL; - channel->removed = FALSE; - channel->obj = obj; - channel->log_obj = NULL; - channel->pool = pool; - - channel->request_timer = apt_poller_task_timer_create( - agent->task, - mrcp_client_timer_proc, - channel, - pool); - return channel; -} - -/** Set the logger object */ -MRCP_DECLARE(void) mrcp_client_control_channel_log_obj_set(mrcp_control_channel_t *channel, void *log_obj) -{ - channel->log_obj = log_obj; -} - -/** Destroy MRCPv2 control channel */ -MRCP_DECLARE(apt_bool_t) mrcp_client_control_channel_destroy(mrcp_control_channel_t *channel) -{ - if(channel && channel->connection && channel->removed == TRUE) { - mrcp_connection_t *connection = channel->connection; - channel->connection = NULL; - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy TCP/MRCPv2 Connection %s",connection->id); - mrcp_connection_destroy(connection); - } - return TRUE; -} - -/** Signal task message */ -static apt_bool_t mrcp_client_control_message_signal( - connection_task_msg_type_e type, - mrcp_connection_agent_t *agent, - mrcp_control_channel_t *channel, - mrcp_control_descriptor_t *descriptor, - mrcp_message_t *message) -{ - apt_task_t *task = apt_poller_task_base_get(agent->task); - apt_task_msg_t *task_msg = apt_task_msg_get(task); - if(task_msg) { - connection_task_msg_t *msg = (connection_task_msg_t*)task_msg->data; - msg->type = type; - msg->agent = agent; - msg->channel = channel; - msg->descriptor = descriptor; - msg->message = message; - apt_task_msg_signal(task,task_msg); - } - return TRUE; -} - -/** Add MRCPv2 control channel */ -MRCP_DECLARE(apt_bool_t) mrcp_client_control_channel_add(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor) -{ - return mrcp_client_control_message_signal(CONNECTION_TASK_MSG_ADD_CHANNEL,channel->agent,channel,descriptor,NULL); -} - -/** Modify MRCPv2 control channel */ -MRCP_DECLARE(apt_bool_t) mrcp_client_control_channel_modify(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor) -{ - return mrcp_client_control_message_signal(CONNECTION_TASK_MSG_MODIFY_CHANNEL,channel->agent,channel,descriptor,NULL); -} - -/** Remove MRCPv2 control channel */ -MRCP_DECLARE(apt_bool_t) mrcp_client_control_channel_remove(mrcp_control_channel_t *channel) -{ - return mrcp_client_control_message_signal(CONNECTION_TASK_MSG_REMOVE_CHANNEL,channel->agent,channel,NULL,NULL); -} - -/** Send MRCPv2 message */ -MRCP_DECLARE(apt_bool_t) mrcp_client_control_message_send(mrcp_control_channel_t *channel, mrcp_message_t *message) -{ - return mrcp_client_control_message_signal(CONNECTION_TASK_MSG_SEND_MESSAGE,channel->agent,channel,NULL,message); -} - -static mrcp_connection_t* mrcp_client_agent_connection_create(mrcp_connection_agent_t *agent, mrcp_control_descriptor_t *descriptor) -{ - char *local_ip = NULL; - char *remote_ip = NULL; - mrcp_connection_t *connection = mrcp_connection_create(); - - apr_sockaddr_info_get(&connection->r_sockaddr,descriptor->ip.buf,APR_INET,descriptor->port,0,connection->pool); - if(!connection->r_sockaddr) { - mrcp_connection_destroy(connection); - return NULL; - } - - if(apr_socket_create(&connection->sock,connection->r_sockaddr->family,SOCK_STREAM,APR_PROTO_TCP,connection->pool) != APR_SUCCESS) { - mrcp_connection_destroy(connection); - return NULL; - } - - apr_socket_opt_set(connection->sock, APR_SO_NONBLOCK, 0); - apr_socket_timeout_set(connection->sock, -1); - apr_socket_opt_set(connection->sock, APR_SO_REUSEADDR, 1); - - if(apr_socket_connect(connection->sock, connection->r_sockaddr) != APR_SUCCESS) { - apr_socket_close(connection->sock); - mrcp_connection_destroy(connection); - return NULL; - } - - if(apr_socket_addr_get(&connection->l_sockaddr,APR_LOCAL,connection->sock) != APR_SUCCESS) { - apr_socket_close(connection->sock); - mrcp_connection_destroy(connection); - return NULL; - } - - apr_sockaddr_ip_get(&local_ip,connection->l_sockaddr); - apr_sockaddr_ip_get(&remote_ip,connection->r_sockaddr); - connection->id = apr_psprintf(connection->pool,"%s:%hu <-> %s:%hu", - local_ip,connection->l_sockaddr->port, - remote_ip,connection->r_sockaddr->port); - - memset(&connection->sock_pfd,0,sizeof(apr_pollfd_t)); - connection->sock_pfd.desc_type = APR_POLL_SOCKET; - connection->sock_pfd.reqevents = APR_POLLIN; - connection->sock_pfd.desc.s = connection->sock; - connection->sock_pfd.client_data = connection; - if(apt_poller_task_descriptor_add(agent->task, &connection->sock_pfd) != TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Add to Pollset %s",connection->id); - apr_socket_close(connection->sock); - mrcp_connection_destroy(connection); - return NULL; - } - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Established TCP/MRCPv2 Connection %s",connection->id); - connection->agent = agent; - APR_RING_INSERT_TAIL(&agent->connection_list,connection,mrcp_connection_t,link); - - connection->parser = mrcp_parser_create(agent->resource_factory,connection->pool); - connection->generator = mrcp_generator_create(agent->resource_factory,connection->pool); - - connection->tx_buffer_size = agent->tx_buffer_size; - connection->tx_buffer = apr_palloc(connection->pool,connection->tx_buffer_size+1); - - connection->rx_buffer_size = agent->rx_buffer_size; - connection->rx_buffer = apr_palloc(connection->pool,connection->rx_buffer_size+1); - apt_text_stream_init(&connection->rx_stream,connection->rx_buffer,connection->rx_buffer_size); - - if(apt_log_masking_get() != APT_LOG_MASKING_NONE) { - connection->verbose = FALSE; - mrcp_parser_verbose_set(connection->parser,TRUE); - mrcp_generator_verbose_set(connection->generator,TRUE); - } - - return connection; -} - -static mrcp_connection_t* mrcp_client_agent_connection_find(mrcp_connection_agent_t *agent, mrcp_control_descriptor_t *descriptor) -{ - apr_sockaddr_t *sockaddr; - mrcp_connection_t *connection; - - for(connection = APR_RING_FIRST(&agent->connection_list); - connection != APR_RING_SENTINEL(&agent->connection_list, mrcp_connection_t, link); - connection = APR_RING_NEXT(connection, link)) { - if(apr_sockaddr_info_get(&sockaddr,descriptor->ip.buf,APR_INET,descriptor->port,0,connection->pool) == APR_SUCCESS) { - if(apr_sockaddr_equal(sockaddr,connection->r_sockaddr) != 0 && - descriptor->port == connection->r_sockaddr->port) { - return connection; - } - } - } - - return NULL; -} - -static apt_bool_t mrcp_client_agent_connection_remove(mrcp_connection_agent_t *agent, mrcp_connection_t *connection) -{ - /* remove from the list */ - APR_RING_REMOVE(connection,link); - - if(connection->sock) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Close TCP/MRCPv2 Connection %s",connection->id); - apt_poller_task_descriptor_remove(agent->task,&connection->sock_pfd); - apr_socket_close(connection->sock); - connection->sock = NULL; - } - return TRUE; -} - -static apt_bool_t mrcp_client_agent_channel_add(mrcp_connection_agent_t *agent, mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor) -{ - if(agent->offer_new_connection == TRUE) { - descriptor->connection_type = MRCP_CONNECTION_TYPE_NEW; - } - else { - descriptor->connection_type = MRCP_CONNECTION_TYPE_EXISTING; - if(APR_RING_EMPTY(&agent->connection_list, mrcp_connection_t, link)) { - /* offer new connection if there is no established connection yet */ - descriptor->connection_type = MRCP_CONNECTION_TYPE_NEW; - } - } - /* send response */ - return mrcp_control_channel_add_respond(agent->vtable,channel,descriptor,TRUE); -} - -static apt_bool_t mrcp_client_agent_channel_modify(mrcp_connection_agent_t *agent, mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor) -{ - apt_bool_t status = TRUE; - if(descriptor->port) { - if(!channel->connection) { - mrcp_connection_t *connection = NULL; - apt_id_resource_generate(&descriptor->session_id,&descriptor->resource_name,'@',&channel->identifier,channel->pool); - /* no connection yet */ - if(descriptor->connection_type == MRCP_CONNECTION_TYPE_EXISTING) { - /* try to find existing connection */ - connection = mrcp_client_agent_connection_find(agent,descriptor); - if(!connection) { - apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,channel->log_obj,"Found No Existing TCP/MRCPv2 Connection"); - } - } - if(!connection) { - /* create new connection */ - connection = mrcp_client_agent_connection_create(agent,descriptor); - if(!connection) { - apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,channel->log_obj,"Failed to Establish TCP/MRCPv2 Connection"); - } - } - - if(connection) { - mrcp_connection_channel_add(connection,channel); - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,channel->log_obj,"Add Control Channel <%s> %s [%d]", - channel->identifier.buf, - connection->id, - apr_hash_count(connection->channel_table)); - if(descriptor->connection_type == MRCP_CONNECTION_TYPE_NEW) { - /* set connection type to existing for the next offers / if any */ - descriptor->connection_type = MRCP_CONNECTION_TYPE_EXISTING; - } - } - else { - descriptor->port = 0; - status = FALSE; - } - } - } - /* send response */ - return mrcp_control_channel_modify_respond(agent->vtable,channel,descriptor,status); -} - -static apt_bool_t mrcp_client_agent_channel_remove(mrcp_connection_agent_t *agent, mrcp_control_channel_t *channel) -{ - if(channel->connection) { - mrcp_connection_t *connection = channel->connection; - mrcp_connection_channel_remove(connection,channel); - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,channel->log_obj,"Remove Control Channel <%s> [%d]", - channel->identifier.buf, - apr_hash_count(connection->channel_table)); - if(!connection->access_count) { - mrcp_client_agent_connection_remove(agent,connection); - /* set connection to be destroyed on channel destroy */ - channel->connection = connection; - channel->removed = TRUE; - } - } - - /* send response */ - return mrcp_control_channel_remove_respond(agent->vtable,channel,TRUE); -} - -static apt_bool_t mrcp_client_agent_request_cancel(mrcp_connection_agent_t *agent, mrcp_control_channel_t *channel, mrcp_message_t *message) -{ - mrcp_message_t *response; - apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,channel->log_obj,"Cancel MRCP Request <%s@%s> [%d]", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - response = mrcp_response_create(message,message->pool); - response->start_line.status_code = MRCP_STATUS_CODE_METHOD_FAILED; - return mrcp_connection_message_receive(agent->vtable,channel,response); -} - -static apt_bool_t mrcp_client_agent_disconnect_raise(mrcp_connection_agent_t *agent, mrcp_connection_t *connection) -{ - mrcp_control_channel_t *channel; - void *val; - apr_hash_index_t *it = apr_hash_first(connection->pool,connection->channel_table); - /* walk through the list of channels and raise disconnect event for them */ - for(; it; it = apr_hash_next(it)) { - apr_hash_this(it,NULL,NULL,&val); - channel = val; - if(!channel) continue; - - if(channel->active_request) { - mrcp_client_agent_request_cancel(channel->agent,channel,channel->active_request); - channel->active_request = NULL; - if(channel->request_timer) { - apt_timer_kill(channel->request_timer); - } - } - else if(agent->vtable->on_disconnect){ - agent->vtable->on_disconnect(channel); - } - } - return TRUE; -} - -static apt_bool_t mrcp_client_agent_messsage_send(mrcp_connection_agent_t *agent, mrcp_control_channel_t *channel, mrcp_message_t *message) -{ - apt_bool_t status = FALSE; - mrcp_connection_t *connection = channel->connection; - apt_text_stream_t stream; - apt_message_status_e result; - - if(!connection || !connection->sock) { - apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,channel->log_obj,"Null MRCPv2 Connection "APT_SIDRES_FMT,MRCP_MESSAGE_SIDRES(message)); - mrcp_client_agent_request_cancel(agent,channel,message); - return FALSE; - } - - do { - apt_text_stream_init(&stream,connection->tx_buffer,connection->tx_buffer_size); - result = mrcp_generator_run(connection->generator,message,&stream); - if(result != APT_MESSAGE_STATUS_INVALID) { - stream.text.length = stream.pos - stream.text.buf; - *stream.pos = '\0'; - - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,channel->log_obj,"Send MRCPv2 Data %s [%"APR_SIZE_T_FMT" bytes]\n%.*s", - connection->id, - stream.text.length, - connection->verbose == TRUE ? stream.text.length : 0, - stream.text.buf); - - if(apr_socket_send(connection->sock,stream.text.buf,&stream.text.length) == APR_SUCCESS) { - status = TRUE; - } - else { - apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,channel->log_obj,"Failed to Send MRCPv2 Data %s", - connection->id); - } - } - else { - apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,channel->log_obj,"Failed to Generate MRCPv2 Data %s", - connection->id); - } - } - while(result == APT_MESSAGE_STATUS_INCOMPLETE); - - if(status == TRUE) { - channel->active_request = message; - if(channel->request_timer && agent->request_timeout) { - apt_timer_set(channel->request_timer,agent->request_timeout); - } - } - else { - mrcp_client_agent_request_cancel(agent,channel,message); - } - return status; -} - -static apt_bool_t mrcp_client_message_handler(mrcp_connection_t *connection, mrcp_message_t *message, apt_message_status_e status) -{ - if(status == APT_MESSAGE_STATUS_COMPLETE) { - /* message is completely parsed */ - mrcp_control_channel_t *channel; - apt_str_t identifier; - apt_id_resource_generate(&message->channel_id.session_id,&message->channel_id.resource_name,'@',&identifier,message->pool); - channel = mrcp_connection_channel_find(connection,&identifier); - if(channel) { - mrcp_connection_agent_t *agent = connection->agent; - if(message->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) { - if(!channel->active_request || - channel->active_request->start_line.request_id != message->start_line.request_id) { - apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,channel->log_obj,"Unexpected MRCP Response "APT_SIDRES_FMT" [%d]", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - return FALSE; - } - if(channel->request_timer) { - apt_timer_kill(channel->request_timer); - } - channel->active_request = NULL; - } - - mrcp_connection_message_receive(agent->vtable,channel,message); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Find Channel "APT_SIDRES_FMT" in Connection %s [%d]", - MRCP_MESSAGE_SIDRES(message), - connection->id, - apr_hash_count(connection->channel_table)); - } - } - return TRUE; -} - -/* Receive MRCP message through TCP/MRCPv2 connection */ -static apt_bool_t mrcp_client_poller_signal_process(void *obj, const apr_pollfd_t *descriptor) -{ - mrcp_connection_agent_t *agent = obj; - mrcp_connection_t *connection = descriptor->client_data; - apr_status_t status; - apr_size_t offset; - apr_size_t length; - apt_text_stream_t *stream; - mrcp_message_t *message; - apt_message_status_e msg_status; - - if(!connection || !connection->sock) { - return FALSE; - } - stream = &connection->rx_stream; - - /* calculate offset remaining from the previous receive / if any */ - offset = stream->pos - stream->text.buf; - /* calculate available length */ - length = connection->rx_buffer_size - offset; - - status = apr_socket_recv(connection->sock,stream->pos,&length); - if(status == APR_EOF || length == 0) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"TCP/MRCPv2 Peer Disconnected %s",connection->id); - apt_poller_task_descriptor_remove(agent->task,&connection->sock_pfd); - apr_socket_close(connection->sock); - connection->sock = NULL; - - mrcp_client_agent_disconnect_raise(agent,connection); - return TRUE; - } - - /* calculate actual length of the stream */ - stream->text.length = offset + length; - stream->pos[length] = '\0'; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive MRCPv2 Data %s [%"APR_SIZE_T_FMT" bytes]\n%.*s", - connection->id, - length, - connection->verbose == TRUE ? length : 0, - stream->pos); - - /* reset pos */ - apt_text_stream_reset(stream); - - do { - msg_status = mrcp_parser_run(connection->parser,stream,&message); - if(mrcp_client_message_handler(connection,message,msg_status) == FALSE) { - return FALSE; - } - } - while(apt_text_is_eos(stream) == FALSE); - - /* scroll remaining stream */ - apt_text_stream_scroll(stream); - return TRUE; -} - -/* Process task message */ -static apt_bool_t mrcp_client_agent_msg_process(apt_task_t *task, apt_task_msg_t *task_msg) -{ - apt_poller_task_t *poller_task = apt_task_object_get(task); - mrcp_connection_agent_t *agent = apt_poller_task_object_get(poller_task); - connection_task_msg_t *msg = (connection_task_msg_t*) task_msg->data; - - switch(msg->type) { - case CONNECTION_TASK_MSG_ADD_CHANNEL: - mrcp_client_agent_channel_add(agent,msg->channel,msg->descriptor); - break; - case CONNECTION_TASK_MSG_MODIFY_CHANNEL: - mrcp_client_agent_channel_modify(agent,msg->channel,msg->descriptor); - break; - case CONNECTION_TASK_MSG_REMOVE_CHANNEL: - mrcp_client_agent_channel_remove(agent,msg->channel); - break; - case CONNECTION_TASK_MSG_SEND_MESSAGE: - mrcp_client_agent_messsage_send(agent,msg->channel,msg->message); - break; - } - - return TRUE; -} - -/* Timer callback */ -static void mrcp_client_timer_proc(apt_timer_t *timer, void *obj) -{ - mrcp_control_channel_t *channel = obj; - if(!channel) { - return; - } - - if(channel->request_timer == timer) { - if(channel->active_request) { - mrcp_client_agent_request_cancel(channel->agent,channel,channel->active_request); - channel->active_request = NULL; - } - } -} diff --git a/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_connection.c b/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_connection.c deleted file mode 100644 index bf9dc75d2c..0000000000 --- a/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_connection.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_connection.c 2170 2014-09-09 05:19:48Z achaloyan@gmail.com $ - */ - -#include "mrcp_connection.h" -#include "apt_pool.h" - -mrcp_connection_t* mrcp_connection_create(void) -{ - mrcp_connection_t *connection; - apr_pool_t *pool = apt_pool_create(); - if(!pool) { - return NULL; - } - - connection = apr_palloc(pool,sizeof(mrcp_connection_t)); - connection->pool = pool; - apt_string_reset(&connection->remote_ip); - connection->l_sockaddr = NULL; - connection->r_sockaddr = NULL; - connection->sock = NULL; - connection->id = NULL; - connection->verbose = TRUE; - connection->access_count = 0; - APR_RING_ELEM_INIT(connection,link); - connection->channel_table = apr_hash_make(pool); - connection->parser = NULL; - connection->generator = NULL; - connection->rx_buffer = NULL; - connection->rx_buffer_size = 0; - connection->tx_buffer = NULL; - connection->tx_buffer_size = 0; - - return connection; -} - -void mrcp_connection_destroy(mrcp_connection_t *connection) -{ - if(connection && connection->pool) { - apr_pool_destroy(connection->pool); - } -} - -apt_bool_t mrcp_connection_channel_add(mrcp_connection_t *connection, mrcp_control_channel_t *channel) -{ - if(!connection || !channel) { - return FALSE; - } - apr_hash_set(connection->channel_table,channel->identifier.buf,channel->identifier.length,channel); - channel->connection = connection; - connection->access_count++; - return TRUE; -} - -mrcp_control_channel_t* mrcp_connection_channel_find(const mrcp_connection_t *connection, const apt_str_t *identifier) -{ - if(!connection || !identifier) { - return NULL; - } - return apr_hash_get(connection->channel_table,identifier->buf,identifier->length); -} - -apt_bool_t mrcp_connection_channel_remove(mrcp_connection_t *connection, mrcp_control_channel_t *channel) -{ - if(!connection || !channel) { - return FALSE; - } - apr_hash_set(connection->channel_table,channel->identifier.buf,channel->identifier.length,NULL); - channel->connection = NULL; - connection->access_count--; - return TRUE; -} - -apt_bool_t mrcp_connection_disconnect_raise(mrcp_connection_t *connection, const mrcp_connection_event_vtable_t *vtable) -{ - if(vtable && vtable->on_disconnect) { - mrcp_control_channel_t *channel; - void *val; - apr_hash_index_t *it = apr_hash_first(connection->pool,connection->channel_table); - /* walk through the list of channels and raise disconnect event for them */ - for(; it; it = apr_hash_next(it)) { - apr_hash_this(it,NULL,NULL,&val); - channel = val; - if(channel) { - vtable->on_disconnect(channel); - } - } - } - return TRUE; -} diff --git a/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_control_descriptor.c b/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_control_descriptor.c deleted file mode 100644 index 2339e8fb56..0000000000 --- a/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_control_descriptor.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_control_descriptor.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "apt_string_table.h" -#include "mrcp_control_descriptor.h" - -/** String table of mrcp proto types (mrcp_proto_type_e) */ -static const apt_str_table_item_t mrcp_proto_type_table[] = { - {{"TCP/MRCPv2", 10},4}, - {{"TCP/TLS/MRCPv2",14},4} -}; - -/** String table of mrcp attributes (mrcp_attrib_e) */ -static const apt_str_table_item_t mrcp_attrib_table[] = { - {{"setup", 5},0}, - {{"connection",10},1}, - {{"resource", 8},0}, - {{"channel", 7},1}, - {{"cmid", 4},1} -}; - -/** String table of mrcp setup attribute values (mrcp_setup_type_e) */ -static const apt_str_table_item_t mrcp_setup_value_table[] = { - {{"active", 6},0}, - {{"passive", 7},0} -}; - -/** String table of mrcp connection attribute values (mrcp_connection_type_e) */ -static const apt_str_table_item_t mrcp_connection_value_table[] = { - {{"new", 3},0}, - {{"existing", 8},0} -}; - - -MRCP_DECLARE(const apt_str_t*) mrcp_proto_get(mrcp_proto_type_e proto) -{ - return apt_string_table_str_get(mrcp_proto_type_table,MRCP_PROTO_COUNT,proto); -} - -MRCP_DECLARE(mrcp_proto_type_e) mrcp_proto_find(const apt_str_t *attrib) -{ - return apt_string_table_id_find(mrcp_proto_type_table,MRCP_PROTO_COUNT,attrib); -} - -MRCP_DECLARE(const apt_str_t*) mrcp_attrib_str_get(mrcp_attrib_e attrib_id) -{ - return apt_string_table_str_get(mrcp_attrib_table,MRCP_ATTRIB_COUNT,attrib_id); -} - -MRCP_DECLARE(mrcp_attrib_e) mrcp_attrib_id_find(const apt_str_t *attrib) -{ - return apt_string_table_id_find(mrcp_attrib_table,MRCP_ATTRIB_COUNT,attrib); -} - -MRCP_DECLARE(const apt_str_t*) mrcp_setup_type_get(mrcp_setup_type_e setup_type) -{ - return apt_string_table_str_get(mrcp_setup_value_table,MRCP_SETUP_TYPE_COUNT,setup_type); -} - -MRCP_DECLARE(mrcp_setup_type_e) mrcp_setup_type_find(const apt_str_t *attrib) -{ - return apt_string_table_id_find(mrcp_setup_value_table,MRCP_SETUP_TYPE_COUNT,attrib); -} - -MRCP_DECLARE(const apt_str_t*) mrcp_connection_type_get(mrcp_connection_type_e connection_type) -{ - return apt_string_table_str_get(mrcp_connection_value_table,MRCP_CONNECTION_TYPE_COUNT,connection_type); -} - -MRCP_DECLARE(mrcp_connection_type_e) mrcp_connection_type_find(const apt_str_t *attrib) -{ - return apt_string_table_id_find(mrcp_connection_value_table,MRCP_CONNECTION_TYPE_COUNT,attrib); -} - -/** Create MRCP control descriptor */ -MRCP_DECLARE(mrcp_control_descriptor_t*) mrcp_control_descriptor_create(apr_pool_t *pool) -{ - mrcp_control_descriptor_t *descriptor; - descriptor = apr_palloc(pool,sizeof(mrcp_control_descriptor_t)); - - apt_string_reset(&descriptor->ip); - descriptor->port = 0; - descriptor->proto = MRCP_PROTO_UNKNOWN; - descriptor->setup_type = MRCP_SETUP_TYPE_UNKNOWN; - descriptor->connection_type = MRCP_CONNECTION_TYPE_UNKNOWN; - apt_string_reset(&descriptor->resource_name); - apt_string_reset(&descriptor->session_id); - descriptor->cmid_arr = apr_array_make(pool,1,sizeof(apr_size_t)); - descriptor->id = 0; - return descriptor; -} - -/** Create MRCP control offer */ -MRCP_DECLARE(mrcp_control_descriptor_t*) mrcp_control_offer_create(apr_pool_t *pool) -{ - mrcp_control_descriptor_t *offer = mrcp_control_descriptor_create(pool); - offer->proto = MRCP_PROTO_TCP; - offer->port = TCP_DISCARD_PORT; - offer->setup_type = MRCP_SETUP_TYPE_ACTIVE; - offer->connection_type = MRCP_CONNECTION_TYPE_EXISTING; - return offer; -} - -/** Create MRCP control answer */ -MRCP_DECLARE(mrcp_control_descriptor_t*) mrcp_control_answer_create(mrcp_control_descriptor_t *offer, apr_pool_t *pool) -{ - mrcp_control_descriptor_t *answer = mrcp_control_descriptor_create(pool); - if(offer) { - *answer = *offer; - answer->cmid_arr = apr_array_copy(pool,offer->cmid_arr); - } - answer->setup_type = MRCP_SETUP_TYPE_PASSIVE; - return answer; -} - -/** Add cmid to cmid_arr */ -MRCP_DECLARE(void) mrcp_cmid_add(apr_array_header_t *cmid_arr, apr_size_t cmid) -{ - APR_ARRAY_PUSH(cmid_arr, apr_size_t) = cmid; -} - -/** Find cmid in cmid_arr */ -MRCP_DECLARE(apt_bool_t) mrcp_cmid_find(const apr_array_header_t *cmid_arr, apr_size_t cmid) -{ - int i; - for(i=0; inelts; i++) { - if(APR_ARRAY_IDX(cmid_arr,i,apr_size_t) == cmid) { - return TRUE; - } - } - return FALSE; -} diff --git a/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_server_connection.c b/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_server_connection.c deleted file mode 100644 index 3a77ff23d4..0000000000 --- a/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_server_connection.c +++ /dev/null @@ -1,715 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_server_connection.c 2249 2014-11-19 05:26:24Z achaloyan@gmail.com $ - */ - -#include "mrcp_connection.h" -#include "mrcp_server_connection.h" -#include "mrcp_control_descriptor.h" -#include "mrcp_resource_factory.h" -#include "mrcp_message.h" -#include "apt_text_stream.h" -#include "apt_poller_task.h" -#include "apt_pool.h" -#include "apt_log.h" - - -struct mrcp_connection_agent_t { - apr_pool_t *pool; - apt_poller_task_t *task; - const mrcp_resource_factory_t *resource_factory; - - /** List (ring) of MRCP connections */ - APR_RING_HEAD(mrcp_connection_head_t, mrcp_connection_t) connection_list; - /** Table of pending control channels */ - apr_hash_t *pending_channel_table; - - apt_bool_t force_new_connection; - apr_size_t tx_buffer_size; - apr_size_t rx_buffer_size; - - /* Listening socket */ - apr_sockaddr_t *sockaddr; - apr_socket_t *listen_sock; - apr_pollfd_t listen_sock_pfd; - - void *obj; - const mrcp_connection_event_vtable_t *vtable; -}; - -typedef enum { - CONNECTION_TASK_MSG_ADD_CHANNEL, - CONNECTION_TASK_MSG_MODIFY_CHANNEL, - CONNECTION_TASK_MSG_REMOVE_CHANNEL, - CONNECTION_TASK_MSG_SEND_MESSAGE -} connection_task_msg_type_e; - -typedef struct connection_task_msg_t connection_task_msg_t; -struct connection_task_msg_t { - connection_task_msg_type_e type; - mrcp_connection_agent_t *agent; - mrcp_control_channel_t *channel; - mrcp_control_descriptor_t *descriptor; - mrcp_message_t *message; -}; - -static apt_bool_t mrcp_server_agent_on_destroy(apt_task_t *task); -static apt_bool_t mrcp_server_agent_msg_process(apt_task_t *task, apt_task_msg_t *task_msg); -static apt_bool_t mrcp_server_poller_signal_process(void *obj, const apr_pollfd_t *descriptor); - -static apt_bool_t mrcp_server_agent_listening_socket_create(mrcp_connection_agent_t *agent); -static void mrcp_server_agent_listening_socket_destroy(mrcp_connection_agent_t *agent); - - -/** Create connection agent */ -MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_server_connection_agent_create( - const char *id, - const char *listen_ip, - apr_port_t listen_port, - apr_size_t max_connection_count, - apt_bool_t force_new_connection, - apr_pool_t *pool) -{ - apt_task_t *task; - apt_task_vtable_t *vtable; - apt_task_msg_pool_t *msg_pool; - mrcp_connection_agent_t *agent; - - if(!listen_ip) { - return NULL; - } - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create MRCPv2 Agent [%s] %s:%hu [%"APR_SIZE_T_FMT"]", - id,listen_ip,listen_port,max_connection_count); - agent = apr_palloc(pool,sizeof(mrcp_connection_agent_t)); - agent->pool = pool; - agent->sockaddr = NULL; - agent->listen_sock = NULL; - agent->force_new_connection = force_new_connection; - agent->rx_buffer_size = MRCP_STREAM_BUFFER_SIZE; - agent->tx_buffer_size = MRCP_STREAM_BUFFER_SIZE; - - apr_sockaddr_info_get(&agent->sockaddr,listen_ip,APR_INET,listen_port,0,pool); - if(!agent->sockaddr) { - return NULL; - } - - msg_pool = apt_task_msg_pool_create_dynamic(sizeof(connection_task_msg_t),pool); - - agent->task = apt_poller_task_create( - max_connection_count + 1, - mrcp_server_poller_signal_process, - agent, - msg_pool, - pool); - if(!agent->task) { - return NULL; - } - - task = apt_poller_task_base_get(agent->task); - if(task) { - apt_task_name_set(task,id); - } - - vtable = apt_poller_task_vtable_get(agent->task); - if(vtable) { - vtable->destroy = mrcp_server_agent_on_destroy; - vtable->process_msg = mrcp_server_agent_msg_process; - } - - APR_RING_INIT(&agent->connection_list, mrcp_connection_t, link); - agent->pending_channel_table = apr_hash_make(pool); - - if(mrcp_server_agent_listening_socket_create(agent) != TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Listening Socket [%s] %s:%hu", - id, - listen_ip, - listen_port); - } - return agent; -} - -static apt_bool_t mrcp_server_agent_on_destroy(apt_task_t *task) -{ - apt_poller_task_t *poller_task = apt_task_object_get(task); - mrcp_connection_agent_t *agent = apt_poller_task_object_get(poller_task); - - mrcp_server_agent_listening_socket_destroy(agent); - apt_poller_task_cleanup(poller_task); - return TRUE; -} - -/** Destroy connection agent. */ -MRCP_DECLARE(apt_bool_t) mrcp_server_connection_agent_destroy(mrcp_connection_agent_t *agent) -{ - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy MRCPv2 Agent [%s]", - mrcp_server_connection_agent_id_get(agent)); - return apt_poller_task_destroy(agent->task); -} - -/** Start connection agent. */ -MRCP_DECLARE(apt_bool_t) mrcp_server_connection_agent_start(mrcp_connection_agent_t *agent) -{ - return apt_poller_task_start(agent->task); -} - -/** Terminate connection agent. */ -MRCP_DECLARE(apt_bool_t) mrcp_server_connection_agent_terminate(mrcp_connection_agent_t *agent) -{ - return apt_poller_task_terminate(agent->task); -} - -/** Set connection event handler. */ -MRCP_DECLARE(void) mrcp_server_connection_agent_handler_set( - mrcp_connection_agent_t *agent, - void *obj, - const mrcp_connection_event_vtable_t *vtable) -{ - agent->obj = obj; - agent->vtable = vtable; -} - -/** Set MRCP resource factory */ -MRCP_DECLARE(void) mrcp_server_connection_resource_factory_set( - mrcp_connection_agent_t *agent, - const mrcp_resource_factory_t *resource_factroy) -{ - agent->resource_factory = resource_factroy; -} - -/** Set rx buffer size */ -MRCP_DECLARE(void) mrcp_server_connection_rx_size_set( - mrcp_connection_agent_t *agent, - apr_size_t size) -{ - if(size < MRCP_STREAM_BUFFER_SIZE) { - size = MRCP_STREAM_BUFFER_SIZE; - } - agent->rx_buffer_size = size; -} - -/** Set tx buffer size */ -MRCP_DECLARE(void) mrcp_server_connection_tx_size_set( - mrcp_connection_agent_t *agent, - apr_size_t size) -{ - if(size < MRCP_STREAM_BUFFER_SIZE) { - size = MRCP_STREAM_BUFFER_SIZE; - } - agent->tx_buffer_size = size; -} - -/** Get task */ -MRCP_DECLARE(apt_task_t*) mrcp_server_connection_agent_task_get(const mrcp_connection_agent_t *agent) -{ - return apt_poller_task_base_get(agent->task); -} - -/** Get external object */ -MRCP_DECLARE(void*) mrcp_server_connection_agent_object_get(const mrcp_connection_agent_t *agent) -{ - return agent->obj; -} - -/** Get string identifier */ -MRCP_DECLARE(const char*) mrcp_server_connection_agent_id_get(const mrcp_connection_agent_t *agent) -{ - apt_task_t *task = apt_poller_task_base_get(agent->task); - return apt_task_name_get(task); -} - - -/** Create MRCPv2 control channel */ -MRCP_DECLARE(mrcp_control_channel_t*) mrcp_server_control_channel_create(mrcp_connection_agent_t *agent, void *obj, apr_pool_t *pool) -{ - mrcp_control_channel_t *channel = apr_palloc(pool,sizeof(mrcp_control_channel_t)); - channel->agent = agent; - channel->connection = NULL; - channel->active_request = NULL; - channel->request_timer = NULL; - channel->removed = FALSE; - channel->obj = obj; - channel->log_obj = NULL; - channel->pool = pool; - return channel; -} - -/** Destroy MRCPv2 control channel */ -MRCP_DECLARE(apt_bool_t) mrcp_server_control_channel_destroy(mrcp_control_channel_t *channel) -{ - if(channel && channel->connection && channel->removed == TRUE) { - mrcp_connection_t *connection = channel->connection; - channel->connection = NULL; - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy TCP/MRCPv2 Connection %s",connection->id); - mrcp_connection_destroy(connection); - } - return TRUE; -} - -/** Signal task message */ -static apt_bool_t mrcp_server_control_message_signal( - connection_task_msg_type_e type, - mrcp_connection_agent_t *agent, - mrcp_control_channel_t *channel, - mrcp_control_descriptor_t *descriptor, - mrcp_message_t *message) -{ - apt_task_t *task = apt_poller_task_base_get(agent->task); - apt_task_msg_t *task_msg = apt_task_msg_get(task); - if(task_msg) { - connection_task_msg_t *msg = (connection_task_msg_t*)task_msg->data; - msg->type = type; - msg->agent = agent; - msg->channel = channel; - msg->descriptor = descriptor; - msg->message = message; - apt_task_msg_signal(task,task_msg); - } - return TRUE; -} - -/** Add MRCPv2 control channel */ -MRCP_DECLARE(apt_bool_t) mrcp_server_control_channel_add(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor) -{ - return mrcp_server_control_message_signal(CONNECTION_TASK_MSG_ADD_CHANNEL,channel->agent,channel,descriptor,NULL); -} - -/** Modify MRCPv2 control channel */ -MRCP_DECLARE(apt_bool_t) mrcp_server_control_channel_modify(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor) -{ - return mrcp_server_control_message_signal(CONNECTION_TASK_MSG_MODIFY_CHANNEL,channel->agent,channel,descriptor,NULL); -} - -/** Remove MRCPv2 control channel */ -MRCP_DECLARE(apt_bool_t) mrcp_server_control_channel_remove(mrcp_control_channel_t *channel) -{ - return mrcp_server_control_message_signal(CONNECTION_TASK_MSG_REMOVE_CHANNEL,channel->agent,channel,NULL,NULL); -} - -/** Send MRCPv2 message */ -MRCP_DECLARE(apt_bool_t) mrcp_server_control_message_send(mrcp_control_channel_t *channel, mrcp_message_t *message) -{ - return mrcp_server_control_message_signal(CONNECTION_TASK_MSG_SEND_MESSAGE,channel->agent,channel,NULL,message); -} - -/** Create listening socket and add it to pollset */ -static apt_bool_t mrcp_server_agent_listening_socket_create(mrcp_connection_agent_t *agent) -{ - apr_status_t status; - if(!agent->sockaddr) { - return FALSE; - } - - /* create listening socket */ - status = apr_socket_create(&agent->listen_sock, agent->sockaddr->family, SOCK_STREAM, APR_PROTO_TCP, agent->pool); - if(status != APR_SUCCESS) { - return FALSE; - } - - apr_socket_opt_set(agent->listen_sock, APR_SO_NONBLOCK, 0); - apr_socket_timeout_set(agent->listen_sock, -1); - apr_socket_opt_set(agent->listen_sock, APR_SO_REUSEADDR, 1); - - status = apr_socket_bind(agent->listen_sock, agent->sockaddr); - if(status != APR_SUCCESS) { - apr_socket_close(agent->listen_sock); - agent->listen_sock = NULL; - return FALSE; - } - status = apr_socket_listen(agent->listen_sock, SOMAXCONN); - if(status != APR_SUCCESS) { - apr_socket_close(agent->listen_sock); - agent->listen_sock = NULL; - return FALSE; - } - - /* add listening socket to pollset */ - memset(&agent->listen_sock_pfd,0,sizeof(apr_pollfd_t)); - agent->listen_sock_pfd.desc_type = APR_POLL_SOCKET; - agent->listen_sock_pfd.reqevents = APR_POLLIN; - agent->listen_sock_pfd.desc.s = agent->listen_sock; - agent->listen_sock_pfd.client_data = agent->listen_sock; - if(apt_poller_task_descriptor_add(agent->task, &agent->listen_sock_pfd) != TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Add Listening Socket to Pollset [%s]", - apt_task_name_get(apt_poller_task_base_get(agent->task))); - apr_socket_close(agent->listen_sock); - agent->listen_sock = NULL; - return FALSE; - } - - return TRUE; -} - -/** Remove from pollset and destroy listening socket */ -static void mrcp_server_agent_listening_socket_destroy(mrcp_connection_agent_t *agent) -{ - if(agent->listen_sock) { - apt_poller_task_descriptor_remove(agent->task,&agent->listen_sock_pfd); - apr_socket_close(agent->listen_sock); - agent->listen_sock = NULL; - } -} - -static mrcp_control_channel_t* mrcp_connection_channel_associate(mrcp_connection_agent_t *agent, mrcp_connection_t *connection, const mrcp_message_t *message) -{ - apt_str_t identifier; - mrcp_control_channel_t *channel; - if(!connection || !message) { - return NULL; - } - apt_id_resource_generate(&message->channel_id.session_id,&message->channel_id.resource_name,'@',&identifier,connection->pool); - channel = mrcp_connection_channel_find(connection,&identifier); - if(!channel) { - channel = apr_hash_get(agent->pending_channel_table,identifier.buf,identifier.length); - if(channel) { - apr_hash_set(agent->pending_channel_table,identifier.buf,identifier.length,NULL); - mrcp_connection_channel_add(connection,channel); - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Assign Control Channel <%s> to Connection %s [%d] -> [%d]", - channel->identifier.buf, - connection->id, - apr_hash_count(agent->pending_channel_table), - apr_hash_count(connection->channel_table)); - } - } - return channel; -} - -static mrcp_connection_t* mrcp_connection_find(mrcp_connection_agent_t *agent, const apt_str_t *remote_ip) -{ - mrcp_connection_t *connection; - if(!agent || !remote_ip) { - return NULL; - } - - for(connection = APR_RING_FIRST(&agent->connection_list); - connection != APR_RING_SENTINEL(&agent->connection_list, mrcp_connection_t, link); - connection = APR_RING_NEXT(connection, link)) { - if(apt_string_compare(&connection->remote_ip,remote_ip) == TRUE) { - return connection; - } - } - - return NULL; -} - -static apt_bool_t mrcp_connection_remove(mrcp_connection_agent_t *agent, mrcp_connection_t *connection) -{ - APR_RING_REMOVE(connection,link); - return TRUE; -} - -static apt_bool_t mrcp_server_agent_connection_accept(mrcp_connection_agent_t *agent) -{ - char *local_ip = NULL; - char *remote_ip = NULL; - - mrcp_connection_t *connection = mrcp_connection_create(); - - if(apr_socket_accept(&connection->sock,agent->listen_sock,connection->pool) != APR_SUCCESS) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Accept Connection"); - mrcp_connection_destroy(connection); - return FALSE; - } - - if(apr_socket_addr_get(&connection->r_sockaddr,APR_REMOTE,connection->sock) != APR_SUCCESS || - apr_socket_addr_get(&connection->l_sockaddr,APR_LOCAL,connection->sock) != APR_SUCCESS) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get Socket Address"); - apr_socket_close(connection->sock); - mrcp_connection_destroy(connection); - return FALSE; - } - - apr_sockaddr_ip_get(&local_ip,connection->l_sockaddr); - apr_sockaddr_ip_get(&remote_ip,connection->r_sockaddr); - apt_string_set(&connection->remote_ip,remote_ip); - connection->id = apr_psprintf(connection->pool,"%s:%hu <-> %s:%hu", - local_ip,connection->l_sockaddr->port, - remote_ip,connection->r_sockaddr->port); - - if(apr_hash_count(agent->pending_channel_table) == 0) { - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Reject Unexpected TCP/MRCPv2 Connection %s",connection->id); - apr_socket_close(connection->sock); - mrcp_connection_destroy(connection); - return FALSE; - } - - memset(&connection->sock_pfd,0,sizeof(apr_pollfd_t)); - connection->sock_pfd.desc_type = APR_POLL_SOCKET; - connection->sock_pfd.reqevents = APR_POLLIN; - connection->sock_pfd.desc.s = connection->sock; - connection->sock_pfd.client_data = connection; - if(apt_poller_task_descriptor_add(agent->task, &connection->sock_pfd) != TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Add to Pollset %s",connection->id); - apr_socket_close(connection->sock); - mrcp_connection_destroy(connection); - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Accepted TCP/MRCPv2 Connection %s",connection->id); - connection->agent = agent; - APR_RING_INSERT_TAIL(&agent->connection_list,connection,mrcp_connection_t,link); - - connection->parser = mrcp_parser_create(agent->resource_factory,connection->pool); - connection->generator = mrcp_generator_create(agent->resource_factory,connection->pool); - - connection->tx_buffer_size = agent->tx_buffer_size; - connection->tx_buffer = apr_palloc(connection->pool,connection->tx_buffer_size+1); - - connection->rx_buffer_size = agent->rx_buffer_size; - connection->rx_buffer = apr_palloc(connection->pool,connection->rx_buffer_size+1); - apt_text_stream_init(&connection->rx_stream,connection->rx_buffer,connection->rx_buffer_size); - - if(apt_log_masking_get() != APT_LOG_MASKING_NONE) { - connection->verbose = FALSE; - mrcp_parser_verbose_set(connection->parser,TRUE); - mrcp_generator_verbose_set(connection->generator,TRUE); - } - return TRUE; -} - -static apt_bool_t mrcp_server_agent_connection_close(mrcp_connection_agent_t *agent, mrcp_connection_t *connection) -{ - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"TCP/MRCPv2 Peer Disconnected %s",connection->id); - apt_poller_task_descriptor_remove(agent->task,&connection->sock_pfd); - apr_socket_close(connection->sock); - connection->sock = NULL; - if(!connection->access_count) { - mrcp_connection_remove(agent,connection); - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy TCP/MRCPv2 Connection %s",connection->id); - mrcp_connection_destroy(connection); - } - return TRUE; -} - -static apt_bool_t mrcp_server_agent_channel_add(mrcp_connection_agent_t *agent, mrcp_control_channel_t *channel, mrcp_control_descriptor_t *offer) -{ - mrcp_control_descriptor_t *answer = mrcp_control_answer_create(offer,channel->pool); - apt_id_resource_generate(&offer->session_id,&offer->resource_name,'@',&channel->identifier,channel->pool); - if(offer->port) { - answer->port = agent->sockaddr->port; - } - if(offer->connection_type == MRCP_CONNECTION_TYPE_EXISTING) { - if(agent->force_new_connection == TRUE) { - /* force client to establish new connection */ - answer->connection_type = MRCP_CONNECTION_TYPE_NEW; - } - else { - mrcp_connection_t *connection = NULL; - /* try to find any existing connection */ - connection = mrcp_connection_find(agent,&offer->ip); - if(!connection) { - /* no existing conection found, force the new one */ - answer->connection_type = MRCP_CONNECTION_TYPE_NEW; - } - } - } - - apr_hash_set(agent->pending_channel_table,channel->identifier.buf,channel->identifier.length,channel); - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Add Pending Control Channel <%s> [%d]", - channel->identifier.buf, - apr_hash_count(agent->pending_channel_table)); - /* send response */ - return mrcp_control_channel_add_respond(agent->vtable,channel,answer,TRUE); -} - -static apt_bool_t mrcp_server_agent_channel_modify(mrcp_connection_agent_t *agent, mrcp_control_channel_t *channel, mrcp_control_descriptor_t *offer) -{ - mrcp_control_descriptor_t *answer = mrcp_control_answer_create(offer,channel->pool); - if(offer->port) { - answer->port = agent->sockaddr->port; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Modify Control Channel <%s>",channel->identifier.buf); - /* send response */ - return mrcp_control_channel_modify_respond(agent->vtable,channel,answer,TRUE); -} - -static apt_bool_t mrcp_server_agent_channel_remove(mrcp_connection_agent_t *agent, mrcp_control_channel_t *channel) -{ - mrcp_connection_t *connection = channel->connection; - if(connection) { - mrcp_connection_channel_remove(connection,channel); - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove Control Channel <%s> [%d]", - channel->identifier.buf, - apr_hash_count(connection->channel_table)); - if(!connection->access_count) { - if(!connection->sock) { - mrcp_connection_remove(agent,connection); - /* set connection to be destroyed on channel destroy */ - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Mark Connection for Removal %s",connection->id); - channel->connection = connection; - channel->removed = TRUE; - } - } - } - else { - apr_hash_set(agent->pending_channel_table,channel->identifier.buf,channel->identifier.length,NULL); - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove Pending Control Channel <%s> [%d]", - channel->identifier.buf, - apr_hash_count(agent->pending_channel_table)); - } - /* send response */ - return mrcp_control_channel_remove_respond(agent->vtable,channel,TRUE); -} - -static apt_bool_t mrcp_server_agent_messsage_send(mrcp_connection_agent_t *agent, mrcp_connection_t *connection, mrcp_message_t *message) -{ - apt_bool_t status = FALSE; - apt_text_stream_t stream; - apt_message_status_e result; - if(!connection || !connection->sock) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Null MRCPv2 Connection "APT_SIDRES_FMT,MRCP_MESSAGE_SIDRES(message)); - return FALSE; - } - - do { - apt_text_stream_init(&stream,connection->tx_buffer,connection->tx_buffer_size); - result = mrcp_generator_run(connection->generator,message,&stream); - if(result != APT_MESSAGE_STATUS_INVALID) { - stream.text.length = stream.pos - stream.text.buf; - *stream.pos = '\0'; - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Send MRCPv2 Data %s [%"APR_SIZE_T_FMT" bytes]\n%.*s", - connection->id, - stream.text.length, - connection->verbose == TRUE ? stream.text.length : 0, - stream.text.buf); - - if(apr_socket_send(connection->sock,stream.text.buf,&stream.text.length) == APR_SUCCESS) { - status = TRUE; - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Send MRCPv2 Data"); - } - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Generate MRCPv2 Data"); - } - } - while(result == APT_MESSAGE_STATUS_INCOMPLETE); - - return status; -} - -static apt_bool_t mrcp_server_message_handler(mrcp_connection_t *connection, mrcp_message_t *message, apt_message_status_e status) -{ - mrcp_connection_agent_t *agent = connection->agent; - if(status == APT_MESSAGE_STATUS_COMPLETE) { - /* message is completely parsed */ - mrcp_control_channel_t *channel = mrcp_connection_channel_associate(agent,connection,message); - if(channel) { - mrcp_connection_message_receive(agent->vtable,channel,message); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Find Channel "APT_SIDRES_FMT" in Connection %s", - MRCP_MESSAGE_SIDRES(message), - connection->id); - } - } - else if(status == APT_MESSAGE_STATUS_INVALID) { - /* error case */ - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Parse MRCPv2 Data"); - if(message && message->resource) { - mrcp_message_t *response; - response = mrcp_response_create(message,message->pool); - response->start_line.status_code = MRCP_STATUS_CODE_UNRECOGNIZED_MESSAGE; - if(mrcp_server_agent_messsage_send(agent,connection,response) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Send MRCPv2 Response"); - } - } - } - return TRUE; -} - -/* Receive MRCP message through TCP/MRCPv2 connection */ -static apt_bool_t mrcp_server_poller_signal_process(void *obj, const apr_pollfd_t *descriptor) -{ - mrcp_connection_agent_t *agent = obj; - mrcp_connection_t *connection = descriptor->client_data; - apr_status_t status; - apr_size_t offset; - apr_size_t length; - apt_text_stream_t *stream; - mrcp_message_t *message; - apt_message_status_e msg_status; - - if(descriptor->desc.s == agent->listen_sock) { - return mrcp_server_agent_connection_accept(agent); - } - - if(!connection || !connection->sock) { - return FALSE; - } - stream = &connection->rx_stream; - - /* calculate offset remaining from the previous receive / if any */ - offset = stream->pos - stream->text.buf; - /* calculate available length */ - length = connection->rx_buffer_size - offset; - - status = apr_socket_recv(connection->sock,stream->pos,&length); - if(status == APR_EOF || length == 0) { - return mrcp_server_agent_connection_close(agent,connection); - } - - /* calculate actual length of the stream */ - stream->text.length = offset + length; - stream->pos[length] = '\0'; - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive MRCPv2 Data %s [%"APR_SIZE_T_FMT" bytes]\n%.*s", - connection->id, - length, - connection->verbose == TRUE ? length : 0, - stream->pos); - - /* reset pos */ - apt_text_stream_reset(stream); - - do { - msg_status = mrcp_parser_run(connection->parser,stream,&message); - if(mrcp_server_message_handler(connection,message,msg_status) == FALSE) { - return FALSE; - } - } - while(apt_text_is_eos(stream) == FALSE); - - /* scroll remaining stream */ - apt_text_stream_scroll(stream); - return TRUE; -} - -/* Process task message */ -static apt_bool_t mrcp_server_agent_msg_process(apt_task_t *task, apt_task_msg_t *task_msg) -{ - apt_poller_task_t *poller_task = apt_task_object_get(task); - mrcp_connection_agent_t *agent = apt_poller_task_object_get(poller_task); - connection_task_msg_t *msg = (connection_task_msg_t*) task_msg->data; - switch(msg->type) { - case CONNECTION_TASK_MSG_ADD_CHANNEL: - mrcp_server_agent_channel_add(agent,msg->channel,msg->descriptor); - break; - case CONNECTION_TASK_MSG_MODIFY_CHANNEL: - mrcp_server_agent_channel_modify(agent,msg->channel,msg->descriptor); - break; - case CONNECTION_TASK_MSG_REMOVE_CHANNEL: - mrcp_server_agent_channel_remove(agent,msg->channel); - break; - case CONNECTION_TASK_MSG_SEND_MESSAGE: - mrcp_server_agent_messsage_send(agent,msg->channel->connection,msg->message); - break; - } - - return TRUE; -} diff --git a/libs/unimrcp/libs/uni-rtsp/Makefile.am b/libs/unimrcp/libs/uni-rtsp/Makefile.am deleted file mode 100644 index f058b8d94b..0000000000 --- a/libs/unimrcp/libs/uni-rtsp/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -AM_CPPFLAGS = -I$(top_srcdir)/libs/uni-rtsp/include \ - -I$(top_srcdir)/libs/apr-toolkit/include \ - $(UNIMRCP_APR_INCLUDES) - -noinst_LTLIBRARIES = libunirtsp.la - -include_HEADERS = include/rtsp.h \ - include/rtsp_header.h \ - include/rtsp_start_line.h \ - include/rtsp_message.h \ - include/rtsp_stream.h \ - include/rtsp_server.h \ - include/rtsp_client.h - -libunirtsp_la_SOURCES = src/rtsp_header.c \ - src/rtsp_start_line.c \ - src/rtsp_message.c \ - src/rtsp_stream.c \ - src/rtsp_server.c \ - src/rtsp_client.c diff --git a/libs/unimrcp/libs/uni-rtsp/include/rtsp.h b/libs/unimrcp/libs/uni-rtsp/include/rtsp.h deleted file mode 100644 index 89ecb81776..0000000000 --- a/libs/unimrcp/libs/uni-rtsp/include/rtsp.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: rtsp.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef RTSP_H -#define RTSP_H - -/** - * @file rtsp.h - * @brief RTSP Core Definitions - */ - -#include -#include - -/** Library export/import defines */ -#ifdef WIN32 -#ifdef RTSP_STATIC_LIB -#define RTSP_DECLARE(type) type __stdcall -#else -#ifdef RTSP_LIB_EXPORT -#define RTSP_DECLARE(type) __declspec(dllexport) type __stdcall -#else -#define RTSP_DECLARE(type) __declspec(dllimport) type __stdcall -#endif -#endif -#else -#define RTSP_DECLARE(type) type -#endif - -#endif /* RTSP_H */ diff --git a/libs/unimrcp/libs/uni-rtsp/include/rtsp_client.h b/libs/unimrcp/libs/uni-rtsp/include/rtsp_client.h deleted file mode 100644 index 811ccb304f..0000000000 --- a/libs/unimrcp/libs/uni-rtsp/include/rtsp_client.h +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: rtsp_client.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef RTSP_CLIENT_H -#define RTSP_CLIENT_H - -/** - * @file rtsp_client.h - * @brief RTSP Client - */ - -#include "apt_task.h" -#include "rtsp_message.h" - -APT_BEGIN_EXTERN_C - -/** Opaque RTSP client declaration */ -typedef struct rtsp_client_t rtsp_client_t; -/** Opaque RTSP client session declaration */ -typedef struct rtsp_client_session_t rtsp_client_session_t; - -/** RTSP client vtable declaration */ -typedef struct rtsp_client_vtable_t rtsp_client_vtable_t; - -/** RTSP client vtable */ -struct rtsp_client_vtable_t { - /** Sesssion termination response handler */ - apt_bool_t (*on_session_terminate_response)(rtsp_client_t *client, rtsp_client_session_t *session); - /** Sesssion termination event handler */ - apt_bool_t (*on_session_terminate_event)(rtsp_client_t *client, rtsp_client_session_t *session); - /** Sesssion setup response handler */ - apt_bool_t (*on_session_response)(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *request, rtsp_message_t *response); - /** Sesssion event handler */ - apt_bool_t (*on_session_event)(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *message); -}; - -/** - * Create RTSP client. - * @param id the identifier of the client - * @param max_connection_count the number of max RTSP connections - * @param request_timeout the request timeout to set - * @param obj the external object to send event to - * @param handler the response/event handler - * @param pool the pool to allocate memory from - */ -RTSP_DECLARE(rtsp_client_t*) rtsp_client_create( - const char *id, - apr_size_t max_connection_count, - apr_size_t request_timeout, - void *obj, - const rtsp_client_vtable_t *handler, - apr_pool_t *pool); - -/** - * Destroy RTSP client. - * @param client the client to destroy - */ -RTSP_DECLARE(apt_bool_t) rtsp_client_destroy(rtsp_client_t *client); - -/** - * Start client and wait for incoming requests. - * @param client the client to start - */ -RTSP_DECLARE(apt_bool_t) rtsp_client_start(rtsp_client_t *client); - -/** - * Terminate client. - * @param client the client to terminate - */ -RTSP_DECLARE(apt_bool_t) rtsp_client_terminate(rtsp_client_t *client); - -/** - * Get task. - * @param client the client to get task from - */ -RTSP_DECLARE(apt_task_t*) rtsp_client_task_get(const rtsp_client_t *client); - -/** - * Get external object. - * @param client the client to get object from - */ -RTSP_DECLARE(void*) rtsp_client_object_get(const rtsp_client_t *client); - - -/** - * Create RTSP session. - * @param client the client to create session for - * @param server_ip the IP address of RTSP server - * @param server_port the port of RTSP server - * @param resource_location the location of RTSP resource (path in RTSP URI) - */ -RTSP_DECLARE(rtsp_client_session_t*) rtsp_client_session_create( - rtsp_client_t *client, - const char *server_ip, - apr_port_t server_port, - const char *resource_location); - -/** - * Destroy RTSP session. - * @param session the session to destroy - */ -RTSP_DECLARE(void) rtsp_client_session_destroy(rtsp_client_session_t *session); - -/** - * Terminate RTSP session. - * @param client the client to use - * @param session the session to terminate - */ -RTSP_DECLARE(apt_bool_t) rtsp_client_session_terminate(rtsp_client_t *client, rtsp_client_session_t *session); - -/** - * Send RTSP message. - * @param client the client to use - * @param session the session to send RTSP request for - * @param message the RTSP request to send - */ -RTSP_DECLARE(apt_bool_t) rtsp_client_session_request(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *message); - -/** - * Get object associated with the session. - * @param session the session to get object from - */ -RTSP_DECLARE(void*) rtsp_client_session_object_get(const rtsp_client_session_t *session); - -/** - * Set object associated with the session. - * @param session the session to set object for - * @param obj the object to set - */ -RTSP_DECLARE(void) rtsp_client_session_object_set(rtsp_client_session_t *session, void *obj); - -/** - * Get the session identifier. - * @param session the session to get identifier from - */ -RTSP_DECLARE(const apt_str_t*) rtsp_client_session_id_get(const rtsp_client_session_t *session); - -APT_END_EXTERN_C - -#endif /* RTSP_CLIENT_H */ diff --git a/libs/unimrcp/libs/uni-rtsp/include/rtsp_header.h b/libs/unimrcp/libs/uni-rtsp/include/rtsp_header.h deleted file mode 100644 index 7d5c6cb350..0000000000 --- a/libs/unimrcp/libs/uni-rtsp/include/rtsp_header.h +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: rtsp_header.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef RTSP_HEADER_H -#define RTSP_HEADER_H - -/** - * @file rtsp_header.h - * @brief RTSP Header - */ - -#include "rtsp.h" -#include "apt_header_field.h" - -APT_BEGIN_EXTERN_C - -/** RTSP transport protocol */ -typedef enum{ - RTSP_TRANSPORT_RTP, - - RTSP_TRANSPORT_COUNT, - RTSP_TRANSPORT_NONE = RTSP_TRANSPORT_COUNT -} rtsp_transport_e; - -/** RTSP transport profile */ -typedef enum{ - RTSP_PROFILE_AVP, - RTSP_PROFILE_SAVP, - - RTSP_PROFILE_COUNT, - RTSP_PROFILE_NONE = RTSP_PROFILE_COUNT -} rtsp_profile_e; - -/** RTSP lower-transport */ -typedef enum{ - RTSP_LOWER_TRANSPORT_UDP, - RTSP_LOWER_TRANSPORT_TCP, - - RTSP_LOWER_TRANSPORT_COUNT, - RTSP_LOWER_TRANSPORT_NONE = RTSP_LOWER_TRANSPORT_COUNT -} rtsp_lower_transport_e; - -/** RTSP transport attributes */ -typedef enum{ - RTSP_TRANSPORT_ATTRIB_CLIENT_PORT, - RTSP_TRANSPORT_ATTRIB_SERVER_PORT, - RTSP_TRANSPORT_ATTRIB_SOURCE, - RTSP_TRANSPORT_ATTRIB_DESTINATION, - RTSP_TRANSPORT_ATTRIB_UNICAST, - RTSP_TRANSPORT_ATTRIB_MULTICAST, - RTSP_TRANSPORT_ATTRIB_MODE, - - RTSP_TRANSPORT_ATTRIB_COUNT, - RTSP_TRANSPORT_ATTRIB_NONE = RTSP_TRANSPORT_ATTRIB_COUNT -} rtsp_transport_attrib_e; - -/** RTSP delivery */ -typedef enum{ - RTSP_DELIVERY_UNICAST, - RTSP_DELIVERY_MULTICAST, - - RTSP_DELIVERY_COUNT, - RTSP_DELIVERY_NONE = RTSP_DELIVERY_COUNT -} rtsp_delivery_e; - -/** RTSP header fields */ -typedef enum{ - RTSP_HEADER_FIELD_CSEQ, - RTSP_HEADER_FIELD_TRANSPORT, - RTSP_HEADER_FIELD_SESSION_ID, - RTSP_HEADER_FIELD_RTP_INFO, - RTSP_HEADER_FIELD_CONTENT_TYPE, - RTSP_HEADER_FIELD_CONTENT_LENGTH, - - RTSP_HEADER_FIELD_COUNT, - RTSP_HEADER_FIELD_UNKNOWN = RTSP_HEADER_FIELD_COUNT -} rtsp_header_field_id; - -/** RTSP content types */ -typedef enum { - RTSP_CONTENT_TYPE_SDP, - RTSP_CONTENT_TYPE_MRCP, - - RTSP_CONTENT_TYPE_COUNT, - RTSP_CONTENT_TYPE_NONE = RTSP_CONTENT_TYPE_COUNT -} rtsp_content_type_e; - - - -/** RTSP/RTP port range declaration */ -typedef struct rtsp_port_range_t rtsp_port_range_t; -/** RTSP transport declaration */ -typedef struct rtsp_transport_t rtsp_transport_t; -/** RTSP header declaration */ -typedef struct rtsp_header_t rtsp_header_t; - -/** RTSP/RTP port range */ -struct rtsp_port_range_t { - /** Min (low) port */ - apr_port_t min; - /** Max (high) port */ - apr_port_t max; -}; - -/** RTSP transport */ -struct rtsp_transport_t { - /** Transport profile */ - rtsp_transport_e protocol; - /** Transport profile */ - rtsp_profile_e profile; - /** Lower transport */ - rtsp_lower_transport_e lower_protocol; - /** Delivery method */ - rtsp_delivery_e delivery; - /** Client port range */ - rtsp_port_range_t client_port_range; - /** Server port range */ - rtsp_port_range_t server_port_range; - /** Source IP address */ - apt_str_t source; - /** Destination IP address */ - apt_str_t destination; - /** Mode indicates the method to support (either PLAY or RECORD) */ - apt_str_t mode; -}; - -/** RTSP header */ -struct rtsp_header_t { - /** Sequence number */ - apr_size_t cseq; - /** Transport */ - rtsp_transport_t transport; - /** Session identifier */ - apt_str_t session_id; - /** RTP-info */ - apt_str_t rtp_info; - - /** Content type */ - rtsp_content_type_e content_type; - /** Content length */ - apr_size_t content_length; - - /** Header section (collection of header fields)*/ - apt_header_section_t header_section; -}; - - -/** Initialize port range */ -static APR_INLINE void rtsp_port_range_init(rtsp_port_range_t *port_range) -{ - port_range->min = 0; - port_range->max = 0; -} - -/** Initialize port range */ -static APR_INLINE apt_bool_t rtsp_port_range_is_valid(const rtsp_port_range_t *port_range) -{ - return (port_range->min == 0 && port_range->max == 0) == FALSE; -} - -/** Initialize transport */ -static APR_INLINE void rtsp_transport_init(rtsp_transport_t *transport) -{ - transport->protocol = RTSP_TRANSPORT_RTP; - transport->profile = RTSP_PROFILE_NONE; - transport->lower_protocol = RTSP_LOWER_TRANSPORT_NONE; - rtsp_port_range_init(&transport->client_port_range); - rtsp_port_range_init(&transport->server_port_range); - apt_string_reset(&transport->source); - apt_string_reset(&transport->destination); - apt_string_reset(&transport->mode); -} - -/** Initialize header */ -static APR_INLINE void rtsp_header_init(rtsp_header_t *header, apr_pool_t *pool) -{ - header->cseq = 0; - rtsp_transport_init(&header->transport); - apt_string_reset(&header->session_id); - apt_string_reset(&header->rtp_info); - header->content_type = RTSP_CONTENT_TYPE_NONE; - header->content_length = 0; - - apt_header_section_init(&header->header_section); - apt_header_section_array_alloc(&header->header_section,RTSP_HEADER_FIELD_COUNT,pool); -} - - -/** Add RTSP header field */ -RTSP_DECLARE(apt_bool_t) rtsp_header_field_add(rtsp_header_t *header, apt_header_field_t *header_field, apr_pool_t *pool); - -/** Parse RTSP header fields */ -RTSP_DECLARE(apt_bool_t) rtsp_header_fields_parse(rtsp_header_t *header, apr_pool_t *pool); - -/** Add RTSP header field property */ -RTSP_DECLARE(apt_bool_t) rtsp_header_property_add(rtsp_header_t *header, rtsp_header_field_id id, apr_pool_t *pool); - -/** Remove RTSP header field property */ -static APR_INLINE apt_bool_t rtsp_header_property_remove(rtsp_header_t *header, rtsp_header_field_id id) -{ - apt_header_field_t *header_field = apt_header_section_field_get(&header->header_section,id); - if(header_field) { - return apt_header_section_field_remove(&header->header_section,header_field); - } - return FALSE; -} - -/** Check RTSP header field property */ -static APR_INLINE apt_bool_t rtsp_header_property_check(const rtsp_header_t *header, rtsp_header_field_id id) -{ - return apt_header_section_field_check(&header->header_section,id); -} - - -APT_END_EXTERN_C - -#endif /* RTSP_HEADER_H */ diff --git a/libs/unimrcp/libs/uni-rtsp/include/rtsp_message.h b/libs/unimrcp/libs/uni-rtsp/include/rtsp_message.h deleted file mode 100644 index a636bc4de7..0000000000 --- a/libs/unimrcp/libs/uni-rtsp/include/rtsp_message.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: rtsp_message.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef RTSP_MESSAGE_H -#define RTSP_MESSAGE_H - -/** - * @file rtsp_message.h - * @brief RTSP Message Definition - */ - -#include "rtsp_start_line.h" -#include "rtsp_header.h" - -APT_BEGIN_EXTERN_C - -/** RTSP message declaration */ -typedef struct rtsp_message_t rtsp_message_t; - -/** RTSP message */ -struct rtsp_message_t { - /** RTSP mesage type (request/response) */ - rtsp_start_line_t start_line; - /** RTSP header */ - rtsp_header_t header; - /** RTSP message body */ - apt_str_t body; - - /** Pool to allocate memory from */ - apr_pool_t *pool; -}; - -/** - * Create RTSP message. - * @param message_type the message type - * @param pool the pool to allocate memory from - */ -RTSP_DECLARE(rtsp_message_t*) rtsp_message_create(rtsp_message_type_e message_type, apr_pool_t *pool); - -/** - * Create RTSP request message. - * @param pool the pool to allocate memory from - */ -RTSP_DECLARE(rtsp_message_t*) rtsp_request_create(apr_pool_t *pool); - -/** - * Create RTSP response message. - * @param request the request to create response to - * @param status_code the status code of the response - * @param reason the reason phrase id of the response - * @param pool the pool to allocate memory from - */ -RTSP_DECLARE(rtsp_message_t*) rtsp_response_create(const rtsp_message_t *request, rtsp_status_code_e status_code, rtsp_reason_phrase_e reason, apr_pool_t *pool); - -/** - * Destroy RTSP message - * @param message the message to destroy - */ -RTSP_DECLARE(void) rtsp_message_destroy(rtsp_message_t *message); - -APT_END_EXTERN_C - -#endif /* RTSP_MESSAGE_H */ diff --git a/libs/unimrcp/libs/uni-rtsp/include/rtsp_server.h b/libs/unimrcp/libs/uni-rtsp/include/rtsp_server.h deleted file mode 100644 index 768ed2c23a..0000000000 --- a/libs/unimrcp/libs/uni-rtsp/include/rtsp_server.h +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: rtsp_server.h 2252 2014-11-21 02:45:15Z achaloyan@gmail.com $ - */ - -#ifndef RTSP_SERVER_H -#define RTSP_SERVER_H - -/** - * @file rtsp_server.h - * @brief RTSP Server - */ - -#include "apt_task.h" -#include "rtsp_message.h" - -APT_BEGIN_EXTERN_C - -/** Opaque RTSP server declaration */ -typedef struct rtsp_server_t rtsp_server_t; -/** Opaque RTSP server session declaration */ -typedef struct rtsp_server_session_t rtsp_server_session_t; - -/** RTSP server vtable declaration */ -typedef struct rtsp_server_vtable_t rtsp_server_vtable_t; - -/** RTSP server vtable declaration */ -struct rtsp_server_vtable_t { - /** Virtual create session */ - apt_bool_t (*create_session)(rtsp_server_t *server, rtsp_server_session_t *session); - /** Virtual terminate session */ - apt_bool_t (*terminate_session)(rtsp_server_t *server, rtsp_server_session_t *session); - /** Virtual message handler */ - apt_bool_t (*handle_message)(rtsp_server_t *server, rtsp_server_session_t *session, rtsp_message_t *message); -}; - -/** - * Create RTSP server. - * @param id the identifier of the server - * @param listen_ip the listen IP address - * @param listen_port the listen port - * @param max_connection_count the number of max RTSP connections - * @param obj the external object to send events to - * @param handler the request handler - * @param pool the pool to allocate memory from - */ -RTSP_DECLARE(rtsp_server_t*) rtsp_server_create( - const char *id, - const char *listen_ip, - apr_port_t listen_port, - apr_size_t max_connection_count, - void *obj, - const rtsp_server_vtable_t *handler, - apr_pool_t *pool); - -/** - * Destroy RTSP server. - * @param server the server to destroy - */ -RTSP_DECLARE(apt_bool_t) rtsp_server_destroy(rtsp_server_t *server); - -/** - * Start server and wait for incoming requests. - * @param server the server to start - */ -RTSP_DECLARE(apt_bool_t) rtsp_server_start(rtsp_server_t *server); - -/** - * Terminate server. - * @param server the server to terminate - */ -RTSP_DECLARE(apt_bool_t) rtsp_server_terminate(rtsp_server_t *server); - -/** - * Get task. - * @param server the server to get task from - */ -RTSP_DECLARE(apt_task_t*) rtsp_server_task_get(const rtsp_server_t *server); - -/** - * Get external object. - * @param server the server to get object from - */ -RTSP_DECLARE(void*) rtsp_server_object_get(const rtsp_server_t *server); - -/** - * Send RTSP message. - * @param server the server to use - * @param session the session to send RTSP response for - * @param message the RTSP response to send - */ -RTSP_DECLARE(apt_bool_t) rtsp_server_session_respond(rtsp_server_t *server, rtsp_server_session_t *session, rtsp_message_t *message); - -/** - * Terminate RTSP session (respond to terminate request). - * @param server the server to use - * @param session the session to terminate - */ -RTSP_DECLARE(apt_bool_t) rtsp_server_session_terminate(rtsp_server_t *server, rtsp_server_session_t *session); - -/** - * Get object associated with the session. - * @param session the session to get object from - */ -RTSP_DECLARE(void*) rtsp_server_session_object_get(const rtsp_server_session_t *session); - -/** - * Set object associated with the session. - * @param session the session to set object for - * @param obj the object to set - */ -RTSP_DECLARE(void) rtsp_server_session_object_set(rtsp_server_session_t *session, void *obj); - -/** - * Get the session identifier. - * @param session the session to get identifier from - */ -RTSP_DECLARE(const apt_str_t*) rtsp_server_session_id_get(const rtsp_server_session_t *session); - -/** - * Get active (in-progress) session request. - * @param session the session to get from - */ -RTSP_DECLARE(const rtsp_message_t*) rtsp_server_session_request_get(const rtsp_server_session_t *session); - -/** - * Get the session destination (client) IP address. - * @param session the session to get IP address from - */ -RTSP_DECLARE(const char*) rtsp_server_session_destination_get(const rtsp_server_session_t *session); - -APT_END_EXTERN_C - -#endif /* RTSP_SERVER_H */ diff --git a/libs/unimrcp/libs/uni-rtsp/include/rtsp_start_line.h b/libs/unimrcp/libs/uni-rtsp/include/rtsp_start_line.h deleted file mode 100644 index dd53193d43..0000000000 --- a/libs/unimrcp/libs/uni-rtsp/include/rtsp_start_line.h +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: rtsp_start_line.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef RTSP_START_LINE_H -#define RTSP_START_LINE_H - -/** - * @file rtsp_start_line.h - * @brief RTSP Start Line (request-line/status-line) - */ - -#include "rtsp.h" -#include "apt_text_stream.h" - -APT_BEGIN_EXTERN_C - -/** Protocol version */ -typedef enum { - /** Unknown version */ - RTSP_VERSION_UNKNOWN = 0, - /** RTSP 1.0 */ - RTSP_VERSION_1 = 1, -} rtsp_version_e; - -/** RTSP message types */ -typedef enum { - RTSP_MESSAGE_TYPE_UNKNOWN, - RTSP_MESSAGE_TYPE_REQUEST, - RTSP_MESSAGE_TYPE_RESPONSE -} rtsp_message_type_e; - -/** RTSP methods */ -typedef enum{ - RTSP_METHOD_SETUP, - RTSP_METHOD_ANNOUNCE, - RTSP_METHOD_TEARDOWN, - RTSP_METHOD_DESCRIBE, - - RTSP_METHOD_COUNT, - RTSP_METHOD_UNKNOWN = RTSP_METHOD_COUNT -} rtsp_method_id; - -/** Status codes */ -typedef enum { - RTSP_STATUS_CODE_UNKNOWN = 0, - /** Success codes (2xx) */ - RTSP_STATUS_CODE_OK = 200, - RTSP_STATUS_CODE_CREATED = 201, - /** Failure codec (4xx) */ - RTSP_STATUS_CODE_BAD_REQUEST = 400, - RTSP_STATUS_CODE_UNAUTHORIZED = 401, - RTSP_STATUS_CODE_NOT_FOUND = 404, - RTSP_STATUS_CODE_METHOD_NOT_ALLOWED = 405, - RTSP_STATUS_CODE_NOT_ACCEPTABLE = 406, - RTSP_STATUS_CODE_PROXY_AUTH_REQUIRED = 407, - RTSP_STATUS_CODE_REQUEST_TIMEOUT = 408, - RTSP_STATUS_CODE_SESSION_NOT_FOUND = 454, - - RTSP_STATUS_CODE_INTERNAL_SERVER_ERROR = 500, - RTSP_STATUS_CODE_NOT_IMPLEMENTED = 501, -} rtsp_status_code_e; - -/** Reason phrases */ -typedef enum { - RTSP_REASON_PHRASE_OK, - RTSP_REASON_PHRASE_CREATED, - RTSP_REASON_PHRASE_BAD_REQUEST, - RTSP_REASON_PHRASE_UNAUTHORIZED, - RTSP_REASON_PHRASE_NOT_FOUND, - RTSP_REASON_PHRASE_METHOD_NOT_ALLOWED, - RTSP_REASON_PHRASE_NOT_ACCEPTABLE, - RTSP_REASON_PHRASE_PROXY_AUTH_REQUIRED, - RTSP_REASON_PHRASE_REQUEST_TIMEOUT, - RTSP_REASON_PHRASE_SESSION_NOT_FOUND, - RTSP_REASON_PHRASE_INTERNAL_SERVER_ERROR, - RTSP_REASON_PHRASE_NOT_IMPLEMENTED, - RTSP_REASON_PHRASE_COUNT, - - /** Unknown reason phrase */ - RTSP_REASON_PHRASE_UNKNOWN = RTSP_REASON_PHRASE_COUNT -} rtsp_reason_phrase_e; - - -/** RTSP request-line declaration */ -typedef struct rtsp_request_line_t rtsp_request_line_t; -/** RTSP status-line declaration */ -typedef struct rtsp_status_line_t rtsp_status_line_t; -/** RTSP start-line declaration */ -typedef struct rtsp_start_line_t rtsp_start_line_t; - -/** RTSP request-line */ -struct rtsp_request_line_t { - /** Method name */ - apt_str_t method_name; - /** Method id */ - rtsp_method_id method_id; - /** RTSP URL */ - apt_str_t url; - /** Resource name parsed from RTSP URL */ - const char *resource_name; - /** Version of protocol in use */ - rtsp_version_e version; -}; - -/** RTSP status-line */ -struct rtsp_status_line_t { - /** Version of protocol in use */ - rtsp_version_e version; - /** success or failure or other status of the request */ - rtsp_status_code_e status_code; - /** Reason phrase */ - apt_str_t reason; -}; - -/** RTSP start-line */ -struct rtsp_start_line_t { - /** RTSP message type */ - rtsp_message_type_e message_type; - /** RTSP start-line */ - union { - rtsp_request_line_t request_line; - rtsp_status_line_t status_line; - } common; -}; - - -static APR_INLINE void rtsp_request_line_init(rtsp_request_line_t *request_line) -{ - apt_string_reset(&request_line->method_name); - request_line->method_id = RTSP_METHOD_UNKNOWN; - apt_string_reset(&request_line->url); - request_line->resource_name = NULL; - request_line->version = RTSP_VERSION_1; -} - -static APR_INLINE void rtsp_status_line_init(rtsp_status_line_t *status_line) -{ - status_line->version = RTSP_VERSION_1; - status_line->status_code = RTSP_STATUS_CODE_OK; - apt_string_reset(&status_line->reason); -} - -/** Initialize RTSP start-line */ -static APR_INLINE void rtsp_start_line_init(rtsp_start_line_t *start_line, rtsp_message_type_e message_type) -{ - start_line->message_type = message_type; - if(message_type == RTSP_MESSAGE_TYPE_REQUEST) { - rtsp_request_line_init(&start_line->common.request_line); - } - else if(message_type == RTSP_MESSAGE_TYPE_RESPONSE) { - rtsp_status_line_init(&start_line->common.status_line); - } -} - -/** Parse RTSP start-line */ -RTSP_DECLARE(apt_bool_t) rtsp_start_line_parse(rtsp_start_line_t *start_line, apt_str_t *str, apr_pool_t *pool); - -/** Generate RTSP start-line */ -RTSP_DECLARE(apt_bool_t) rtsp_start_line_generate(rtsp_start_line_t *start_line, apt_text_stream_t *text_stream); - -/** Get reason phrase by status code */ -RTSP_DECLARE(const apt_str_t*) rtsp_reason_phrase_get(rtsp_reason_phrase_e reason); - -APT_END_EXTERN_C - -#endif /* RTSP_START_LINE_H */ diff --git a/libs/unimrcp/libs/uni-rtsp/include/rtsp_stream.h b/libs/unimrcp/libs/uni-rtsp/include/rtsp_stream.h deleted file mode 100644 index a4cc4e1385..0000000000 --- a/libs/unimrcp/libs/uni-rtsp/include/rtsp_stream.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: rtsp_stream.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef RTSP_STREAM_H -#define RTSP_STREAM_H - -/** - * @file rtsp_stream.h - * @brief RTSP Stream Parser and Generator - */ - -#include "rtsp_message.h" -#include "apt_text_message.h" - -APT_BEGIN_EXTERN_C - -/** Opaque RTSP parser declaration */ -typedef struct rtsp_parser_t rtsp_parser_t; -/** Opaque RTSP generator declaration */ -typedef struct rtsp_generator_t rtsp_generator_t; - - -/** Create RTSP stream parser */ -RTSP_DECLARE(rtsp_parser_t*) rtsp_parser_create(apr_pool_t *pool); - -/** Parse RTSP stream */ -RTSP_DECLARE(apt_message_status_e) rtsp_parser_run(rtsp_parser_t *parser, apt_text_stream_t *stream, rtsp_message_t **message); - - -/** Create RTSP stream generator */ -RTSP_DECLARE(rtsp_generator_t*) rtsp_generator_create(apr_pool_t *pool); - -/** Generate RTSP stream */ -RTSP_DECLARE(apt_message_status_e) rtsp_generator_run(rtsp_generator_t *generator, rtsp_message_t *message, apt_text_stream_t *stream); - - -APT_END_EXTERN_C - -#endif /* RTSP_STREAM_H */ diff --git a/libs/unimrcp/libs/uni-rtsp/src/rtsp_client.c b/libs/unimrcp/libs/uni-rtsp/src/rtsp_client.c deleted file mode 100644 index bf783aba65..0000000000 --- a/libs/unimrcp/libs/uni-rtsp/src/rtsp_client.c +++ /dev/null @@ -1,992 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: rtsp_client.c 2249 2014-11-19 05:26:24Z achaloyan@gmail.com $ - */ - -#ifdef WIN32 -#pragma warning(disable: 4127) -#endif -#include -#include -#include "rtsp_client.h" -#include "rtsp_stream.h" -#include "apt_poller_task.h" -#include "apt_text_stream.h" -#include "apt_pool.h" -#include "apt_obj_list.h" -#include "apt_log.h" - -#define RTSP_STREAM_BUFFER_SIZE 1024 - -typedef struct rtsp_client_connection_t rtsp_client_connection_t; - -typedef enum { - TERMINATION_STATE_NONE, - TERMINATION_STATE_REQUESTED, - TERMINATION_STATE_INPROGRESS -} termination_state_e; - -/** RTSP client */ -struct rtsp_client_t { - apr_pool_t *pool; - apt_poller_task_t *task; - - /** List (ring) of RTSP connections */ - APR_RING_HEAD(rtsp_client_connection_head_t, rtsp_client_connection_t) connection_list; - - apr_uint32_t request_timeout; - - void *obj; - const rtsp_client_vtable_t *vtable; -}; - -/** RTSP connection */ -struct rtsp_client_connection_t { - /** Ring entry */ - APR_RING_ENTRY(rtsp_client_connection_t) link; - - /** Memory pool */ - apr_pool_t *pool; - /** Connected socket */ - apr_socket_t *sock; - /** Socket poll descriptor */ - apr_pollfd_t sock_pfd; - /** String identifier used for traces */ - const char *id; - /** RTSP client, connection belongs to */ - rtsp_client_t *client; - - /** Handle table (rtsp_client_session_t*) */ - apr_hash_t *handle_table; - /** Session table (rtsp_client_session_t*) */ - apr_hash_t *session_table; - - /** Inprogress request/session queue (rtsp_client_session_t*) */ - apt_obj_list_t *inprogress_request_queue; - - /** Last CSeq sent */ - apr_size_t last_cseq; - - char rx_buffer[RTSP_STREAM_BUFFER_SIZE]; - apt_text_stream_t rx_stream; - rtsp_parser_t *parser; - - char tx_buffer[RTSP_STREAM_BUFFER_SIZE]; - apt_text_stream_t tx_stream; - rtsp_generator_t *generator; -}; - -/** RTSP session */ -struct rtsp_client_session_t { - apr_pool_t *pool; - void *obj; - - /** Connection */ - rtsp_client_connection_t *connection; - /** Session identifier */ - apt_str_t id; - - apt_str_t server_ip; - apr_port_t server_port; - apt_str_t resource_location; - - /** In-progress request */ - rtsp_message_t *active_request; - /** Pending request queue (rtsp_message_t*) */ - apt_obj_list_t *pending_request_queue; - - /** Timer used for request timeouts */ - apt_timer_t *request_timer; - - /** Resource table */ - apr_hash_t *resource_table; - - /** termination state (none -> requested -> terminating) */ - termination_state_e term_state; -}; - -typedef enum { - TASK_MSG_SEND_MESSAGE, - TASK_MSG_TERMINATE_SESSION -} task_msg_data_type_e; - -typedef struct task_msg_data_t task_msg_data_t; - -struct task_msg_data_t { - task_msg_data_type_e type; - rtsp_client_t *client; - rtsp_client_session_t *session; - rtsp_message_t *message; -}; - -static apt_bool_t rtsp_client_task_msg_process(apt_task_t *task, apt_task_msg_t *msg); - -static apt_bool_t rtsp_client_poller_signal_process(void *obj, const apr_pollfd_t *descriptor); - -static apt_bool_t rtsp_client_message_handler(rtsp_client_connection_t *rtsp_connection, rtsp_message_t *message, apt_message_status_e status); -static apt_bool_t rtsp_client_message_send(rtsp_client_t *client, rtsp_client_connection_t *connection, rtsp_message_t *message); -static apt_bool_t rtsp_client_session_message_process(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *message); -static apt_bool_t rtsp_client_session_response_process(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *request, rtsp_message_t *response); - -static void rtsp_client_timer_proc(apt_timer_t *timer, void *obj); - -/** Get string identifier */ -static const char* rtsp_client_id_get(const rtsp_client_t *client) -{ - apt_task_t *task = apt_poller_task_base_get(client->task); - return apt_task_name_get(task); -} - -/** Create RTSP client */ -RTSP_DECLARE(rtsp_client_t*) rtsp_client_create( - const char *id, - apr_size_t max_connection_count, - apr_size_t request_timeout, - void *obj, - const rtsp_client_vtable_t *handler, - apr_pool_t *pool) -{ - apt_task_t *task; - apt_task_vtable_t *vtable; - apt_task_msg_pool_t *msg_pool; - rtsp_client_t *client; - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create RTSP Client [%s] [%"APR_SIZE_T_FMT"]", - id, max_connection_count); - client = apr_palloc(pool,sizeof(rtsp_client_t)); - client->pool = pool; - client->obj = obj; - client->vtable = handler; - - msg_pool = apt_task_msg_pool_create_dynamic(sizeof(task_msg_data_t),pool); - - client->task = apt_poller_task_create( - max_connection_count, - rtsp_client_poller_signal_process, - client, - msg_pool, - pool); - if(!client->task) { - return NULL; - } - - task = apt_poller_task_base_get(client->task); - if(task) { - apt_task_name_set(task,id); - } - - vtable = apt_poller_task_vtable_get(client->task); - if(vtable) { - vtable->process_msg = rtsp_client_task_msg_process; - } - - APR_RING_INIT(&client->connection_list, rtsp_client_connection_t, link); - client->request_timeout = (apr_uint32_t)request_timeout; - return client; -} - -/** Destroy RTSP client */ -RTSP_DECLARE(apt_bool_t) rtsp_client_destroy(rtsp_client_t *client) -{ - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy RTSP Client [%s]", - rtsp_client_id_get(client)); - return apt_poller_task_destroy(client->task); -} - -/** Start connection agent */ -RTSP_DECLARE(apt_bool_t) rtsp_client_start(rtsp_client_t *client) -{ - return apt_poller_task_start(client->task); -} - -/** Terminate connection agent */ -RTSP_DECLARE(apt_bool_t) rtsp_client_terminate(rtsp_client_t *client) -{ - return apt_poller_task_terminate(client->task); -} - -/** Get task */ -RTSP_DECLARE(apt_task_t*) rtsp_client_task_get(const rtsp_client_t *client) -{ - return apt_poller_task_base_get(client->task); -} - -/** Get external object */ -RTSP_DECLARE(void*) rtsp_client_object_get(const rtsp_client_t *client) -{ - return client->obj; -} - -/** Get object associated with the session */ -RTSP_DECLARE(void*) rtsp_client_session_object_get(const rtsp_client_session_t *session) -{ - return session->obj; -} - -/** Set object associated with the session */ -RTSP_DECLARE(void) rtsp_client_session_object_set(rtsp_client_session_t *session, void *obj) -{ - session->obj = obj; -} - -/** Get the session identifier */ -RTSP_DECLARE(const apt_str_t*) rtsp_client_session_id_get(const rtsp_client_session_t *session) -{ - return &session->id; -} - -/** Signal task message */ -static apt_bool_t rtsp_client_control_message_signal( - task_msg_data_type_e type, - rtsp_client_t *client, - rtsp_client_session_t *session, - rtsp_message_t *message) -{ - apt_task_t *task = apt_poller_task_base_get(client->task); - apt_task_msg_t *task_msg = apt_task_msg_get(task); - if(task_msg) { - task_msg_data_t *data = (task_msg_data_t*)task_msg->data; - data->type = type; - data->client = client; - data->session = session; - data->message = message; - apt_task_msg_signal(task,task_msg); - } - return TRUE; -} - -/** Create RTSP session handle */ -RTSP_DECLARE(rtsp_client_session_t*) rtsp_client_session_create( - rtsp_client_t *client, - const char *server_ip, - apr_port_t server_port, - const char *resource_location) -{ - rtsp_client_session_t *session; - apr_pool_t *pool = apt_pool_create(); - session = apr_palloc(pool,sizeof(rtsp_client_session_t)); - session->pool = pool; - session->obj = NULL; - session->connection = NULL; - session->active_request = NULL; - session->pending_request_queue = apt_list_create(pool); - session->request_timer = apt_poller_task_timer_create( - client->task, - rtsp_client_timer_proc, - session, - pool); - session->resource_table = apr_hash_make(pool); - session->term_state = TERMINATION_STATE_NONE; - - apt_string_assign(&session->server_ip,server_ip,pool); - session->server_port = server_port; - apt_string_assign(&session->resource_location,resource_location,pool); - apt_string_reset(&session->id); - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create RTSP Handle "APT_PTR_FMT,session); - return session; -} - -/** Destroy RTSP session handle */ -RTSP_DECLARE(void) rtsp_client_session_destroy(rtsp_client_session_t *session) -{ - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy RTSP Handle "APT_PTR_FMT,session); - if(session && session->pool) { - apr_pool_destroy(session->pool); - } -} - -/** Signal terminate request */ -RTSP_DECLARE(apt_bool_t) rtsp_client_session_terminate(rtsp_client_t *client, rtsp_client_session_t *session) -{ - return rtsp_client_control_message_signal(TASK_MSG_TERMINATE_SESSION,client,session,NULL); -} - -/** Signal RTSP message */ -RTSP_DECLARE(apt_bool_t) rtsp_client_session_request(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *message) -{ - return rtsp_client_control_message_signal(TASK_MSG_SEND_MESSAGE,client,session,message); -} - - -/** Create connection */ -static apt_bool_t rtsp_client_connect(rtsp_client_t *client, rtsp_client_connection_t *connection, const char *ip, apr_port_t port) -{ - char *local_ip = NULL; - char *remote_ip = NULL; - apr_sockaddr_t *l_sockaddr = NULL; - apr_sockaddr_t *r_sockaddr = NULL; - - if(apr_sockaddr_info_get(&r_sockaddr,ip,APR_INET,port,0,connection->pool) != APR_SUCCESS) { - return FALSE; - } - - if(apr_socket_create(&connection->sock,r_sockaddr->family,SOCK_STREAM,APR_PROTO_TCP,connection->pool) != APR_SUCCESS) { - return FALSE; - } - - apr_socket_opt_set(connection->sock, APR_SO_NONBLOCK, 0); - apr_socket_timeout_set(connection->sock, -1); - apr_socket_opt_set(connection->sock, APR_SO_REUSEADDR, 1); - - if(apr_socket_connect(connection->sock,r_sockaddr) != APR_SUCCESS) { - apr_socket_close(connection->sock); - connection->sock = NULL; - return FALSE; - } - - if(apr_socket_addr_get(&l_sockaddr,APR_LOCAL,connection->sock) != APR_SUCCESS) { - apr_socket_close(connection->sock); - connection->sock = NULL; - return FALSE; - } - - apr_sockaddr_ip_get(&local_ip,l_sockaddr); - apr_sockaddr_ip_get(&remote_ip,r_sockaddr); - connection->id = apr_psprintf(connection->pool,"%s:%hu <-> %s:%hu", - local_ip,l_sockaddr->port, - remote_ip,r_sockaddr->port); - - memset(&connection->sock_pfd,0,sizeof(apr_pollfd_t)); - connection->sock_pfd.desc_type = APR_POLL_SOCKET; - connection->sock_pfd.reqevents = APR_POLLIN; - connection->sock_pfd.desc.s = connection->sock; - connection->sock_pfd.client_data = connection; - if(apt_poller_task_descriptor_add(client->task,&connection->sock_pfd) != TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Add to Pollset %s",connection->id); - apr_socket_close(connection->sock); - connection->sock = NULL; - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Established RTSP Connection %s",connection->id); - return TRUE; -} - -/** Close connection */ -static apt_bool_t rtsp_client_connection_close(rtsp_client_t *client, rtsp_client_connection_t *connection) -{ - if(connection->sock) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Close RTSP Connection %s",connection->id); - apt_poller_task_descriptor_remove(client->task,&connection->sock_pfd); - apr_socket_close(connection->sock); - connection->sock = NULL; - } - return TRUE; -} - - -/* Create RTSP connection */ -static apt_bool_t rtsp_client_connection_create(rtsp_client_t *client, rtsp_client_session_t *session) -{ - rtsp_client_connection_t *rtsp_connection; - apr_pool_t *pool = apt_pool_create(); - if(!pool) { - return FALSE; - } - - rtsp_connection = apr_palloc(pool,sizeof(rtsp_client_connection_t)); - rtsp_connection->pool = pool; - rtsp_connection->sock = NULL; - APR_RING_ELEM_INIT(rtsp_connection,link); - - if(rtsp_client_connect(client,rtsp_connection,session->server_ip.buf,session->server_port) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Connect to RTSP Server %s:%hu", - session->server_ip.buf,session->server_port); - apr_pool_destroy(pool); - return FALSE; - } - rtsp_connection->handle_table = apr_hash_make(pool); - rtsp_connection->session_table = apr_hash_make(pool); - rtsp_connection->inprogress_request_queue = apt_list_create(pool); - apt_text_stream_init(&rtsp_connection->rx_stream,rtsp_connection->rx_buffer,sizeof(rtsp_connection->rx_buffer)-1); - apt_text_stream_init(&rtsp_connection->tx_stream,rtsp_connection->tx_buffer,sizeof(rtsp_connection->tx_buffer)-1); - rtsp_connection->parser = rtsp_parser_create(pool); - rtsp_connection->generator = rtsp_generator_create(pool); - rtsp_connection->last_cseq = 0; - - rtsp_connection->client = client; - APR_RING_INSERT_TAIL(&client->connection_list,rtsp_connection,rtsp_client_connection_t,link); - session->connection = rtsp_connection; - return TRUE; -} - -/* Destroy RTSP connection */ -static apt_bool_t rtsp_client_connection_destroy(rtsp_client_connection_t *rtsp_connection) -{ - rtsp_client_t *client = rtsp_connection->client; - APR_RING_REMOVE(rtsp_connection,link); - rtsp_client_connection_close(client,rtsp_connection); - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy RTSP Connection %s",rtsp_connection->id); - apr_pool_destroy(rtsp_connection->pool); - - return TRUE; -} - -/* Respond to session termination request */ -static apt_bool_t rtsp_client_session_terminate_respond(rtsp_client_t *client, rtsp_client_session_t *session) -{ - rtsp_client_connection_t *rtsp_connection = session->connection; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove RTSP Handle "APT_PTR_FMT,session); - apr_hash_set(rtsp_connection->handle_table,session,sizeof(void*),NULL); - - session->term_state = TERMINATION_STATE_NONE; - client->vtable->on_session_terminate_response(client,session); - return TRUE; -} - -/* Teardown session resources */ -static apt_bool_t rtsp_client_session_resources_teardown(rtsp_client_t *client, rtsp_client_session_t *session) -{ - void *val; - rtsp_message_t *setup_request; - rtsp_message_t *teardown_request; - apr_hash_index_t *it; - - /* set termination state to in-progress and teardown remaining resources */ - session->term_state = TERMINATION_STATE_INPROGRESS; - it = apr_hash_first(session->pool,session->resource_table); - for(; it; it = apr_hash_next(it)) { - apr_hash_this(it,NULL,NULL,&val); - setup_request = val; - if(!setup_request) continue; - - teardown_request = rtsp_request_create(session->pool); - teardown_request->start_line.common.request_line.resource_name = setup_request->start_line.common.request_line.resource_name; - teardown_request->start_line.common.request_line.method_id = RTSP_METHOD_TEARDOWN; - rtsp_client_session_message_process(client,session,teardown_request); - } - return TRUE; -} - -/* Process session termination request */ -static apt_bool_t rtsp_client_session_terminate_process(rtsp_client_t *client, rtsp_client_session_t *session) -{ - rtsp_client_connection_t *rtsp_connection = session->connection; - if(!rtsp_connection) { - client->vtable->on_session_terminate_response(client,session); - return FALSE; - } - - if(session->active_request) { - /* set termination state to requested */ - session->term_state = TERMINATION_STATE_REQUESTED; - } - else { - rtsp_client_session_resources_teardown(client,session); - - /* respond immediately if no resources left */ - if(apr_hash_count(session->resource_table) == 0) { - rtsp_client_session_terminate_respond(client,session); - - if(apr_hash_count(rtsp_connection->handle_table) == 0) { - rtsp_client_connection_destroy(rtsp_connection); - } - } - } - - return TRUE; -} - -static apt_bool_t rtsp_client_session_url_generate(rtsp_client_session_t *session, rtsp_message_t *message) -{ - apt_str_t *url = &message->start_line.common.request_line.url; - if(session->resource_location.length) { - url->buf = apr_psprintf(message->pool,"rtsp://%s:%hu/%s/%s", - session->server_ip.buf, - session->server_port, - session->resource_location.buf, - message->start_line.common.request_line.resource_name); - } - else { - url->buf = apr_psprintf(message->pool,"rtsp://%s:%hu/%s", - session->server_ip.buf, - session->server_port, - message->start_line.common.request_line.resource_name); - } - url->length = strlen(url->buf); - return TRUE; -} - -static apt_bool_t rtsp_client_request_push(rtsp_client_connection_t *rtsp_connection, rtsp_client_session_t *session, rtsp_message_t *message) -{ - /* add request to inprogress request queue */ - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Push RTSP Request to In-Progress Queue "APT_PTRSID_FMT" CSeq:%"APR_SIZE_T_FMT, - session, - message->header.session_id.buf ? message->header.session_id.buf : "new", - message->header.cseq); - apt_list_push_back(rtsp_connection->inprogress_request_queue,session,session->pool); - session->active_request = message; - if(rtsp_connection->client->request_timeout) { - apt_timer_set(session->request_timer,rtsp_connection->client->request_timeout); - } - return TRUE; -} - -static apt_bool_t rtsp_client_request_pop(rtsp_client_connection_t *rtsp_connection, rtsp_message_t *response, rtsp_message_t **ret_request, rtsp_client_session_t **ret_session) -{ - rtsp_client_session_t *session; - apt_list_elem_t *elem = apt_list_first_elem_get(rtsp_connection->inprogress_request_queue); - while(elem) { - session = apt_list_elem_object_get(elem); - if(session->active_request && session->active_request->header.cseq == response->header.cseq) { - if(ret_session) { - *ret_session = session; - } - if(ret_request) { - *ret_request = session->active_request; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Pop In-Progress RTSP Request "APT_PTR_FMT" CSeq:%"APR_SIZE_T_FMT, - session, - response->header.cseq); - apt_list_elem_remove(rtsp_connection->inprogress_request_queue,elem); - session->active_request = NULL; - apt_timer_kill(session->request_timer); - return TRUE; - } - elem = apt_list_next_elem_get(rtsp_connection->inprogress_request_queue,elem); - } - return FALSE; -} - -/* Process outgoing RTSP request */ -static apt_bool_t rtsp_client_session_request_process(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *message) -{ - if(!session->connection) { - /* create RTSP connection */ - if(rtsp_client_connection_create(client,session) == FALSE) { - /* respond with error */ - return FALSE; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Add RTSP Handle "APT_PTR_FMT,session); - apr_hash_set(session->connection->handle_table,session,sizeof(void*),session); - } - - rtsp_client_session_url_generate(session,message); - - if(session->id.length) { - message->header.session_id = session->id; - rtsp_header_property_add(&message->header,RTSP_HEADER_FIELD_SESSION_ID,message->pool); - } - - message->header.cseq = ++session->connection->last_cseq; - rtsp_header_property_add(&message->header,RTSP_HEADER_FIELD_CSEQ,message->pool); - - if(rtsp_client_message_send(client,session->connection,message) == FALSE) { - /* respond with error */ - return FALSE; - } - - return rtsp_client_request_push(session->connection,session,message); -} - -/* Process pending RTSP requests */ -static apt_bool_t rtsp_client_session_pending_requests_process(rtsp_client_t *client, rtsp_client_session_t *session) -{ - rtsp_message_t *request = apt_list_pop_front(session->pending_request_queue); - if(!request) { - /* pending queue is empty, no in-progress request */ - return FALSE; - } - - /* process pending request; get the next one, if current is failed */ - do { - rtsp_message_t *response; - if(rtsp_client_session_request_process(client,session,request) == TRUE) { - return TRUE; - } - - /* respond with error */ - response = rtsp_response_create( - request, - RTSP_STATUS_CODE_INTERNAL_SERVER_ERROR, - RTSP_REASON_PHRASE_INTERNAL_SERVER_ERROR, - session->pool); - rtsp_client_session_response_process(client,session,request,response); - - /* process the next pending request / if any */ - request = apt_list_pop_front(session->pending_request_queue); - } - while(request); - - /* no in-progress request */ - return FALSE; -} - - -/* Process outgoing RTSP message */ -static apt_bool_t rtsp_client_session_message_process(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *message) -{ - if(session->active_request) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Push RTSP Request to Pending Queue "APT_PTR_FMT,session); - apt_list_push_back(session->pending_request_queue,message,message->pool); - return TRUE; - } - - if(rtsp_client_session_request_process(client,session,message) == FALSE) { - /* respond with error in case request cannot be processed */ - rtsp_message_t *response = rtsp_response_create( - message, - RTSP_STATUS_CODE_INTERNAL_SERVER_ERROR, - RTSP_REASON_PHRASE_INTERNAL_SERVER_ERROR, - session->pool); - rtsp_client_session_response_process(client,session,message,response); - } - return TRUE; -} - -/* Process incoming RTSP event (request) */ -static apt_bool_t rtsp_client_session_event_process(rtsp_client_t *client, rtsp_client_connection_t *rtsp_connection, rtsp_message_t *message) -{ - rtsp_message_t *response = NULL; - rtsp_client_session_t *session = NULL; - if(rtsp_header_property_check(&message->header,RTSP_HEADER_FIELD_SESSION_ID) == TRUE) { - /* find existing session */ - session = apr_hash_get( - rtsp_connection->session_table, - message->header.session_id.buf, - message->header.session_id.length); - } - - if(session) { - response = rtsp_response_create(message,RTSP_STATUS_CODE_OK,RTSP_REASON_PHRASE_OK,message->pool); - if(rtsp_header_property_check(&message->header,RTSP_HEADER_FIELD_SESSION_ID) == TRUE) { - response->header.session_id = message->header.session_id; - rtsp_header_property_add(&response->header,RTSP_HEADER_FIELD_SESSION_ID,message->pool); - } - client->vtable->on_session_event(client,session,message); - } - else { - response = rtsp_response_create(message,RTSP_STATUS_CODE_NOT_FOUND,RTSP_REASON_PHRASE_NOT_FOUND,message->pool); - } - - return rtsp_client_message_send(client,rtsp_connection,response); -} - -/* Process incoming RTSP response */ -static apt_bool_t rtsp_client_session_response_process(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *request, rtsp_message_t *response) -{ - const char *resource_name; - if(request->start_line.common.request_line.method_id == RTSP_METHOD_SETUP && - response->start_line.common.status_line.status_code == RTSP_STATUS_CODE_OK) { - - if(apr_hash_count(session->resource_table) == 0) { - if(rtsp_header_property_check(&response->header,RTSP_HEADER_FIELD_SESSION_ID) == TRUE) { - session->id = response->header.session_id; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Add RTSP Session "APT_PTRSID_FMT, - session, - session->id.buf); - apr_hash_set(session->connection->session_table,session->id.buf,session->id.length,session); - } - } - - /* add resource */ - resource_name = request->start_line.common.request_line.resource_name; - apr_hash_set(session->resource_table,resource_name,APR_HASH_KEY_STRING,request); - } - else if(request->start_line.common.request_line.method_id == RTSP_METHOD_TEARDOWN) { - /* remove resource */ - resource_name = request->start_line.common.request_line.resource_name; - apr_hash_set(session->resource_table,resource_name,APR_HASH_KEY_STRING,NULL); - - if(apr_hash_count(session->resource_table) == 0) { - if(session->connection) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove RTSP Session "APT_PTRSID_FMT, - session, - session->id.buf); - apr_hash_set(session->connection->session_table,session->id.buf,session->id.length,NULL); - } - } - } - - if(session->term_state != TERMINATION_STATE_INPROGRESS) { - client->vtable->on_session_response(client,session,request,response); - } - - return TRUE; -} - -/* Raise RTSP session terminate event */ -static apt_bool_t rtsp_client_session_terminate_raise(rtsp_client_t *client, rtsp_client_session_t *session) -{ - rtsp_message_t *request; - rtsp_message_t *response; - - /* cancel pending requests */ - do { - request = apt_list_pop_front(session->pending_request_queue); - if(request) { - response = rtsp_response_create( - session->active_request, - RTSP_STATUS_CODE_INTERNAL_SERVER_ERROR, - RTSP_REASON_PHRASE_INTERNAL_SERVER_ERROR, - session->pool); - rtsp_client_session_response_process(client,session,request,response); - } - } - while(request); - - if(session->term_state == TERMINATION_STATE_NONE) { - client->vtable->on_session_terminate_event(client,session); - } - else { - rtsp_client_session_terminate_respond(client,session); - } - return TRUE; -} - -/* Cancel RTSP request */ -static apt_bool_t rtsp_client_request_cancel(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_status_code_e status_code, rtsp_reason_phrase_e reason) -{ - rtsp_message_t *request; - rtsp_message_t *response; - if(!session->active_request) { - return FALSE; - } - - request = session->active_request; - response = rtsp_response_create( - request, - status_code, - reason, - session->pool); - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Cancel RTSP Request "APT_PTRSID_FMT" CSeq:%"APR_SIZE_T_FMT" [%d]", - session, - request->header.session_id.buf ? request->header.session_id.buf : "new", - request->header.cseq, - status_code); - - return rtsp_client_message_handler(session->connection, response, APT_MESSAGE_STATUS_COMPLETE); -} - -/* RTSP connection disconnected */ -static apt_bool_t rtsp_client_on_disconnect(rtsp_client_t *client, rtsp_client_connection_t *rtsp_connection) -{ - rtsp_client_session_t *session; - apr_size_t remaining_handles; - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"RTSP Peer Disconnected %s", rtsp_connection->id); - rtsp_client_connection_close(client,rtsp_connection); - - /* Cancel in-progreess requests */ - do { - session = apt_list_pop_front(rtsp_connection->inprogress_request_queue); - if(session) { - if(rtsp_client_request_cancel( - client, - session, - RTSP_STATUS_CODE_INTERNAL_SERVER_ERROR, - RTSP_REASON_PHRASE_INTERNAL_SERVER_ERROR) == TRUE) { - apt_timer_kill(session->request_timer); - } - } - } - while(session); - - /* Walk through RTSP handles and raise termination event for them */ - remaining_handles = apr_hash_count(rtsp_connection->handle_table); - if(remaining_handles) { - void *val; - apr_hash_index_t *it; - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Terminate Remaining RTSP Handles [%"APR_SIZE_T_FMT"]",remaining_handles); - it = apr_hash_first(rtsp_connection->pool,rtsp_connection->session_table); - for(; it; it = apr_hash_next(it)) { - apr_hash_this(it,NULL,NULL,&val); - session = val; - if(session) { - rtsp_client_session_terminate_raise(client,session); - } - } - } - - return TRUE; -} - -/* Send RTSP message through RTSP connection */ -static apt_bool_t rtsp_client_message_send(rtsp_client_t *client, rtsp_client_connection_t *rtsp_connection, rtsp_message_t *message) -{ - apt_bool_t status = FALSE; - apt_text_stream_t *stream; - apt_message_status_e result; - - if(!rtsp_connection || !rtsp_connection->sock) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No RTSP Connection"); - return FALSE; - } - stream = &rtsp_connection->tx_stream; - - do { - stream->text.length = sizeof(rtsp_connection->tx_buffer)-1; - apt_text_stream_reset(stream); - result = rtsp_generator_run(rtsp_connection->generator,message,stream); - if(result != APT_MESSAGE_STATUS_INVALID) { - stream->text.length = stream->pos - stream->text.buf; - *stream->pos = '\0'; - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Send RTSP Data %s [%"APR_SIZE_T_FMT" bytes]\n%s", - rtsp_connection->id, - stream->text.length, - stream->text.buf); - if(apr_socket_send(rtsp_connection->sock,stream->text.buf,&stream->text.length) == APR_SUCCESS) { - status = TRUE; - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Send RTSP Data"); - } - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Generate RTSP Data"); - } - } - while(result == APT_MESSAGE_STATUS_INCOMPLETE); - - return status; -} - -/** Return TRUE to proceed with the next message in the stream (if any) */ -static apt_bool_t rtsp_client_message_handler(rtsp_client_connection_t *rtsp_connection, rtsp_message_t *message, apt_message_status_e status) -{ - if(status != APT_MESSAGE_STATUS_COMPLETE) { - /* message is not completely parsed, nothing to do */ - return TRUE; - } - /* process parsed message */ - if(message->start_line.message_type == RTSP_MESSAGE_TYPE_RESPONSE) { - rtsp_message_t *request; - rtsp_client_session_t *session; - /* at first, pop in-progress request/session */ - if(rtsp_client_request_pop(rtsp_connection,message,&request,&session) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unexpected RTSP Response Received CSeq:%"APR_SIZE_T_FMT, - message->header.cseq); - return TRUE; - } - - /* next, process session response */ - rtsp_client_session_response_process(rtsp_connection->client,session,request,message); - - /* process session pending requests */ - if(rtsp_client_session_pending_requests_process(rtsp_connection->client,session) == FALSE) { - /* no in-progress request, check the termination state now */ - if(session->term_state != TERMINATION_STATE_NONE) { - if(session->term_state == TERMINATION_STATE_REQUESTED) { - rtsp_client_session_resources_teardown(rtsp_connection->client,session); - } - - /* respond if no resources left */ - if(apr_hash_count(session->resource_table) == 0) { - rtsp_client_session_terminate_respond(rtsp_connection->client,session); - - if(apr_hash_count(rtsp_connection->handle_table) == 0) { - rtsp_client_connection_destroy(rtsp_connection); - /* return FALSE to indicate connection has been destroyed */ - return FALSE; - } - } - } - } - } - else if(message->start_line.message_type == RTSP_MESSAGE_TYPE_REQUEST) { - rtsp_client_session_event_process(rtsp_connection->client,rtsp_connection,message); - } - return TRUE; -} - -/* Receive RTSP message through RTSP connection */ -static apt_bool_t rtsp_client_poller_signal_process(void *obj, const apr_pollfd_t *descriptor) -{ - rtsp_client_t *client = obj; - rtsp_client_connection_t *rtsp_connection = descriptor->client_data; - apr_status_t status; - apr_size_t offset; - apr_size_t length; - apt_text_stream_t *stream; - rtsp_message_t *message; - apt_message_status_e msg_status; - - if(!rtsp_connection || !rtsp_connection->sock) { - return FALSE; - } - stream = &rtsp_connection->rx_stream; - - /* calculate offset remaining from the previous receive / if any */ - offset = stream->pos - stream->text.buf; - /* calculate available length */ - length = sizeof(rtsp_connection->rx_buffer) - 1 - offset; - - status = apr_socket_recv(rtsp_connection->sock,stream->pos,&length); - if(status == APR_EOF || length == 0) { - return rtsp_client_on_disconnect(client,rtsp_connection); - } - - /* calculate actual length of the stream */ - stream->text.length = offset + length; - stream->pos[length] = '\0'; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive RTSP Data %s [%"APR_SIZE_T_FMT" bytes]\n%s", - rtsp_connection->id, - length, - stream->pos); - - /* reset pos */ - apt_text_stream_reset(stream); - - do { - msg_status = rtsp_parser_run(rtsp_connection->parser,stream,&message); - if(rtsp_client_message_handler(rtsp_connection,message,msg_status) == FALSE) { - return FALSE; - } - } - while(apt_text_is_eos(stream) == FALSE); - - /* scroll remaining stream */ - apt_text_stream_scroll(stream); - return TRUE; -} - -/* Process task message */ -static apt_bool_t rtsp_client_task_msg_process(apt_task_t *task, apt_task_msg_t *task_msg) -{ - apt_poller_task_t *poller_task = apt_task_object_get(task); - rtsp_client_t *client = apt_poller_task_object_get(poller_task); - - task_msg_data_t *data = (task_msg_data_t*) task_msg->data; - switch(data->type) { - case TASK_MSG_SEND_MESSAGE: - rtsp_client_session_message_process(client,data->session,data->message); - break; - case TASK_MSG_TERMINATE_SESSION: - rtsp_client_session_terminate_process(client,data->session); - break; - } - - return TRUE; -} - -/* Timer callback */ -static void rtsp_client_timer_proc(apt_timer_t *timer, void *obj) -{ - rtsp_client_session_t *session = obj; - if(!session || !session->connection || !session->connection->client) { - return; - } - - if(session->request_timer == timer) { - rtsp_client_request_cancel( - session->connection->client, - session, - RTSP_STATUS_CODE_REQUEST_TIMEOUT, - RTSP_REASON_PHRASE_REQUEST_TIMEOUT); - } -} diff --git a/libs/unimrcp/libs/uni-rtsp/src/rtsp_header.c b/libs/unimrcp/libs/uni-rtsp/src/rtsp_header.c deleted file mode 100644 index 4aee7d7dd0..0000000000 --- a/libs/unimrcp/libs/uni-rtsp/src/rtsp_header.c +++ /dev/null @@ -1,420 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: rtsp_header.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "rtsp_header.h" -#include "apt_string_table.h" -#include "apt_text_stream.h" - -/** String table of RTSP header fields (rtsp_header_field_id) */ -static const apt_str_table_item_t rtsp_header_string_table[] = { - {{"CSeq", 4},1}, - {{"Transport", 9},0}, - {{"Session", 7},0}, - {{"RTP-Info", 8},0}, - {{"Content-Type", 12},8}, - {{"Content-Length",14},8} -}; - -/** String table of RTSP content types (rtsp_content_type) */ -static const apt_str_table_item_t rtsp_content_type_string_table[] = { - {{"application/sdp", 15},12}, - {{"application/mrcp",16},12} -}; - -/** String table of RTSP transport protocols (rtsp_transport_e) */ -static const apt_str_table_item_t rtsp_transport_string_table[] = { - {{"RTP", 3},0} -}; - -/** String table of RTSP lower transport protocols (rtsp_lower_transport_e) */ -static const apt_str_table_item_t rtsp_lower_transport_string_table[] = { - {{"UDP", 3},0}, - {{"TCP", 3},0} -}; - -/** String table of RTSP transport profiles (rtsp_profile_e) */ -static const apt_str_table_item_t rtsp_profile_string_table[] = { - {{"AVP", 3},0}, - {{"SAVP",4},0} -}; - -/** String table of RTSP transport attributes (rtsp_transport_attrib_e) */ -static const apt_str_table_item_t rtsp_transport_attrib_string_table[] = { - {{"client_port", 11},0}, - {{"server_port", 11},2}, - {{"source", 6},2}, - {{"destination", 11},0}, - {{"unicast", 7},0}, - {{"multicast", 9},1}, - {{"mode", 4},2} -}; - -/** Parse RTSP transport port range */ -static apt_bool_t rtsp_port_range_parse(rtsp_port_range_t *port_range, apt_text_stream_t *stream) -{ - apt_str_t value; - /* read min value */ - if(apt_text_field_read(stream,'-',TRUE,&value) == FALSE) { - return FALSE; - } - port_range->min = (apr_port_t)apt_size_value_parse(&value); - - /* read optional max value */ - if(apt_text_field_read(stream,';',TRUE,&value) == TRUE) { - port_range->max = (apr_port_t)apt_size_value_parse(&value); - } - - return TRUE; -} - -/** Generate RTSP transport port range */ -static apt_bool_t rtsp_port_range_generate(rtsp_transport_attrib_e attrib, const rtsp_port_range_t *port_range, apt_text_stream_t *text_stream) -{ - const apt_str_t *str; - str = apt_string_table_str_get(rtsp_transport_attrib_string_table,RTSP_TRANSPORT_ATTRIB_COUNT,attrib); - if(!str) { - return FALSE; - } - apt_text_string_insert(text_stream,str); - apt_text_char_insert(text_stream,'='); - apt_text_size_value_insert(text_stream,port_range->min); - if(port_range->max > port_range->min) { - apt_text_char_insert(text_stream,'-'); - apt_text_size_value_insert(text_stream,port_range->max); - } - return TRUE; -} - -/** Parse text value of RTSP transport attrib (source/destination, e.t.c) */ -static apt_bool_t rtsp_transport_attrib_value_parse(apt_str_t *value, apt_text_stream_t *stream, apr_pool_t *pool) -{ - apt_str_t field; - /* read value */ - if(apt_text_field_read(stream,';',TRUE,&field) == FALSE) { - return FALSE; - } - apt_string_copy(value,&field,pool); - return TRUE; -} - -/** Parse RTSP transport */ -static apt_bool_t rtsp_transport_attrib_parse(rtsp_transport_t *transport, const apt_str_t *field, apr_pool_t *pool) -{ - rtsp_transport_attrib_e attrib; - apt_str_t name; - apt_text_stream_t stream; - - stream.text = *field; - apt_text_stream_reset(&stream); - - /* read attrib name */ - if(apt_text_field_read(&stream,'=',TRUE,&name) == FALSE) { - return FALSE; - } - - attrib = apt_string_table_id_find(rtsp_transport_attrib_string_table,RTSP_TRANSPORT_ATTRIB_COUNT,&name); - switch(attrib) { - case RTSP_TRANSPORT_ATTRIB_CLIENT_PORT: - rtsp_port_range_parse(&transport->client_port_range,&stream); - break; - case RTSP_TRANSPORT_ATTRIB_SERVER_PORT: - rtsp_port_range_parse(&transport->client_port_range,&stream); - break; - case RTSP_TRANSPORT_ATTRIB_SOURCE: - rtsp_transport_attrib_value_parse(&transport->source,&stream,pool); - break; - case RTSP_TRANSPORT_ATTRIB_DESTINATION: - rtsp_transport_attrib_value_parse(&transport->destination,&stream,pool); - break; - case RTSP_TRANSPORT_ATTRIB_UNICAST: - transport->delivery = RTSP_DELIVERY_UNICAST; - break; - case RTSP_TRANSPORT_ATTRIB_MULTICAST: - transport->delivery = RTSP_DELIVERY_MULTICAST; - break; - case RTSP_TRANSPORT_ATTRIB_MODE: - rtsp_transport_attrib_value_parse(&transport->mode,&stream,pool); - break; - default: - break; - } - return TRUE; -} - -/** Parse RTSP transport protocol (RTP/AVP[/UDP]) */ -static apt_bool_t rtsp_transport_protocol_parse(rtsp_transport_t *transport, const apt_str_t *value) -{ - apt_str_t field; - apt_text_stream_t stream; - - stream.text = *value; - apt_text_stream_reset(&stream); - - /* set the defaults */ - transport->protocol = RTSP_TRANSPORT_RTP; - transport->profile = RTSP_PROFILE_AVP; - transport->lower_protocol = RTSP_LOWER_TRANSPORT_UDP; - - /* read transport protocol (RTP) */ - if(apt_text_field_read(&stream,'/',TRUE,&field) == FALSE) { - return FALSE; - } - transport->protocol = apt_string_table_id_find(rtsp_transport_string_table,RTSP_TRANSPORT_COUNT,&field); - if(transport->protocol >= RTSP_TRANSPORT_COUNT) { - return FALSE; - } - - /* read transport profile (AVP) */ - if(apt_text_field_read(&stream,'/',TRUE,&field) == FALSE) { - return FALSE; - } - transport->profile = apt_string_table_id_find(rtsp_profile_string_table,RTSP_PROFILE_COUNT,&field); - if(transport->profile >= RTSP_PROFILE_COUNT) { - return FALSE; - } - - /* read optional lower transport protocol (UDP) */ - if(apt_text_field_read(&stream,'/',TRUE,&field) == TRUE) { - transport->lower_protocol = apt_string_table_id_find(rtsp_lower_transport_string_table,RTSP_LOWER_TRANSPORT_COUNT,&field); - if(transport->lower_protocol >= RTSP_LOWER_TRANSPORT_COUNT) { - return FALSE; - } - } - - return TRUE; -} - -/** Parse RTSP transport */ -static apt_bool_t rtsp_transport_parse(rtsp_transport_t *transport, const apt_str_t *value, apr_pool_t *pool) -{ - apt_str_t field; - apt_text_stream_t stream; - - apt_text_stream_init(&stream,value->buf,value->length); - /* read transport protocol (RTP/AVP[/UDP]) */ - if(apt_text_field_read(&stream,';',TRUE,&field) == FALSE) { - return FALSE; - } - - /* parse transport protocol (RTP/AVP[/UDP]) */ - if(rtsp_transport_protocol_parse(transport,&field) == FALSE) { - return FALSE; - } - - /* read transport attributes */ - while(apt_text_field_read(&stream,';',TRUE,&field) == TRUE) { - rtsp_transport_attrib_parse(transport,&field,pool); - } - - return TRUE; -} - -/** Generate RTSP transport */ -static apt_bool_t rtsp_transport_generate(const rtsp_transport_t *transport, apt_str_t *value, apr_pool_t *pool) -{ - char buf[256]; - apt_text_stream_t text_stream; - const apt_str_t *protocol = apt_string_table_str_get(rtsp_transport_string_table,RTSP_TRANSPORT_COUNT,transport->protocol); - const apt_str_t *profile = apt_string_table_str_get(rtsp_profile_string_table,RTSP_PROFILE_COUNT,transport->profile); - if(!protocol || !profile) { - return FALSE; - } - - apt_text_stream_init(&text_stream,buf,sizeof(buf)); - apt_text_string_insert(&text_stream,protocol); - apt_text_char_insert(&text_stream,'/'); - apt_text_string_insert(&text_stream,profile); - - if(transport->delivery != RTSP_DELIVERY_NONE) { - const apt_str_t *delivery = NULL; - rtsp_transport_attrib_e attrib = RTSP_TRANSPORT_ATTRIB_NONE; - if(transport->delivery == RTSP_DELIVERY_UNICAST) { - attrib = RTSP_TRANSPORT_ATTRIB_UNICAST; - } - else if(transport->delivery == RTSP_DELIVERY_MULTICAST) { - attrib = RTSP_TRANSPORT_ATTRIB_MULTICAST; - } - delivery = apt_string_table_str_get(rtsp_transport_attrib_string_table,RTSP_TRANSPORT_ATTRIB_COUNT,attrib); - if(!delivery) { - return FALSE; - } - - apt_text_char_insert(&text_stream,';'); - apt_text_string_insert(&text_stream,delivery); - } - - if(rtsp_port_range_is_valid(&transport->client_port_range) == TRUE) { - apt_text_char_insert(&text_stream,';'); - rtsp_port_range_generate(RTSP_TRANSPORT_ATTRIB_CLIENT_PORT,&transport->client_port_range,&text_stream); - } - if(rtsp_port_range_is_valid(&transport->server_port_range) == TRUE) { - apt_text_char_insert(&text_stream,';'); - rtsp_port_range_generate(RTSP_TRANSPORT_ATTRIB_SERVER_PORT,&transport->server_port_range,&text_stream); - } - - if(transport->mode.length) { - const apt_str_t *str; - str = apt_string_table_str_get(rtsp_transport_attrib_string_table,RTSP_TRANSPORT_ATTRIB_COUNT,RTSP_TRANSPORT_ATTRIB_MODE); - if(str) { - apt_text_char_insert(&text_stream,';'); - apt_text_string_insert(&text_stream,str); - apt_text_char_insert(&text_stream,'='); - apt_text_string_insert(&text_stream,&transport->mode); - } - } - value->length = text_stream.pos - text_stream.text.buf; - value->buf = apr_palloc(pool,value->length + 1); - memcpy(value->buf,text_stream.text.buf,value->length); - value->buf[value->length] = '\0'; - return TRUE; -} - -/** Parse RTSP transport */ -static apt_bool_t rtsp_session_id_parse(apt_str_t *session_id, const apt_str_t *value, apr_pool_t *pool) -{ - char *sep; - if(!value->buf) { - return FALSE; - } - apt_string_copy(session_id,value,pool); - sep = strchr(session_id->buf,';'); - if(sep) { - session_id->length = sep - session_id->buf; - *sep = '\0'; - } - return TRUE; -} - -/** Parse RTSP header field value */ -static apt_bool_t rtsp_header_field_value_parse(rtsp_header_t *header, rtsp_header_field_id id, const apt_str_t *value, apr_pool_t *pool) -{ - apt_bool_t status = TRUE; - switch(id) { - case RTSP_HEADER_FIELD_CSEQ: - header->cseq = apt_size_value_parse(value); - break; - case RTSP_HEADER_FIELD_TRANSPORT: - status = rtsp_transport_parse(&header->transport,value,pool); - break; - case RTSP_HEADER_FIELD_SESSION_ID: - status = rtsp_session_id_parse(&header->session_id,value,pool); - break; - case RTSP_HEADER_FIELD_RTP_INFO: - header->rtp_info = *value; - break; - case RTSP_HEADER_FIELD_CONTENT_TYPE: - header->content_type = apt_string_table_id_find(rtsp_content_type_string_table,RTSP_CONTENT_TYPE_COUNT,value); - break; - case RTSP_HEADER_FIELD_CONTENT_LENGTH: - header->content_length = apt_size_value_parse(value); - break; - default: - status = FALSE; - } - return status; -} - -/** Generate RTSP header field value */ -static apt_bool_t rtsp_header_field_value_generate(const rtsp_header_t *header, rtsp_header_field_id id, apt_str_t *value, apr_pool_t *pool) -{ - switch(id) { - case RTSP_HEADER_FIELD_CSEQ: - apt_size_value_generate(header->cseq,value,pool); - break; - case RTSP_HEADER_FIELD_TRANSPORT: - rtsp_transport_generate(&header->transport,value,pool); - break; - case RTSP_HEADER_FIELD_SESSION_ID: - *value = header->session_id; - break; - case RTSP_HEADER_FIELD_RTP_INFO: - *value = header->rtp_info; - break; - case RTSP_HEADER_FIELD_CONTENT_TYPE: - { - const apt_str_t *name = apt_string_table_str_get(rtsp_content_type_string_table,RTSP_CONTENT_TYPE_COUNT,header->content_type); - if(name) { - *value = *name; - } - break; - } - case RTSP_HEADER_FIELD_CONTENT_LENGTH: - apt_size_value_generate(header->content_length,value,pool); - break; - default: - break; - } - return TRUE; -} - -/** Add RTSP header field */ -RTSP_DECLARE(apt_bool_t) rtsp_header_field_add(rtsp_header_t *header, apt_header_field_t *header_field, apr_pool_t *pool) -{ - /* parse header field (name-value) */ - header_field->id = apt_string_table_id_find( - rtsp_header_string_table, - RTSP_HEADER_FIELD_COUNT, - &header_field->name); - if(apt_string_is_empty(&header_field->value) == FALSE) { - rtsp_header_field_value_parse(header,header_field->id,&header_field->value,pool); - } - - return apt_header_section_field_add(&header->header_section,header_field); -} - -/** Parse RTSP header fields */ -RTSP_DECLARE(apt_bool_t) rtsp_header_fields_parse(rtsp_header_t *header, apr_pool_t *pool) -{ - apt_header_field_t *header_field; - for(header_field = APR_RING_FIRST(&header->header_section.ring); - header_field != APR_RING_SENTINEL(&header->header_section.ring, apt_header_field_t, link); - header_field = APR_RING_NEXT(header_field, link)) { - - header_field->id = apt_string_table_id_find( - rtsp_header_string_table, - RTSP_HEADER_FIELD_COUNT, - &header_field->name); - if(apt_string_is_empty(&header_field->value) == FALSE) { - rtsp_header_field_value_parse(header,header_field->id,&header_field->value,pool); - } - apt_header_section_field_set(&header->header_section,header_field); - } - return TRUE; -} - -/** Add RTSP header field property */ -RTSP_DECLARE(apt_bool_t) rtsp_header_property_add(rtsp_header_t *header, rtsp_header_field_id id, apr_pool_t *pool) -{ - apt_header_field_t *header_field; - header_field = apt_header_section_field_get(&header->header_section,id); - if(header_field) { - /* such header field already exists, just (re)generate value */ - return rtsp_header_field_value_generate(header,id,&header_field->value,pool); - } - - header_field = apt_header_field_alloc(pool); - if(rtsp_header_field_value_generate(header,id,&header_field->value,pool) == TRUE) { - const apt_str_t *name = apt_string_table_str_get(rtsp_header_string_table,RTSP_HEADER_FIELD_COUNT,id); - if(name) { - header_field->name = *name; - header_field->id = id; - return apt_header_section_field_insert(&header->header_section,header_field); - } - } - return FALSE; -} diff --git a/libs/unimrcp/libs/uni-rtsp/src/rtsp_message.c b/libs/unimrcp/libs/uni-rtsp/src/rtsp_message.c deleted file mode 100644 index 59fd7168e0..0000000000 --- a/libs/unimrcp/libs/uni-rtsp/src/rtsp_message.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: rtsp_message.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "rtsp_message.h" - -/** Initialize RTSP message */ -static APR_INLINE void rtsp_message_init(rtsp_message_t *message, rtsp_message_type_e message_type, apr_pool_t *pool) -{ - message->pool = pool; - rtsp_start_line_init(&message->start_line,message_type); - rtsp_header_init(&message->header,pool); - apt_string_reset(&message->body); -} - -/** Create RTSP message */ -RTSP_DECLARE(rtsp_message_t*) rtsp_message_create(rtsp_message_type_e message_type, apr_pool_t *pool) -{ - rtsp_message_t *message = apr_palloc(pool,sizeof(rtsp_message_t)); - rtsp_message_init(message,message_type,pool); - return message; -} - -/** Create RTSP request message */ -RTSP_DECLARE(rtsp_message_t*) rtsp_request_create(apr_pool_t *pool) -{ - rtsp_message_t *request = rtsp_message_create(RTSP_MESSAGE_TYPE_REQUEST,pool); - request->start_line.common.request_line.version = RTSP_VERSION_1; - return request; -} - -/** Create RTSP response message */ -RTSP_DECLARE(rtsp_message_t*) rtsp_response_create(const rtsp_message_t *request, rtsp_status_code_e status_code, rtsp_reason_phrase_e reason, apr_pool_t *pool) -{ - const apt_str_t *reason_str; - rtsp_status_line_t *status_line; - rtsp_message_t *response = rtsp_message_create(RTSP_MESSAGE_TYPE_RESPONSE,pool); - status_line = &response->start_line.common.status_line; - status_line->version = request->start_line.common.request_line.version; - status_line->status_code = status_code; - reason_str = rtsp_reason_phrase_get(reason); - if(reason_str) { - apt_string_copy(&status_line->reason,reason_str,pool); - } - - if(rtsp_header_property_check(&request->header,RTSP_HEADER_FIELD_CSEQ) == TRUE) { - response->header.cseq = request->header.cseq; - rtsp_header_property_add(&response->header,RTSP_HEADER_FIELD_CSEQ,response->pool); - } - - if(rtsp_header_property_check(&request->header,RTSP_HEADER_FIELD_TRANSPORT) == TRUE) { - const rtsp_transport_t *req_transport = &request->header.transport; - rtsp_transport_t *res_transport = &response->header.transport; - if(req_transport->mode.length) { - apt_string_copy(&res_transport->mode,&req_transport->mode,pool); - } - } - - return response; -} - -/** Destroy RTSP message */ -RTSP_DECLARE(void) rtsp_message_destroy(rtsp_message_t *message) -{ - /* nothing to do message is allocated from pool */ -} diff --git a/libs/unimrcp/libs/uni-rtsp/src/rtsp_server.c b/libs/unimrcp/libs/uni-rtsp/src/rtsp_server.c deleted file mode 100644 index 428634fde2..0000000000 --- a/libs/unimrcp/libs/uni-rtsp/src/rtsp_server.c +++ /dev/null @@ -1,889 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: rtsp_server.c 2252 2014-11-21 02:45:15Z achaloyan@gmail.com $ - */ - -#ifdef WIN32 -#pragma warning(disable: 4127) -#endif -#include -#include -#include "rtsp_server.h" -#include "rtsp_stream.h" -#include "apt_poller_task.h" -#include "apt_text_stream.h" -#include "apt_pool.h" -#include "apt_obj_list.h" -#include "apt_log.h" - -#define RTSP_SESSION_ID_HEX_STRING_LENGTH 16 -#define RTSP_STREAM_BUFFER_SIZE 1024 - -typedef struct rtsp_server_connection_t rtsp_server_connection_t; - -/** RTSP server */ -struct rtsp_server_t { - apr_pool_t *pool; - apt_poller_task_t *task; - - /** List (ring) of RTSP connections */ - APR_RING_HEAD(rtsp_server_connection_head_t, rtsp_server_connection_t) connection_list; - - /* Listening socket descriptor */ - apr_sockaddr_t *sockaddr; - apr_socket_t *listen_sock; - apr_pollfd_t listen_sock_pfd; - - void *obj; - const rtsp_server_vtable_t *vtable; -}; - -/** RTSP connection */ -struct rtsp_server_connection_t { - /** Ring entry */ - APR_RING_ENTRY(rtsp_server_connection_t) link; - - /** Memory pool */ - apr_pool_t *pool; - /** Client IP address */ - char *client_ip; - /** Accepted socket */ - apr_socket_t *sock; - /** Socket poll descriptor */ - apr_pollfd_t sock_pfd; - /** String identifier used for traces */ - const char *id; - - /** RTSP server, connection belongs to */ - rtsp_server_t *server; - - /** Session table (rtsp_server_session_t*) */ - apr_hash_t *session_table; - - char rx_buffer[RTSP_STREAM_BUFFER_SIZE]; - apt_text_stream_t rx_stream; - rtsp_parser_t *parser; - - char tx_buffer[RTSP_STREAM_BUFFER_SIZE]; - apt_text_stream_t tx_stream; - rtsp_generator_t *generator; -}; - -/** RTSP session */ -struct rtsp_server_session_t { - apr_pool_t *pool; - void *obj; - rtsp_server_connection_t *connection; - - /** Session identifier */ - apt_str_t id; - - /** Last cseq sent */ - apr_size_t last_cseq; - - /** In-progress request */ - rtsp_message_t *active_request; - /** request queue */ - apt_obj_list_t *request_queue; - - /** Resource table */ - apr_hash_t *resource_table; - - /** In-progress termination request */ - apt_bool_t terminating; -}; - -typedef enum { - TASK_MSG_SEND_MESSAGE, - TASK_MSG_TERMINATE_SESSION -} task_msg_data_type_e; - -typedef struct task_msg_data_t task_msg_data_t; - -struct task_msg_data_t { - task_msg_data_type_e type; - rtsp_server_t *server; - rtsp_server_session_t *session; - rtsp_message_t *message; -}; - -static apt_bool_t rtsp_server_on_destroy(apt_task_t *task); -static apt_bool_t rtsp_server_task_msg_process(apt_task_t *task, apt_task_msg_t *msg); -static apt_bool_t rtsp_server_poller_signal_process(void *obj, const apr_pollfd_t *descriptor); -static apt_bool_t rtsp_server_message_send(rtsp_server_t *server, rtsp_server_connection_t *connection, rtsp_message_t *message); - -static apt_bool_t rtsp_server_listening_socket_create(rtsp_server_t *server); -static void rtsp_server_listening_socket_destroy(rtsp_server_t *server); - -/** Get string identifier */ -static const char* rtsp_server_id_get(const rtsp_server_t *server) -{ - apt_task_t *task = apt_poller_task_base_get(server->task); - return apt_task_name_get(task); -} - -/** Create RTSP server */ -RTSP_DECLARE(rtsp_server_t*) rtsp_server_create( - const char *id, - const char *listen_ip, - apr_port_t listen_port, - apr_size_t max_connection_count, - void *obj, - const rtsp_server_vtable_t *handler, - apr_pool_t *pool) -{ - apt_task_t *task; - apt_task_vtable_t *vtable; - apt_task_msg_pool_t *msg_pool; - rtsp_server_t *server; - - if(!listen_ip) { - return NULL; - } - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create RTSP Server [%s] %s:%hu [%"APR_SIZE_T_FMT"]", - id, - listen_ip, - listen_port, - max_connection_count); - server = apr_palloc(pool,sizeof(rtsp_server_t)); - server->pool = pool; - server->obj = obj; - server->vtable = handler; - - server->listen_sock = NULL; - server->sockaddr = NULL; - apr_sockaddr_info_get(&server->sockaddr,listen_ip,APR_INET,listen_port,0,pool); - if(!server->sockaddr) { - return NULL; - } - - msg_pool = apt_task_msg_pool_create_dynamic(sizeof(task_msg_data_t),pool); - - server->task = apt_poller_task_create( - max_connection_count + 1, - rtsp_server_poller_signal_process, - server, - msg_pool, - pool); - if(!server->task) { - return NULL; - } - - task = apt_poller_task_base_get(server->task); - if(task) { - apt_task_name_set(task,id); - } - - vtable = apt_poller_task_vtable_get(server->task); - if(vtable) { - vtable->destroy = rtsp_server_on_destroy; - vtable->process_msg = rtsp_server_task_msg_process; - } - - APR_RING_INIT(&server->connection_list, rtsp_server_connection_t, link); - - if(rtsp_server_listening_socket_create(server) != TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Listening Socket [%s] %s:%hu", - id, - listen_ip, - listen_port); - } - return server; -} - -static apt_bool_t rtsp_server_on_destroy(apt_task_t *task) -{ - apt_poller_task_t *poller_task = apt_task_object_get(task); - rtsp_server_t *server = apt_poller_task_object_get(poller_task); - - rtsp_server_listening_socket_destroy(server); - apt_poller_task_cleanup(poller_task); - return TRUE; -} - -/** Destroy RTSP server */ -RTSP_DECLARE(apt_bool_t) rtsp_server_destroy(rtsp_server_t *server) -{ - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy RTSP Server [%s]", - rtsp_server_id_get(server)); - return apt_poller_task_destroy(server->task); -} - -/** Start connection agent */ -RTSP_DECLARE(apt_bool_t) rtsp_server_start(rtsp_server_t *server) -{ - return apt_poller_task_start(server->task); -} - -/** Terminate connection agent */ -RTSP_DECLARE(apt_bool_t) rtsp_server_terminate(rtsp_server_t *server) -{ - return apt_poller_task_terminate(server->task); -} - -/** Get task */ -RTSP_DECLARE(apt_task_t*) rtsp_server_task_get(const rtsp_server_t *server) -{ - return apt_poller_task_base_get(server->task); -} - -/** Get external object */ -RTSP_DECLARE(void*) rtsp_server_object_get(const rtsp_server_t *server) -{ - return server->obj; -} - -/** Get object associated with the session */ -RTSP_DECLARE(void*) rtsp_server_session_object_get(const rtsp_server_session_t *session) -{ - return session->obj; -} - -/** Set object associated with the session */ -RTSP_DECLARE(void) rtsp_server_session_object_set(rtsp_server_session_t *session, void *obj) -{ - session->obj = obj; -} - -/** Get the session identifier */ -RTSP_DECLARE(const apt_str_t*) rtsp_server_session_id_get(const rtsp_server_session_t *session) -{ - return &session->id; -} - -/** Get active request */ -RTSP_DECLARE(const rtsp_message_t*) rtsp_server_session_request_get(const rtsp_server_session_t *session) -{ - return session->active_request; -} - -/** Get the session destination (client) IP address */ -RTSP_DECLARE(const char*) rtsp_server_session_destination_get(const rtsp_server_session_t *session) -{ - if(session->connection) { - return session->connection->client_ip; - } - return NULL; -} - -/** Signal task message */ -static apt_bool_t rtsp_server_control_message_signal( - task_msg_data_type_e type, - rtsp_server_t *server, - rtsp_server_session_t *session, - rtsp_message_t *message) -{ - apt_task_t *task = apt_poller_task_base_get(server->task); - apt_task_msg_t *task_msg = apt_task_msg_get(task); - if(task_msg) { - task_msg_data_t *data = (task_msg_data_t*)task_msg->data; - data->type = type; - data->server = server; - data->session = session; - data->message = message; - apt_task_msg_signal(task,task_msg); - } - return TRUE; -} - -/** Signal RTSP message */ -RTSP_DECLARE(apt_bool_t) rtsp_server_session_respond(rtsp_server_t *server, rtsp_server_session_t *session, rtsp_message_t *message) -{ - return rtsp_server_control_message_signal(TASK_MSG_SEND_MESSAGE,server,session,message); -} - -/** Signal terminate response */ -RTSP_DECLARE(apt_bool_t) rtsp_server_session_terminate(rtsp_server_t *server, rtsp_server_session_t *session) -{ - return rtsp_server_control_message_signal(TASK_MSG_TERMINATE_SESSION,server,session,NULL); -} - -/* Create RTSP session */ -static rtsp_server_session_t* rtsp_server_session_create(rtsp_server_t *server) -{ - rtsp_server_session_t *session; - apr_pool_t *pool = apt_pool_create(); - session = apr_palloc(pool,sizeof(rtsp_server_session_t)); - session->pool = pool; - session->obj = NULL; - session->last_cseq = 0; - session->active_request = NULL; - session->request_queue = apt_list_create(pool); - session->resource_table = apr_hash_make(pool); - session->terminating = FALSE; - - apt_unique_id_generate(&session->id,RTSP_SESSION_ID_HEX_STRING_LENGTH,pool); - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create RTSP Session "APT_SID_FMT,session->id.buf); - if(server->vtable->create_session(server,session) != TRUE) { - apr_pool_destroy(pool); - return NULL; - } - return session; -} - -/* Destroy RTSP session */ -static void rtsp_server_session_destroy(rtsp_server_session_t *session) -{ - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy RTSP Session "APT_SID_FMT, - session ? session->id.buf : "(null)"); - if(session && session->pool) { - apr_pool_destroy(session->pool); - } -} - -/** Destroy RTSP connection */ -static void rtsp_server_connection_destroy(rtsp_server_connection_t *rtsp_connection) -{ - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy RTSP Connection %s",rtsp_connection->id); - apr_pool_destroy(rtsp_connection->pool); -} - -/* Finally terminate RTSP session */ -static apt_bool_t rtsp_server_session_do_terminate(rtsp_server_t *server, rtsp_server_session_t *session) -{ - rtsp_server_connection_t *rtsp_connection = session->connection; - - if(session->active_request) { - rtsp_message_t *response = rtsp_response_create(session->active_request, - RTSP_STATUS_CODE_OK,RTSP_REASON_PHRASE_OK,session->active_request->pool); - if(response) { - if(session->id.buf) { - response->header.session_id = session->id; - rtsp_header_property_add(&response->header,RTSP_HEADER_FIELD_SESSION_ID,response->pool); - } - - if(rtsp_connection) { - rtsp_server_message_send(server,rtsp_connection,response); - } - } - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove RTSP Session "APT_SID_FMT,session->id.buf); - if(rtsp_connection) { - apr_hash_set(rtsp_connection->session_table,session->id.buf,session->id.length,NULL); - } - rtsp_server_session_destroy(session); - - if(rtsp_connection && !rtsp_connection->sock) { - if(apr_hash_count(rtsp_connection->session_table) == 0) { - rtsp_server_connection_destroy(rtsp_connection); - } - } - return TRUE; -} - -static apt_bool_t rtsp_server_error_respond(rtsp_server_t *server, rtsp_server_connection_t *rtsp_connection, rtsp_message_t *request, - rtsp_status_code_e status_code, rtsp_reason_phrase_e reason) -{ - /* send error response to client */ - rtsp_message_t *response = rtsp_response_create(request,status_code,reason,request->pool); - if(rtsp_server_message_send(server,rtsp_connection,response) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Send RTSP Response"); - return FALSE; - } - return TRUE; -} - -static apt_bool_t rtsp_server_session_terminate_request(rtsp_server_t *server, rtsp_server_session_t *session) -{ - session->terminating = TRUE; - return server->vtable->terminate_session(server,session); -} - -static apt_bool_t rtsp_server_session_message_handle(rtsp_server_t *server, rtsp_server_session_t *session, rtsp_message_t *message) -{ - if(message->start_line.common.request_line.method_id == RTSP_METHOD_TEARDOWN) { - /* remove resource */ - const char *resource_name = message->start_line.common.request_line.resource_name; - apr_hash_set(session->resource_table,resource_name,APR_HASH_KEY_STRING,NULL); - - if(apr_hash_count(session->resource_table) == 0) { - rtsp_server_session_terminate_request(server,session); - return TRUE; - } - } - - if(server->vtable->handle_message(server,session,message) != TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Handle Message "APT_SID_FMT,session->id.buf); - rtsp_server_error_respond(server,session->connection,message, - RTSP_STATUS_CODE_INTERNAL_SERVER_ERROR, - RTSP_REASON_PHRASE_INTERNAL_SERVER_ERROR); - return FALSE; - } - return TRUE; -} - -/* Process incoming SETUP/DESCRIBE request */ -static rtsp_server_session_t* rtsp_server_session_setup_process(rtsp_server_t *server, rtsp_server_connection_t *rtsp_connection, rtsp_message_t *message) -{ - rtsp_server_session_t *session = NULL; - if(message->start_line.common.request_line.method_id == RTSP_METHOD_SETUP) { - /* create new session */ - session = rtsp_server_session_create(server); - if(!session) { - return NULL; - } - session->connection = rtsp_connection; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Add RTSP Session "APT_SID_FMT,session->id.buf); - apr_hash_set(rtsp_connection->session_table,session->id.buf,session->id.length,session); - } - else if(message->start_line.common.request_line.method_id == RTSP_METHOD_DESCRIBE) { - /* create new session as a communication object */ - session = rtsp_server_session_create(server); - if(!session) { - return NULL; - } - session->connection = rtsp_connection; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Add RTSP Session "APT_SID_FMT,session->id.buf); - apr_hash_set(rtsp_connection->session_table,session->id.buf,session->id.length,session); - } - else { - /* error case */ - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Missing RTSP Session-ID"); - rtsp_server_error_respond(server,rtsp_connection,message, - RTSP_STATUS_CODE_BAD_REQUEST, - RTSP_REASON_PHRASE_BAD_REQUEST); - } - return session; -} - -/* Process incoming RTSP request */ -static apt_bool_t rtsp_server_session_request_process(rtsp_server_t *server, rtsp_server_connection_t *rtsp_connection, rtsp_message_t *message) -{ - rtsp_server_session_t *session = NULL; - if(message->start_line.message_type != RTSP_MESSAGE_TYPE_REQUEST) { - /* received response to ANNOUNCE request/event */ - return TRUE; - } - - if(rtsp_header_property_check(&message->header,RTSP_HEADER_FIELD_SESSION_ID) != TRUE) { - /* no session-id specified */ - session = rtsp_server_session_setup_process(server,rtsp_connection,message); - if(session) { - session->active_request = message; - if(rtsp_server_session_message_handle(server,session,message) != TRUE) { - rtsp_server_session_destroy(session); - } - } - else { - /* error case, failed to create a session */ - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create RTSP Session"); - return rtsp_server_error_respond(server,rtsp_connection,message, - RTSP_STATUS_CODE_NOT_ACCEPTABLE, - RTSP_REASON_PHRASE_NOT_ACCEPTABLE); - } - return TRUE; - } - - /* existing session */ - session = apr_hash_get( - rtsp_connection->session_table, - message->header.session_id.buf, - message->header.session_id.length); - if(!session) { - /* error case, no such session */ - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Such RTSP Session "APT_SID_FMT,message->header.session_id.buf); - return rtsp_server_error_respond(server,rtsp_connection,message, - RTSP_STATUS_CODE_NOT_FOUND, - RTSP_REASON_PHRASE_NOT_FOUND); - } - - if(session->terminating == TRUE) { - /* error case, session is being terminated */ - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Not Acceptable Request "APT_SID_FMT,message->header.session_id.buf); - return rtsp_server_error_respond(server,rtsp_connection,message, - RTSP_STATUS_CODE_NOT_ACCEPTABLE, - RTSP_REASON_PHRASE_NOT_ACCEPTABLE); - } - - if(session->active_request) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Push RTSP Request to Queue "APT_SID_FMT,session->id.buf); - apt_list_push_back(session->request_queue,message,message->pool); - return TRUE; - } - - /* handle the request */ - session->active_request = message; - rtsp_server_session_message_handle(server,session,message); - return TRUE; -} - -/* Process outgoing RTSP response */ -static apt_bool_t rtsp_server_session_response_process(rtsp_server_t *server, rtsp_server_session_t *session, rtsp_message_t *message) -{ - apt_bool_t terminate = FALSE; - rtsp_message_t *request = NULL; - if(message->start_line.message_type == RTSP_MESSAGE_TYPE_REQUEST) { - /* RTSP ANNOUNCE request (asynch event) */ - const char *resource_name = message->start_line.common.request_line.resource_name; - if(resource_name) { - request = apr_hash_get(session->resource_table,resource_name,APR_HASH_KEY_STRING); - } - if(!request) { - return FALSE; - } - message->start_line.common.request_line.url = request->start_line.common.request_line.url; - message->header.cseq = session->last_cseq; - rtsp_header_property_add(&message->header,RTSP_HEADER_FIELD_CSEQ,message->pool); - - if(session->id.buf) { - message->header.session_id = session->id; - rtsp_header_property_add(&message->header,RTSP_HEADER_FIELD_SESSION_ID,message->pool); - } - rtsp_server_message_send(server,session->connection,message); - return TRUE; - } - - if(!session->active_request) { - /* unexpected response */ - return FALSE; - } - - request = session->active_request; - if(request->start_line.common.request_line.method_id == RTSP_METHOD_DESCRIBE) { - terminate = TRUE; - } - else { - if(session->id.buf) { - message->header.session_id = session->id; - rtsp_header_property_add(&message->header,RTSP_HEADER_FIELD_SESSION_ID,message->pool); - } - if(request->start_line.common.request_line.method_id == RTSP_METHOD_SETUP) { - if(message->start_line.common.status_line.status_code == RTSP_STATUS_CODE_OK) { - /* add resource */ - const char *resource_name = request->start_line.common.request_line.resource_name; - apr_hash_set(session->resource_table,resource_name,APR_HASH_KEY_STRING,request); - } - else if(apr_hash_count(session->resource_table) == 0) { - terminate = TRUE; - } - } - } - - session->last_cseq = message->header.cseq; - rtsp_server_message_send(server,session->connection,message); - - if(terminate == TRUE) { - session->active_request = NULL; - rtsp_server_session_terminate_request(server,session); - return TRUE; - } - - session->active_request = apt_list_pop_front(session->request_queue); - if(session->active_request) { - rtsp_server_session_message_handle(server,session,session->active_request); - } - return TRUE; -} - -/* Send RTSP message through RTSP connection */ -static apt_bool_t rtsp_server_message_send(rtsp_server_t *server, rtsp_server_connection_t *rtsp_connection, rtsp_message_t *message) -{ - apt_bool_t status = FALSE; - apt_text_stream_t *stream; - apt_message_status_e result; - - if(!rtsp_connection || !rtsp_connection->sock) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No RTSP Connection"); - return FALSE; - } - stream = &rtsp_connection->tx_stream; - - do { - stream->text.length = sizeof(rtsp_connection->tx_buffer)-1; - apt_text_stream_reset(stream); - result = rtsp_generator_run(rtsp_connection->generator,message,stream); - if(result != APT_MESSAGE_STATUS_INVALID) { - stream->text.length = stream->pos - stream->text.buf; - *stream->pos = '\0'; - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Send RTSP Data %s [%"APR_SIZE_T_FMT" bytes]\n%s", - rtsp_connection->id, - stream->text.length, - stream->text.buf); - if(apr_socket_send(rtsp_connection->sock,stream->text.buf,&stream->text.length) == APR_SUCCESS) { - status = TRUE; - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Send RTSP Data"); - } - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Generate RTSP Data"); - } - } - while(result == APT_MESSAGE_STATUS_INCOMPLETE); - - return status; -} - -static apt_bool_t rtsp_server_message_handler(rtsp_server_connection_t *rtsp_connection, rtsp_message_t *message, apt_message_status_e status) -{ - if(status == APT_MESSAGE_STATUS_COMPLETE) { - /* message is completely parsed */ - apt_str_t *destination; - destination = &message->header.transport.destination; - if(!destination->buf && rtsp_connection->client_ip) { - apt_string_assign(destination,rtsp_connection->client_ip,rtsp_connection->pool); - } - rtsp_server_session_request_process(rtsp_connection->server,rtsp_connection,message); - } - else if(status == APT_MESSAGE_STATUS_INVALID) { - /* error case */ - rtsp_message_t *response; - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Parse RTSP Data"); - if(message) { - response = rtsp_response_create(message,RTSP_STATUS_CODE_BAD_REQUEST, - RTSP_REASON_PHRASE_BAD_REQUEST,message->pool); - if(rtsp_server_message_send(rtsp_connection->server,rtsp_connection,response) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Send RTSP Response"); - } - } - } - return TRUE; -} - -/** Create listening socket and add it to pollset */ -static apt_bool_t rtsp_server_listening_socket_create(rtsp_server_t *server) -{ - apr_status_t status; - - if(!server->sockaddr) { - return FALSE; - } - - /* create listening socket */ - status = apr_socket_create(&server->listen_sock, server->sockaddr->family, SOCK_STREAM, APR_PROTO_TCP, server->pool); - if(status != APR_SUCCESS) { - return FALSE; - } - - apr_socket_opt_set(server->listen_sock, APR_SO_NONBLOCK, 0); - apr_socket_timeout_set(server->listen_sock, -1); - apr_socket_opt_set(server->listen_sock, APR_SO_REUSEADDR, 1); - - status = apr_socket_bind(server->listen_sock, server->sockaddr); - if(status != APR_SUCCESS) { - apr_socket_close(server->listen_sock); - server->listen_sock = NULL; - return FALSE; - } - status = apr_socket_listen(server->listen_sock, SOMAXCONN); - if(status != APR_SUCCESS) { - apr_socket_close(server->listen_sock); - server->listen_sock = NULL; - return FALSE; - } - - /* add listening socket to pollset */ - memset(&server->listen_sock_pfd,0,sizeof(apr_pollfd_t)); - server->listen_sock_pfd.desc_type = APR_POLL_SOCKET; - server->listen_sock_pfd.reqevents = APR_POLLIN; - server->listen_sock_pfd.desc.s = server->listen_sock; - server->listen_sock_pfd.client_data = server->listen_sock; - if(apt_poller_task_descriptor_add(server->task, &server->listen_sock_pfd) != TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Add Listening Socket to Pollset"); - apr_socket_close(server->listen_sock); - server->listen_sock = NULL; - return FALSE; - } - - return TRUE; -} - -/** Remove from pollset and destroy listening socket */ -static void rtsp_server_listening_socket_destroy(rtsp_server_t *server) -{ - if(server->listen_sock) { - apt_poller_task_descriptor_remove(server->task,&server->listen_sock_pfd); - apr_socket_close(server->listen_sock); - server->listen_sock = NULL; - } -} - -/* Accept RTSP connection */ -static apt_bool_t rtsp_server_connection_accept(rtsp_server_t *server) -{ - rtsp_server_connection_t *rtsp_connection; - char *local_ip = NULL; - char *remote_ip = NULL; - apr_sockaddr_t *l_sockaddr = NULL; - apr_sockaddr_t *r_sockaddr = NULL; - apr_pool_t *pool = apt_pool_create(); - if(!pool) { - return FALSE; - } - - rtsp_connection = apr_palloc(pool,sizeof(rtsp_server_connection_t)); - rtsp_connection->pool = pool; - rtsp_connection->sock = NULL; - rtsp_connection->client_ip = NULL; - APR_RING_ELEM_INIT(rtsp_connection,link); - - if(apr_socket_accept(&rtsp_connection->sock,server->listen_sock,rtsp_connection->pool) != APR_SUCCESS) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Accept RTSP Connection"); - apr_pool_destroy(pool); - return FALSE; - } - - if(apr_socket_addr_get(&l_sockaddr,APR_LOCAL,rtsp_connection->sock) != APR_SUCCESS || - apr_socket_addr_get(&r_sockaddr,APR_REMOTE,rtsp_connection->sock) != APR_SUCCESS) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get RTSP Socket Address"); - apr_pool_destroy(pool); - return FALSE; - } - - apr_sockaddr_ip_get(&local_ip,l_sockaddr); - apr_sockaddr_ip_get(&remote_ip,r_sockaddr); - rtsp_connection->client_ip = remote_ip; - rtsp_connection->id = apr_psprintf(pool,"%s:%hu <-> %s:%hu", - local_ip,l_sockaddr->port, - remote_ip,r_sockaddr->port); - - memset(&rtsp_connection->sock_pfd,0,sizeof(apr_pollfd_t)); - rtsp_connection->sock_pfd.desc_type = APR_POLL_SOCKET; - rtsp_connection->sock_pfd.reqevents = APR_POLLIN; - rtsp_connection->sock_pfd.desc.s = rtsp_connection->sock; - rtsp_connection->sock_pfd.client_data = rtsp_connection; - if(apt_poller_task_descriptor_add(server->task,&rtsp_connection->sock_pfd) != TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Add to Pollset %s",rtsp_connection->id); - apr_socket_close(rtsp_connection->sock); - apr_pool_destroy(pool); - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Accepted TCP Connection %s",rtsp_connection->id); - rtsp_connection->session_table = apr_hash_make(rtsp_connection->pool); - apt_text_stream_init(&rtsp_connection->rx_stream,rtsp_connection->rx_buffer,sizeof(rtsp_connection->rx_buffer)-1); - apt_text_stream_init(&rtsp_connection->tx_stream,rtsp_connection->tx_buffer,sizeof(rtsp_connection->tx_buffer)-1); - rtsp_connection->parser = rtsp_parser_create(rtsp_connection->pool); - rtsp_connection->generator = rtsp_generator_create(rtsp_connection->pool); - rtsp_connection->server = server; - APR_RING_INSERT_TAIL(&server->connection_list,rtsp_connection,rtsp_server_connection_t,link); - return TRUE; -} - -/** Close connection */ -static apt_bool_t rtsp_server_connection_close(rtsp_server_t *server, rtsp_server_connection_t *rtsp_connection) -{ - apr_size_t remaining_sessions = 0; - if(!rtsp_connection || !rtsp_connection->sock) { - return FALSE; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Close RTSP Connection %s",rtsp_connection->id); - apt_poller_task_descriptor_remove(server->task,&rtsp_connection->sock_pfd); - apr_socket_close(rtsp_connection->sock); - rtsp_connection->sock = NULL; - - APR_RING_REMOVE(rtsp_connection,link); - - remaining_sessions = apr_hash_count(rtsp_connection->session_table); - if(remaining_sessions) { - rtsp_server_session_t *session; - void *val; - apr_hash_index_t *it; - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Terminate Remaining RTSP Sessions [%"APR_SIZE_T_FMT"]", - remaining_sessions); - it = apr_hash_first(rtsp_connection->pool,rtsp_connection->session_table); - for(; it; it = apr_hash_next(it)) { - apr_hash_this(it,NULL,NULL,&val); - session = val; - if(session && session->terminating == FALSE) { - rtsp_server_session_terminate_request(server,session); - } - } - } - else { - rtsp_server_connection_destroy(rtsp_connection); - } - return TRUE; -} - - -/* Receive RTSP message through RTSP connection */ -static apt_bool_t rtsp_server_poller_signal_process(void *obj, const apr_pollfd_t *descriptor) -{ - rtsp_server_t *server = obj; - rtsp_server_connection_t *rtsp_connection = descriptor->client_data; - apr_status_t status; - apr_size_t offset; - apr_size_t length; - apt_text_stream_t *stream; - rtsp_message_t *message; - apt_message_status_e msg_status; - - if(descriptor->desc.s == server->listen_sock) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Accept Connection"); - return rtsp_server_connection_accept(server); - } - - if(!rtsp_connection || !rtsp_connection->sock) { - return FALSE; - } - stream = &rtsp_connection->rx_stream; - - /* calculate offset remaining from the previous receive / if any */ - offset = stream->pos - stream->text.buf; - /* calculate available length */ - length = sizeof(rtsp_connection->rx_buffer) - 1 - offset; - - status = apr_socket_recv(rtsp_connection->sock,stream->pos,&length); - if(status == APR_EOF || length == 0) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"RTSP Peer Disconnected %s",rtsp_connection->id); - return rtsp_server_connection_close(server,rtsp_connection); - } - - /* calculate actual length of the stream */ - stream->text.length = offset + length; - stream->pos[length] = '\0'; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive RTSP Data %s [%"APR_SIZE_T_FMT" bytes]\n%s", - rtsp_connection->id, - length, - stream->pos); - - /* reset pos */ - apt_text_stream_reset(stream); - - do { - msg_status = rtsp_parser_run(rtsp_connection->parser,stream,&message); - rtsp_server_message_handler(rtsp_connection,message,msg_status); - } - while(apt_text_is_eos(stream) == FALSE); - - /* scroll remaining stream */ - apt_text_stream_scroll(stream); - return TRUE; -} - -/* Process task message */ -static apt_bool_t rtsp_server_task_msg_process(apt_task_t *task, apt_task_msg_t *task_msg) -{ - apt_poller_task_t *poller_task = apt_task_object_get(task); - rtsp_server_t *server = apt_poller_task_object_get(poller_task); - - task_msg_data_t *data = (task_msg_data_t*) task_msg->data; - switch(data->type) { - case TASK_MSG_SEND_MESSAGE: - rtsp_server_session_response_process(server,data->session,data->message); - break; - case TASK_MSG_TERMINATE_SESSION: - rtsp_server_session_do_terminate(server,data->session); - break; - } - - return TRUE; -} diff --git a/libs/unimrcp/libs/uni-rtsp/src/rtsp_start_line.c b/libs/unimrcp/libs/uni-rtsp/src/rtsp_start_line.c deleted file mode 100644 index a374675af3..0000000000 --- a/libs/unimrcp/libs/uni-rtsp/src/rtsp_start_line.c +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: rtsp_start_line.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "rtsp_start_line.h" -#include "apt_string_table.h" -#include "apt_log.h" - -/** Protocol name used in version string */ -#define RTSP_NAME "RTSP" -#define RTSP_NAME_LENGTH (sizeof(RTSP_NAME)-1) - -/** Separators used in RTSP version string parse/generate */ -#define RTSP_NAME_VERSION_SEPARATOR '/' -#define RTSP_VERSION_MAJOR_MINOR_SEPARATOR '.' - -/** String table of RTSP methods (rtsp_method_id) */ -static const apt_str_table_item_t rtsp_method_string_table[] = { - {{"SETUP", 5},0}, - {{"ANNOUNCE", 8},0}, - {{"TEARDOWN", 8},0}, - {{"DESCRIBE", 8},0} -}; - -/** String table of RTSP reason phrases (rtsp_reason_phrase_e) */ -static const apt_str_table_item_t rtsp_reason_string_table[] = { - {{"OK", 2},0}, - {{"Created", 7},0}, - {{"Bad Request", 11},0}, - {{"Unauthorized", 12},0}, - {{"Not Found", 9},4}, - {{"Method Not Allowed", 18},0}, - {{"Not Acceptable", 14},4}, - {{"Proxy Auth Required", 19},0}, - {{"Request Timeout", 15},0}, - {{"Session Not Found", 17},0}, - {{"Internal Server Error", 21},0}, - {{"Not Implemented", 15},4} -}; - -/** Parse RTSP URI */ -static apt_bool_t rtsp_resource_uri_parse(const apt_str_t *field, rtsp_request_line_t *request_line, apr_pool_t *pool) -{ - char *str; - apt_str_t *url = &request_line->url; - if(!field->length || !field->buf) { - return FALSE; - } - - apt_string_copy(url,field,pool); - if(url->buf[url->length-1] == '/') { - url->length--; - url->buf[url->length] = '\0'; - } - - str = strrchr(url->buf,'/'); - if(str) { - str++; - } - request_line->resource_name = str; - return TRUE; -} - -/** Parse RTSP version */ -static rtsp_version_e rtsp_version_parse(const apt_str_t *field) -{ - rtsp_version_e version = RTSP_VERSION_UNKNOWN; - const char *pos; - if(field->length <= RTSP_NAME_LENGTH || strncasecmp(field->buf,RTSP_NAME,RTSP_NAME_LENGTH) != 0) { - /* unexpected protocol name */ - return version; - } - - pos = field->buf + RTSP_NAME_LENGTH; - if(*pos == RTSP_NAME_VERSION_SEPARATOR) { - pos++; - switch(*pos) { - case '1': version = RTSP_VERSION_1; break; - default: ; - } - } - return version; -} - -/** Generate RTSP version */ -static apt_bool_t rtsp_version_generate(rtsp_version_e version, apt_text_stream_t *stream) -{ - if(stream->pos + RTSP_NAME_LENGTH + 1 >= stream->end) { - return FALSE; - } - memcpy(stream->pos,RTSP_NAME,RTSP_NAME_LENGTH); - stream->pos += RTSP_NAME_LENGTH; - *stream->pos++ = RTSP_NAME_VERSION_SEPARATOR; - - if(apt_text_size_value_insert(stream,version) == FALSE) { - return FALSE; - } - - if(stream->pos + 2 >= stream->end) { - return FALSE; - } - *stream->pos++ = RTSP_VERSION_MAJOR_MINOR_SEPARATOR; - *stream->pos++ = '0'; - return TRUE; -} - -/** Parse RTSP status-code */ -static APR_INLINE rtsp_status_code_e rtsp_status_code_parse(const apt_str_t *field) -{ - return apt_size_value_parse(field); -} - -/** Generate RTSP status-code */ -static APR_INLINE apt_bool_t rtsp_status_code_generate(rtsp_status_code_e status_code, apt_text_stream_t *stream) -{ - return apt_text_size_value_insert(stream,status_code); -} - -/** Generate RTSP request-line */ -static apt_bool_t rtsp_request_line_generate(rtsp_request_line_t *start_line, apt_text_stream_t *stream) -{ - const apt_str_t *method_name = apt_string_table_str_get(rtsp_method_string_table,RTSP_METHOD_COUNT,start_line->method_id); - if(!method_name) { - return FALSE; - } - start_line->method_name = *method_name; - if(apt_text_string_insert(stream,&start_line->method_name) == FALSE) { - return FALSE; - } - if(apt_text_space_insert(stream) == FALSE) { - return FALSE; - } - - if(apt_text_string_insert(stream,&start_line->url) == FALSE) { - return FALSE; - } - if(apt_text_space_insert(stream) == FALSE) { - return FALSE; - } - - return rtsp_version_generate(start_line->version,stream); -} - -/** Generate RTSP status-line */ -static apt_bool_t rtsp_status_line_generate(rtsp_status_line_t *start_line, apt_text_stream_t *stream) -{ - if(rtsp_version_generate(start_line->version,stream) == FALSE) { - return FALSE; - } - if(apt_text_space_insert(stream) == FALSE) { - return FALSE; - } - - if(rtsp_status_code_generate(start_line->status_code,stream) == FALSE) { - return FALSE; - } - if(apt_text_space_insert(stream) == FALSE) { - return FALSE; - } - - return apt_text_string_insert(stream,&start_line->reason); -} - -/** Parse RTSP start-line */ -RTSP_DECLARE(apt_bool_t) rtsp_start_line_parse(rtsp_start_line_t *start_line, apt_str_t *str, apr_pool_t *pool) -{ - apt_text_stream_t line; - apt_str_t field; - - apt_text_stream_init(&line,str->buf,str->length); - if(apt_text_field_read(&line,APT_TOKEN_SP,TRUE,&field) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot read the first field in start-line"); - return FALSE; - } - - if(field.buf == strstr(field.buf,RTSP_NAME)) { - /* parsing RTSP response */ - rtsp_status_line_t *status_line = &start_line->common.status_line; - start_line->message_type = RTSP_MESSAGE_TYPE_RESPONSE; - rtsp_status_line_init(status_line); - - status_line->version = rtsp_version_parse(&field); - - if(apt_text_field_read(&line,APT_TOKEN_SP,TRUE,&field) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse status-code in status-line"); - return FALSE; - } - status_line->status_code = rtsp_status_code_parse(&field); - - if(apt_text_field_read(&line,APT_TOKEN_SP,TRUE,&field) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse reason phrase in status-line"); - return FALSE; - } - apt_string_copy(&status_line->reason,&field,pool); - } - else { - /* parsing RTSP request */ - rtsp_request_line_t *request_line = &start_line->common.request_line; - start_line->message_type = RTSP_MESSAGE_TYPE_REQUEST; - rtsp_request_line_init(request_line); - - apt_string_copy(&request_line->method_name,&field,pool); - request_line->method_id = apt_string_table_id_find(rtsp_method_string_table,RTSP_METHOD_COUNT,&field); - - if(apt_text_field_read(&line,APT_TOKEN_SP,TRUE,&field) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse URL in request-line"); - return FALSE; - } - rtsp_resource_uri_parse(&field,request_line,pool); - - if(apt_text_field_read(&line,APT_TOKEN_SP,TRUE,&field) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse version in request-line"); - return FALSE; - } - request_line->version = rtsp_version_parse(&field); - } - - return TRUE; -} - -/** Generate RTSP start-line */ -RTSP_DECLARE(apt_bool_t) rtsp_start_line_generate(rtsp_start_line_t *start_line, apt_text_stream_t *stream) -{ - apt_bool_t status = FALSE; - switch(start_line->message_type) { - case RTSP_MESSAGE_TYPE_REQUEST: - status = rtsp_request_line_generate(&start_line->common.request_line,stream); - break; - case RTSP_MESSAGE_TYPE_RESPONSE: - status = rtsp_status_line_generate(&start_line->common.status_line,stream); - break; - default: - break; - } - - if(status == FALSE) { - return FALSE; - } - - return apt_text_eol_insert(stream); -} - -/** Get reason phrase by status code */ -RTSP_DECLARE(const apt_str_t*) rtsp_reason_phrase_get(rtsp_reason_phrase_e reason) -{ - return apt_string_table_str_get(rtsp_reason_string_table,RTSP_REASON_PHRASE_COUNT,reason); -} diff --git a/libs/unimrcp/libs/uni-rtsp/src/rtsp_stream.c b/libs/unimrcp/libs/uni-rtsp/src/rtsp_stream.c deleted file mode 100644 index 945e7a9874..0000000000 --- a/libs/unimrcp/libs/uni-rtsp/src/rtsp_stream.c +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: rtsp_stream.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "rtsp_stream.h" -#include "apt_log.h" - -/** RTSP parser */ -struct rtsp_parser_t { - apt_message_parser_t *base; -}; - -/** RTSP generator */ -struct rtsp_generator_t { - apt_message_generator_t *base; -}; - -/** Create message and read start line */ -static apt_bool_t rtsp_parser_on_start(apt_message_parser_t *parser, apt_message_context_t *context, apt_text_stream_t *stream, apr_pool_t *pool); -/** Header section handler */ -static apt_bool_t rtsp_parser_on_header_complete(apt_message_parser_t *parser, apt_message_context_t *context); - -static const apt_message_parser_vtable_t parser_vtable = { - rtsp_parser_on_start, - rtsp_parser_on_header_complete, - NULL -}; - - -/** Initialize by generating message start line and return header section and body */ -apt_bool_t rtsp_generator_on_start(apt_message_generator_t *generator, apt_message_context_t *context, apt_text_stream_t *stream); - -static const apt_message_generator_vtable_t generator_vtable = { - rtsp_generator_on_start, - NULL, - NULL -}; - - -/** Create RTSP parser */ -RTSP_DECLARE(rtsp_parser_t*) rtsp_parser_create(apr_pool_t *pool) -{ - rtsp_parser_t *parser = apr_palloc(pool,sizeof(rtsp_parser_t)); - parser->base = apt_message_parser_create(parser,&parser_vtable,pool); - return parser; -} - -/** Parse RTSP stream */ -RTSP_DECLARE(apt_message_status_e) rtsp_parser_run(rtsp_parser_t *parser, apt_text_stream_t *stream, rtsp_message_t **message) -{ - return apt_message_parser_run(parser->base,stream,(void**)message); -} - -/** Create message and read start line */ -static apt_bool_t rtsp_parser_on_start(apt_message_parser_t *parser, apt_message_context_t *context, apt_text_stream_t *stream, apr_pool_t *pool) -{ - rtsp_message_t *message; - apt_str_t start_line; - /* read start line */ - if(apt_text_line_read(stream,&start_line) == FALSE) { - return FALSE; - } - - message = rtsp_message_create(RTSP_MESSAGE_TYPE_UNKNOWN,pool); - if(rtsp_start_line_parse(&message->start_line,&start_line,message->pool) == FALSE) { - return FALSE; - } - - context->message = message; - context->header = &message->header.header_section; - context->body = &message->body; - return TRUE; -} - -/** Header section handler */ -static apt_bool_t rtsp_parser_on_header_complete(apt_message_parser_t *parser, apt_message_context_t *context) -{ - rtsp_message_t *rtsp_message = context->message; - rtsp_header_fields_parse(&rtsp_message->header,rtsp_message->pool); - - if(context->body && rtsp_header_property_check(&rtsp_message->header,RTSP_HEADER_FIELD_CONTENT_LENGTH) == TRUE) { - context->body->length = rtsp_message->header.content_length; - } - - return TRUE; -} - -/** Create RTSP stream generator */ -RTSP_DECLARE(rtsp_generator_t*) rtsp_generator_create(apr_pool_t *pool) -{ - rtsp_generator_t *generator = apr_palloc(pool,sizeof(rtsp_generator_t)); - generator->base = apt_message_generator_create(generator,&generator_vtable,pool); - return generator; -} - - -/** Generate RTSP stream */ -RTSP_DECLARE(apt_message_status_e) rtsp_generator_run(rtsp_generator_t *generator, rtsp_message_t *message, apt_text_stream_t *stream) -{ - return apt_message_generator_run(generator->base,message,stream); -} - -/** Initialize by generating message start line and return header section and body */ -apt_bool_t rtsp_generator_on_start(apt_message_generator_t *generator, apt_message_context_t *context, apt_text_stream_t *stream) -{ - rtsp_message_t *rtsp_message = context->message; - context->header = &rtsp_message->header.header_section; - context->body = &rtsp_message->body; - return rtsp_start_line_generate(&rtsp_message->start_line,stream); -} diff --git a/libs/unimrcp/libs/uni-rtsp/unirtsp.2010.vcxproj.filters b/libs/unimrcp/libs/uni-rtsp/unirtsp.2010.vcxproj.filters deleted file mode 100644 index 5a1581a2c3..0000000000 --- a/libs/unimrcp/libs/uni-rtsp/unirtsp.2010.vcxproj.filters +++ /dev/null @@ -1,56 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {fd4564ef-9f34-4f23-992d-37f127e289a2} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - - - src - - - src - - - src - - - src - - - src - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/uni-rtsp/unirtsp.2017.vcxproj b/libs/unimrcp/libs/uni-rtsp/unirtsp.2017.vcxproj deleted file mode 100644 index 1b368a09e6..0000000000 --- a/libs/unimrcp/libs/uni-rtsp/unirtsp.2017.vcxproj +++ /dev/null @@ -1,141 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - unirtsp - {504B3154-7A4F-459D-9877-B951021C3F1F} - unirtsp - Win32Proj - - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(SolutionDir)$(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(SolutionDir)$(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - - - - codecs;%(AdditionalIncludeDirectories) - APT_STATIC_LIB;%(PreprocessorDefinitions) - - - - - X64 - - - codecs;%(AdditionalIncludeDirectories) - APT_STATIC_LIB;%(PreprocessorDefinitions) - ProgramDatabase - - - - - codecs;%(AdditionalIncludeDirectories) - APT_STATIC_LIB;%(PreprocessorDefinitions) - - - - - X64 - - - codecs;%(AdditionalIncludeDirectories) - APT_STATIC_LIB;%(PreprocessorDefinitions) - - - - - - - - - - - - - - - - - - - - - - {f6c55d93-b927-4483-bb69-15aef3dd2dff} - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/uni-rtsp/unirtsp.vcproj b/libs/unimrcp/libs/uni-rtsp/unirtsp.vcproj deleted file mode 100644 index c2e59e70fb..0000000000 --- a/libs/unimrcp/libs/uni-rtsp/unirtsp.vcproj +++ /dev/null @@ -1,304 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/libs/uni-rtsp/unirtsp.vcxproj b/libs/unimrcp/libs/uni-rtsp/unirtsp.vcxproj deleted file mode 100644 index 82cedac8fe..0000000000 --- a/libs/unimrcp/libs/uni-rtsp/unirtsp.vcxproj +++ /dev/null @@ -1,127 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {504B3154-7A4F-459D-9877-B951021C3F1F} - unirtsp - Win32Proj - - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - X64 - - - ProgramDatabase - - - - - X64 - - - - - - - - - - - - - - - - - - - - - - {13deeca0-bdd4-4744-a1a2-8eb0a44df3d2} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/uni-rtsp/unirtsp.vcxproj.filters b/libs/unimrcp/libs/uni-rtsp/unirtsp.vcxproj.filters deleted file mode 100644 index 1a8db5806c..0000000000 --- a/libs/unimrcp/libs/uni-rtsp/unirtsp.vcxproj.filters +++ /dev/null @@ -1,56 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {8ffd50c3-3b28-438d-a305-071644d5f115} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - - - src - - - src - - - src - - - src - - - src - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/modules/Makefile.am b/libs/unimrcp/modules/Makefile.am deleted file mode 100644 index 7c5ba9768e..0000000000 --- a/libs/unimrcp/modules/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -SUBDIRS = mrcp-sofiasip mrcp-unirtsp diff --git a/libs/unimrcp/modules/mrcp-sofiasip/Makefile.am b/libs/unimrcp/modules/mrcp-sofiasip/Makefile.am deleted file mode 100644 index f343037623..0000000000 --- a/libs/unimrcp/modules/mrcp-sofiasip/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -AM_CPPFLAGS = -I$(top_srcdir)/modules/mrcp-sofiasip/include \ - -I$(top_srcdir)/libs/mrcpv2-transport/include \ - -I$(top_srcdir)/libs/mrcp-signaling/include \ - -I$(top_srcdir)/libs/mrcp/include \ - -I$(top_srcdir)/libs/mrcp/message/include \ - -I$(top_srcdir)/libs/mrcp/control/include \ - -I$(top_srcdir)/libs/mrcp/resources/include \ - -I$(top_srcdir)/libs/mpf/include \ - -I$(top_srcdir)/libs/apr-toolkit/include \ - $(UNIMRCP_APR_INCLUDES) $(UNIMRCP_SOFIA_INCLUDES) - -noinst_LTLIBRARIES = libmrcpsofiasip.la - -include_HEADERS = include/mrcp_sdp.h \ - include/mrcp_sofiasip_server_agent.h \ - include/mrcp_sofiasip_client_agent.h -libmrcpsofiasip_la_SOURCES = src/mrcp_sdp.c \ - src/mrcp_sofiasip_server_agent.c \ - src/mrcp_sofiasip_client_agent.c \ - src/mrcp_sofiasip_logger.c diff --git a/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sdp.h b/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sdp.h deleted file mode 100644 index 5c4b5c74ef..0000000000 --- a/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sdp.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_sdp.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_SDP_H -#define MRCP_SDP_H - -/** - * @file mrcp_sdp.h - * @brief MRCP SDP Transformations - */ - -#include "mrcp_sig_types.h" - -APT_BEGIN_EXTERN_C - -/** Generate SDP string by MRCP descriptor */ -MRCP_DECLARE(apr_size_t) sdp_string_generate_by_mrcp_descriptor(char *buffer, apr_size_t size, const mrcp_session_descriptor_t *descriptor, apt_bool_t offer); - -/** Generate MRCP descriptor by SDP session */ -MRCP_DECLARE(apt_bool_t) mrcp_descriptor_generate_by_sdp_session(mrcp_session_descriptor_t* descriptor, const sdp_session_t *sdp, const char *force_destination_ip, apr_pool_t *pool); - -/** Generate SDP resource discovery string */ -MRCP_DECLARE(apr_size_t) sdp_resource_discovery_string_generate(const char *ip, const char *origin, char *buffer, apr_size_t size); - -APT_END_EXTERN_C - -#endif /* MRCP_SDP_H */ diff --git a/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sofiasip_client_agent.h b/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sofiasip_client_agent.h deleted file mode 100644 index 4dd605a8cd..0000000000 --- a/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sofiasip_client_agent.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_sofiasip_client_agent.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_SOFIASIP_CLIENT_AGENT_H -#define MRCP_SOFIASIP_CLIENT_AGENT_H - -/** - * @file mrcp_sofiasip_client_agent.h - * @brief Implementation of MRCP Signaling Interface using Sofia-SIP - */ - -#include -#include "mrcp_sig_agent.h" - -APT_BEGIN_EXTERN_C - -/** Sofia-SIP config declaration */ -typedef struct mrcp_sofia_client_config_t mrcp_sofia_client_config_t; - -/** Sofia-SIP config */ -struct mrcp_sofia_client_config_t { - /** Local IP address */ - char *local_ip; - /** External (NAT) IP address */ - char *ext_ip; - /** Local SIP port */ - apr_port_t local_port; - /** Local SIP user name */ - char *local_user_name; - /** User agent name */ - char *user_agent_name; - /** SDP origin */ - char *origin; - /** SIP transport */ - char *transport; - /** SIP T1 timer */ - apr_size_t sip_t1; - /** SIP T2 timer */ - apr_size_t sip_t2; - /** SIP T4 timer */ - apr_size_t sip_t4; - /** SIP T1x64 timer */ - apr_size_t sip_t1x64; - /** Print out SIP messages to the console */ - apt_bool_t tport_log; - /** Dump SIP messages to the specified file */ - char *tport_dump_file; -}; - -/** - * Create Sofia-SIP signaling agent. - */ -MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_sofiasip_client_agent_create(const char *id, mrcp_sofia_client_config_t *config, apr_pool_t *pool); - -/** - * Allocate Sofia-SIP config. - */ -MRCP_DECLARE(mrcp_sofia_client_config_t*) mrcp_sofiasip_client_config_alloc(apr_pool_t *pool); - -/** - * Initialize Sofia-SIP logger. - */ -MRCP_DECLARE(apt_bool_t) mrcp_sofiasip_client_logger_init(const char *name, const char *level_str, apt_bool_t redirect); - -APT_END_EXTERN_C - -#endif /* MRCP_SOFIASIP_CLIENT_AGENT_H */ diff --git a/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sofiasip_server_agent.h b/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sofiasip_server_agent.h deleted file mode 100644 index 4cc78c6fbf..0000000000 --- a/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sofiasip_server_agent.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_sofiasip_server_agent.h 2252 2014-11-21 02:45:15Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_SOFIASIP_SERVER_AGENT_H -#define MRCP_SOFIASIP_SERVER_AGENT_H - -/** - * @file mrcp_sofiasip_server_agent.h - * @brief Implementation of MRCP Signaling Interface using Sofia-SIP - */ - -#include -#include "mrcp_sig_agent.h" - -APT_BEGIN_EXTERN_C - -/** Sofia-SIP config declaration */ -typedef struct mrcp_sofia_server_config_t mrcp_sofia_server_config_t; - -/** Sofia-SIP config */ -struct mrcp_sofia_server_config_t { - /** Local IP address to bind to */ - char *local_ip; - /** External (NAT) IP address */ - char *ext_ip; - /** Local port to bind to */ - apr_port_t local_port; - /** SIP user name */ - char *user_name; - /** User agent name */ - char *user_agent_name; - /** SDP origin */ - char *origin; - /** SIP transport */ - char *transport; - /** Force destination IP address. Should be used only in case - SDP contains incorrect connection address (local IP address behind NAT) */ - apt_bool_t force_destination; - /** SIP T1 timer */ - apr_size_t sip_t1; - /** SIP T2 timer */ - apr_size_t sip_t2; - /** SIP T4 timer */ - apr_size_t sip_t4; - /** SIP T1x64 timer */ - apr_size_t sip_t1x64; - /** Print out SIP messages to the console */ - apt_bool_t tport_log; - /** Dump SIP messages to the specified file */ - char *tport_dump_file; -}; - -/** - * Create Sofia-SIP signaling agent. - */ -MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_sofiasip_server_agent_create(const char *id, mrcp_sofia_server_config_t *config, apr_pool_t *pool); - -/** - * Allocate Sofia-SIP config. - */ -MRCP_DECLARE(mrcp_sofia_server_config_t*) mrcp_sofiasip_server_config_alloc(apr_pool_t *pool); - -/** - * Initialize Sofia-SIP logger. - */ -MRCP_DECLARE(apt_bool_t) mrcp_sofiasip_server_logger_init(const char *name, const char *level_str, apt_bool_t redirect); - -APT_END_EXTERN_C - -#endif /* MRCP_SOFIASIP_SERVER_AGENT_H */ diff --git a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj.filters b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj.filters deleted file mode 100644 index 33ff479678..0000000000 --- a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj.filters +++ /dev/null @@ -1,38 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {6e92b598-880e-4fe5-88fb-f69df8e06a57} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - include - - - include - - - include - - - - - src - - - src - - - src - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2017.vcxproj b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2017.vcxproj deleted file mode 100644 index c8d8f65306..0000000000 --- a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2017.vcxproj +++ /dev/null @@ -1,143 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - mrcpsofiasip - {746F3632-5BB2-4570-9453-31D6D58A7D8E} - mrcpsofiasip - Win32Proj - - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(SolutionDir)$(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(SolutionDir)$(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - - - - include;%(AdditionalIncludeDirectories) - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) - ProgramDatabase - - - - - include;%(AdditionalIncludeDirectories) - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) - - - - - - - - - - - - - - - - {70a49bc2-7500-41d0-b75d-edcc5be987a0} - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcproj b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcproj deleted file mode 100644 index 20f9ce8e3a..0000000000 --- a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcproj +++ /dev/null @@ -1,288 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcxproj b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcxproj deleted file mode 100644 index cd2e9a2251..0000000000 --- a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcxproj +++ /dev/null @@ -1,147 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {746F3632-5BB2-4570-9453-31D6D58A7D8E} - mrcpsofiasip - Win32Proj - - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - include;%(AdditionalIncludeDirectories) - - - - - include;%(AdditionalIncludeDirectories) - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - ProgramDatabase - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - - - - - - - - - - - - - - - - {12a49562-bab9-43a3-a21d-15b60bbb4c31} - false - - - {a9edac04-6a5f-4ba7-bc0d-cce7b255b6ea} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcxproj.filters b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcxproj.filters deleted file mode 100644 index d0579e36d8..0000000000 --- a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcxproj.filters +++ /dev/null @@ -1,38 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {5256b9c6-18be-48fc-aaa3-8e2c17df7f8d} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - include - - - include - - - include - - - - - src - - - src - - - src - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sdp.c b/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sdp.c deleted file mode 100644 index 16fcfee97d..0000000000 --- a/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sdp.c +++ /dev/null @@ -1,421 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_sdp.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include -#include -#include "mrcp_sdp.h" -#include "mrcp_session_descriptor.h" -#include "mrcp_control_descriptor.h" -#include "mpf_rtp_attribs.h" -#include "mpf_rtp_pt.h" -#include "apt_text_stream.h" -#include "apt_log.h" - -#if _MSC_VER >= 1900 -#pragma warning(disable: 4477) -// 'snprintf' : format string '%d' requires an argument of type 'int', but variadic argument 1 has type 'apr_size_t' 264 -// 'snprintf' : format string '%d' requires an argument of type 'int', but variadic argument 1 has type 'const apr_size_t' 198 -#endif - -static apr_size_t sdp_rtp_media_generate(char *buffer, apr_size_t size, const mrcp_session_descriptor_t *descriptor, const mpf_rtp_media_descriptor_t *audio_descriptor); -static apr_size_t sdp_control_media_generate(char *buffer, apr_size_t size, const mrcp_session_descriptor_t *descriptor, const mrcp_control_descriptor_t *control_media, apt_bool_t offer); - -static apt_bool_t mpf_rtp_media_generate(mpf_rtp_media_descriptor_t *rtp_media, const sdp_media_t *sdp_media, const apt_str_t *ip, apr_pool_t *pool); -static apt_bool_t mrcp_control_media_generate(mrcp_control_descriptor_t *mrcp_media, const sdp_media_t *sdp_media, const apt_str_t *ip, apr_pool_t *pool); - -/** Generate SDP string by MRCP descriptor */ -MRCP_DECLARE(apr_size_t) sdp_string_generate_by_mrcp_descriptor(char *buffer, apr_size_t size, const mrcp_session_descriptor_t *descriptor, apt_bool_t offer) -{ - apr_size_t i; - apr_size_t count; - apr_size_t audio_index = 0; - mpf_rtp_media_descriptor_t *audio_media; - apr_size_t video_index = 0; - mpf_rtp_media_descriptor_t *video_media; - apr_size_t control_index = 0; - mrcp_control_descriptor_t *control_media; - apr_size_t offset = 0; - const char *ip = descriptor->ext_ip.buf ? descriptor->ext_ip.buf : (descriptor->ip.buf ? descriptor->ip.buf : "0.0.0.0"); - buffer[0] = '\0'; - offset += snprintf(buffer+offset,size-offset, - "v=0\r\n" - "o=%s 0 0 IN IP4 %s\r\n" - "s=-\r\n" - "c=IN IP4 %s\r\n" - "t=0 0\r\n", - descriptor->origin.buf ? descriptor->origin.buf : "-", - ip, - ip); - count = mrcp_session_media_count_get(descriptor); - for(i=0; iid == i) { - /* generate audio media */ - audio_index++; - offset += sdp_rtp_media_generate(buffer+offset,size-offset,descriptor,audio_media); - continue; - } - video_media = mrcp_session_video_media_get(descriptor,video_index); - if(video_media && video_media->id == i) { - /* generate video media */ - video_index++; - offset += sdp_rtp_media_generate(buffer+offset,size-offset,descriptor,video_media); - continue; - } - control_media = mrcp_session_control_media_get(descriptor,control_index); - if(control_media && control_media->id == i) { - /** generate mrcp control media */ - control_index++; - offset += sdp_control_media_generate(buffer+offset,size-offset,descriptor,control_media,offer); - continue; - } - } - return offset; -} - -/** Generate MRCP descriptor by SDP session */ -MRCP_DECLARE(apt_bool_t) mrcp_descriptor_generate_by_sdp_session(mrcp_session_descriptor_t* descriptor, const sdp_session_t *sdp, const char *force_destination_ip, apr_pool_t *pool) -{ - sdp_media_t *sdp_media; - - if(!sdp) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid SDP Message"); - return FALSE; - } - - if(force_destination_ip) { - apt_string_assign(&descriptor->ip,force_destination_ip,pool); - } - else if(sdp->sdp_connection) { - apt_string_assign(&descriptor->ip,sdp->sdp_connection->c_address,pool); - } - - for(sdp_media=sdp->sdp_media; sdp_media; sdp_media=sdp_media->m_next) { - switch(sdp_media->m_type) { - case sdp_media_audio: - { - mpf_rtp_media_descriptor_t *media = apr_palloc(pool,sizeof(mpf_rtp_media_descriptor_t)); - mpf_rtp_media_descriptor_init(media); - media->id = mrcp_session_audio_media_add(descriptor,media); - mpf_rtp_media_generate(media,sdp_media,&descriptor->ip,pool); - break; - } - case sdp_media_video: - { - mpf_rtp_media_descriptor_t *media = apr_palloc(pool,sizeof(mpf_rtp_media_descriptor_t)); - mpf_rtp_media_descriptor_init(media); - media->id = mrcp_session_video_media_add(descriptor,media); - mpf_rtp_media_generate(media,sdp_media,&descriptor->ip,pool); - break; - } - case sdp_media_application: - { - mrcp_control_descriptor_t *control_media = mrcp_control_descriptor_create(pool); - control_media->id = mrcp_session_control_media_add(descriptor,control_media); - mrcp_control_media_generate(control_media,sdp_media,&descriptor->ip,pool); - break; - } - default: - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Not Supported SDP Media [%s]", sdp_media->m_type_name); - break; - } - } - return TRUE; -} - -/** Generate SDP media by RTP media descriptor */ -static apr_size_t sdp_rtp_media_generate(char *buffer, apr_size_t size, const mrcp_session_descriptor_t *descriptor, const mpf_rtp_media_descriptor_t *audio_media) -{ - apr_size_t offset = 0; - if(audio_media->state == MPF_MEDIA_ENABLED) { - int codec_count = 0; - int i; - mpf_codec_descriptor_t *codec_descriptor; - apr_array_header_t *descriptor_arr = audio_media->codec_list.descriptor_arr; - const apt_str_t *direction_str; - if(!descriptor_arr) { - return 0; - } - - offset += snprintf(buffer+offset,size-offset,"m=audio %d RTP/AVP",audio_media->port); - for(i=0; inelts; i++) { - codec_descriptor = &APR_ARRAY_IDX(descriptor_arr,i,mpf_codec_descriptor_t); - if(codec_descriptor->enabled == TRUE) { - offset += snprintf(buffer+offset,size-offset," %d",codec_descriptor->payload_type); - codec_count++; - } - } - if(!codec_count){ - /* SDP m line should have at least one media format listed; use a reserved RTP payload type */ - offset += snprintf(buffer+offset,size-offset," %d",RTP_PT_RESERVED); - } - offset += snprintf(buffer+offset,size-offset,"\r\n"); - - if(descriptor->ip.length && audio_media->ip.length && - apt_string_compare(&descriptor->ip,&audio_media->ip) != TRUE) { - const char *media_ip = audio_media->ext_ip.buf ? audio_media->ext_ip.buf : audio_media->ip.buf; - offset += snprintf(buffer+offset,size-offset,"c=IN IP4 %s\r\n",media_ip); - } - - for(i=0; inelts; i++) { - codec_descriptor = &APR_ARRAY_IDX(descriptor_arr,i,mpf_codec_descriptor_t); - if(codec_descriptor->enabled == TRUE && codec_descriptor->name.buf) { - offset += snprintf(buffer+offset,size-offset,"a=rtpmap:%d %s/%d\r\n", - codec_descriptor->payload_type, - codec_descriptor->name.buf, - codec_descriptor->sampling_rate); - if(codec_descriptor->format.buf) { - offset += snprintf(buffer+offset,size-offset,"a=fmtp:%d %s\r\n", - codec_descriptor->payload_type, - codec_descriptor->format.buf); - } - } - } - - direction_str = mpf_rtp_direction_str_get(audio_media->direction); - if(direction_str) { - offset += snprintf(buffer+offset,size-offset,"a=%s\r\n",direction_str->buf); - } - - if(audio_media->ptime) { - offset += snprintf(buffer+offset,size-offset,"a=ptime:%hu\r\n",audio_media->ptime); - } - } - else { - offset += snprintf(buffer+offset,size-offset,"m=audio 0 RTP/AVP %d\r\n",RTP_PT_RESERVED); - } - - offset += snprintf(buffer+offset,size-offset,"a=mid:%"APR_SIZE_T_FMT"\r\n",audio_media->mid); - return offset; -} - -/** Generate SDP media by MRCP control media descriptor */ -static apr_size_t sdp_control_media_generate(char *buffer, apr_size_t size, const mrcp_session_descriptor_t *descriptor, const mrcp_control_descriptor_t *control_media, apt_bool_t offer) -{ - int i; - apr_size_t offset = 0; - const apt_str_t *proto; - const apt_str_t *setup_type; - const apt_str_t *connection_type; - proto = mrcp_proto_get(control_media->proto); - setup_type = mrcp_setup_type_get(control_media->setup_type); - connection_type = mrcp_connection_type_get(control_media->connection_type); - if(offer == TRUE) { /* offer */ - if(control_media->port) { - offset += snprintf(buffer+offset,size-offset, - "m=application %d %s 1\r\n" - "a=setup:%s\r\n" - "a=connection:%s\r\n" - "a=resource:%s\r\n", - control_media->port, - proto ? proto->buf : "", - setup_type ? setup_type->buf : "", - connection_type ? connection_type->buf : "", - control_media->resource_name.buf); - - } - else { - offset += snprintf(buffer+offset,size-offset, - "m=application %d %s 1\r\n" - "a=resource:%s\r\n", - control_media->port, - proto ? proto->buf : "", - control_media->resource_name.buf); - } - } - else { /* answer */ - if(control_media->port) { - offset += snprintf(buffer+offset,size-offset, - "m=application %d %s 1\r\n" - "a=setup:%s\r\n" - "a=connection:%s\r\n" - "a=channel:%s@%s\r\n", - control_media->port, - proto ? proto->buf : "", - setup_type ? setup_type->buf : "", - connection_type ? connection_type->buf : "", - control_media->session_id.buf, - control_media->resource_name.buf); - } - else { - offset += snprintf(buffer+offset,size-offset, - "m=application %d %s 1\r\n" - "a=channel:%s@%s\r\n", - control_media->port, - proto ? proto->buf : "", - control_media->session_id.buf, - control_media->resource_name.buf); - } - } - - for(i=0; icmid_arr->nelts; i++) { - offset += snprintf(buffer+offset,size-offset, - "a=cmid:%"APR_SIZE_T_FMT"\r\n", - APR_ARRAY_IDX(control_media->cmid_arr,i,apr_size_t)); - } - - return offset; -} - -/** Generate RTP media descriptor by SDP media */ -static apt_bool_t mpf_rtp_media_generate(mpf_rtp_media_descriptor_t *rtp_media, const sdp_media_t *sdp_media, const apt_str_t *ip, apr_pool_t *pool) -{ - mpf_rtp_attrib_e id; - apt_str_t name; - sdp_attribute_t *attrib = NULL; - sdp_rtpmap_t *map; - mpf_codec_descriptor_t *codec; - for(attrib = sdp_media->m_attributes; attrib; attrib=attrib->a_next) { - apt_string_set(&name,attrib->a_name); - id = mpf_rtp_attrib_id_find(&name); - switch(id) { - case RTP_ATTRIB_MID: - rtp_media->mid = atoi(attrib->a_value); - break; - case RTP_ATTRIB_PTIME: - rtp_media->ptime = (apr_uint16_t)atoi(attrib->a_value); - break; - default: - break; - } - } - - mpf_codec_list_init(&rtp_media->codec_list,5,pool); - for(map = sdp_media->m_rtpmaps; map; map = map->rm_next) { - codec = mpf_codec_list_add(&rtp_media->codec_list); - if(codec) { - codec->payload_type = (apr_byte_t)map->rm_pt; - apt_string_assign(&codec->name,map->rm_encoding,pool); - codec->sampling_rate = (apr_uint16_t)map->rm_rate; - codec->channel_count = 1; - } - } - - switch(sdp_media->m_mode) { - case sdp_inactive: - rtp_media->direction = STREAM_DIRECTION_NONE; - break; - case sdp_sendonly: - rtp_media->direction = STREAM_DIRECTION_SEND; - break; - case sdp_recvonly: - rtp_media->direction = STREAM_DIRECTION_RECEIVE; - break; - case sdp_sendrecv: - rtp_media->direction = STREAM_DIRECTION_DUPLEX; - break; - } - - if(sdp_media->m_connections) { - apt_string_assign(&rtp_media->ip,sdp_media->m_connections->c_address,pool); - } - else { - rtp_media->ip = *ip; - } - if(sdp_media->m_port) { - rtp_media->port = (apr_port_t)sdp_media->m_port; - rtp_media->state = MPF_MEDIA_ENABLED; - } - else { - rtp_media->state = MPF_MEDIA_DISABLED; - } - return TRUE; -} - -/** Generate MRCP control media by SDP media */ -static apt_bool_t mrcp_control_media_generate(mrcp_control_descriptor_t *control_media, const sdp_media_t *sdp_media, const apt_str_t *ip, apr_pool_t *pool) -{ - mrcp_attrib_e id; - apt_str_t name; - apt_str_t value; - sdp_attribute_t *attrib = NULL; - apt_string_set(&name,sdp_media->m_proto_name); - control_media->proto = mrcp_proto_find(&name); - if(control_media->proto != MRCP_PROTO_TCP) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Not supported SDP Proto [%s], expected [%s]",sdp_media->m_proto_name,mrcp_proto_get(MRCP_PROTO_TCP)->buf); - return FALSE; - } - - for(attrib = sdp_media->m_attributes; attrib; attrib=attrib->a_next) { - apt_string_set(&name,attrib->a_name); - id = mrcp_attrib_id_find(&name); - switch(id) { - case MRCP_ATTRIB_SETUP: - apt_string_set(&value,attrib->a_value); - control_media->setup_type = mrcp_setup_type_find(&value); - break; - case MRCP_ATTRIB_CONNECTION: - apt_string_set(&value,attrib->a_value); - control_media->connection_type = mrcp_connection_type_find(&value); - break; - case MRCP_ATTRIB_RESOURCE: - apt_string_assign(&control_media->resource_name,attrib->a_value,pool); - break; - case MRCP_ATTRIB_CHANNEL: - apt_string_set(&value,attrib->a_value); - apt_id_resource_parse(&value,'@',&control_media->session_id,&control_media->resource_name,pool); - break; - case MRCP_ATTRIB_CMID: - mrcp_cmid_add(control_media->cmid_arr,atoi(attrib->a_value)); - break; - default: - break; - } - } - - if(sdp_media->m_connections) { - apt_string_assign(&control_media->ip,sdp_media->m_connections->c_address,pool); - } - else { - control_media->ip = *ip; - } - control_media->port = (apr_port_t)sdp_media->m_port; - return TRUE; -} - -/** Generate SDP resource discovery string */ -MRCP_DECLARE(apr_size_t) sdp_resource_discovery_string_generate(const char *ip, const char *origin, char *buffer, apr_size_t size) -{ - apr_size_t offset = 0; - if(!ip) { - ip = "0.0.0.0"; - } - if(!origin) { - origin = "-"; - } - buffer[0] = '\0'; - offset += snprintf(buffer+offset,size-offset, - "v=0\r\n" - "o=%s 0 0 IN IP4 %s\r\n" - "s=-\r\n" - "c=IN IP4 %s\r\n" - "t=0 0\r\n" - "m=application 0 TCP/MRCPv2 1\r\n" - "a=resource:speechsynth\r\n" - "a=resource:speechrecog\r\n" - "m=audio 0 RTP/AVP 0 8 96 101\r\n" - "a=rtpmap:0 PCMU/8000\r\n" - "a=rtpmap:8 PCMA/8000\r\n" - "a=rtpmap:96 L16/8000\r\n" - "a=rtpmap:101 telephone-event/8000\r\n", - origin, - ip, - ip); - return offset; -} diff --git a/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_client_agent.c b/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_client_agent.c deleted file mode 100644 index fded058da1..0000000000 --- a/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_client_agent.c +++ /dev/null @@ -1,637 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_sofiasip_client_agent.c 2253 2014-11-21 02:57:19Z achaloyan@gmail.com $ - */ - -typedef struct mrcp_sofia_agent_t mrcp_sofia_agent_t; -#define NUA_MAGIC_T mrcp_sofia_agent_t - -typedef struct mrcp_sofia_session_t mrcp_sofia_session_t; -#define NUA_HMAGIC_T mrcp_sofia_session_t - -#include -#include -#include -#include -#include -#include -#include -#undef strcasecmp -#undef strncasecmp -#include - -#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; - } -} diff --git a/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_logger.c b/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_logger.c deleted file mode 100644 index 49590e2fa8..0000000000 --- a/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_logger.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_sofiasip_logger.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include -#include -#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; -} diff --git a/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_server_agent.c b/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_server_agent.c deleted file mode 100644 index 26871190cd..0000000000 --- a/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_server_agent.c +++ /dev/null @@ -1,477 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_sofiasip_server_agent.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 -#include -#include -#include -#include -#include -#undef strcasecmp -#undef strncasecmp -#include - -#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; - } -} diff --git a/libs/unimrcp/modules/mrcp-unirtsp/Makefile.am b/libs/unimrcp/modules/mrcp-unirtsp/Makefile.am deleted file mode 100644 index 479d631da3..0000000000 --- a/libs/unimrcp/modules/mrcp-unirtsp/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -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 diff --git a/libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_client_agent.h b/libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_client_agent.h deleted file mode 100644 index bfc1a3f04e..0000000000 --- a/libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_client_agent.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_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 -#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 */ diff --git a/libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_sdp.h b/libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_sdp.h deleted file mode 100644 index 556b4b46d7..0000000000 --- a/libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_sdp.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_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 */ diff --git a/libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_server_agent.h b/libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_server_agent.h deleted file mode 100644 index c326bb650d..0000000000 --- a/libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_server_agent.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_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 -#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 */ diff --git a/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2010.vcxproj.filters b/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2010.vcxproj.filters deleted file mode 100644 index a990550f29..0000000000 --- a/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2010.vcxproj.filters +++ /dev/null @@ -1,35 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {f87f8ada-12d1-412b-bd14-7e62df3f92a0} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - include - - - include - - - include - - - - - src - - - src - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2017.vcxproj b/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2017.vcxproj deleted file mode 100644 index cfd215e0a9..0000000000 --- a/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2017.vcxproj +++ /dev/null @@ -1,146 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - mrcpunirtsp - {DEB01ACB-D65F-4A62-AED9-58C1054499E9} - mrcpunirtsp - Win32Proj - - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(SolutionDir)$(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(SolutionDir)$(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - - - - include;%(AdditionalIncludeDirectories) - APT_STATIC_LIB;RTSP_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) - 4456;4100;%(DisableSpecificWarnings) - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - APT_STATIC_LIB;RTSP_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) - ProgramDatabase - 4456;4100;%(DisableSpecificWarnings) - - - - - include;%(AdditionalIncludeDirectories) - APT_STATIC_LIB;RTSP_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) - 4456;4100;%(DisableSpecificWarnings) - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - APT_STATIC_LIB;RTSP_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) - 4456;4100;%(DisableSpecificWarnings) - - - - - - - - - - - - - - - {70a49bc2-7500-41d0-b75d-edcc5be987a0} - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.vcproj b/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.vcproj deleted file mode 100644 index 37855a6356..0000000000 --- a/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.vcproj +++ /dev/null @@ -1,280 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.vcxproj b/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.vcxproj deleted file mode 100644 index 200d68b92b..0000000000 --- a/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.vcxproj +++ /dev/null @@ -1,146 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {DEB01ACB-D65F-4A62-AED9-58C1054499E9} - mrcpunirtsp - Win32Proj - - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - include;%(AdditionalIncludeDirectories) - - - - - include;%(AdditionalIncludeDirectories) - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - ProgramDatabase - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - - - - - - - - - - - - - - - {12a49562-bab9-43a3-a21d-15b60bbb4c31} - false - - - {504b3154-7a4f-459d-9877-b951021c3f1f} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.vcxproj.filters b/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.vcxproj.filters deleted file mode 100644 index 3aff69f385..0000000000 --- a/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.vcxproj.filters +++ /dev/null @@ -1,35 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {1ae8fa5f-5d29-4bd7-a332-b2e917a801ca} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - include - - - include - - - include - - - - - src - - - src - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_client_agent.c b/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_client_agent.c deleted file mode 100644 index 760a10c069..0000000000 --- a/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_client_agent.c +++ /dev/null @@ -1,437 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_unirtsp_client_agent.c 2253 2014-11-21 02:57:19Z achaloyan@gmail.com $ - */ - -#include -#include - -#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; -} diff --git a/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_sdp.c b/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_sdp.c deleted file mode 100644 index fa546179b3..0000000000 --- a/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_sdp.c +++ /dev/null @@ -1,598 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_unirtsp_sdp.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include -#include -#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; inelts; i++) { - codec_descriptor = &APR_ARRAY_IDX(descriptor_arr,i,mpf_codec_descriptor_t); - if(codec_descriptor->enabled == TRUE) { - offset += snprintf(buffer+offset,size-offset," %d",codec_descriptor->payload_type); - codec_count++; - } - } - if(!codec_count){ - /* SDP m line should have at least one media format listed; use a reserved RTP payload type */ - offset += snprintf(buffer+offset,size-offset," %d",RTP_PT_RESERVED); - } - offset += snprintf(buffer+offset,size-offset,"\r\n"); - - for(i=0; inelts; i++) { - codec_descriptor = &APR_ARRAY_IDX(descriptor_arr,i,mpf_codec_descriptor_t); - if(codec_descriptor->enabled == TRUE && codec_descriptor->name.buf) { - offset += snprintf(buffer+offset,size-offset,"a=rtpmap:%d %s/%d\r\n", - codec_descriptor->payload_type, - codec_descriptor->name.buf, - codec_descriptor->sampling_rate); - if(codec_descriptor->format.buf) { - offset += snprintf(buffer+offset,size-offset,"a=fmtp:%d %s\r\n", - codec_descriptor->payload_type, - codec_descriptor->format.buf); - } - } - } - - direction_str = mpf_rtp_direction_str_get(audio_media->direction); - if(direction_str) { - offset += snprintf(buffer+offset,size-offset,"a=%s\r\n",direction_str->buf); - } - - if(audio_media->ptime) { - offset += snprintf(buffer+offset,size-offset,"a=ptime:%hu\r\n",audio_media->ptime); - } - } - else { - offset += snprintf(buffer+offset,size-offset,"m=audio 0 RTP/AVP %d\r\n",RTP_PT_RESERVED); - } - - 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; iid == 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; iid == 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; inelts; 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; -} diff --git a/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_server_agent.c b/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_server_agent.c deleted file mode 100644 index a05614763f..0000000000 --- a/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_server_agent.c +++ /dev/null @@ -1,381 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_unirtsp_server_agent.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include - -#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; -} diff --git a/libs/unimrcp/packages/inno-setup/setup-sdk-win32.txt b/libs/unimrcp/packages/inno-setup/setup-sdk-win32.txt deleted file mode 100644 index c9599058f9..0000000000 --- a/libs/unimrcp/packages/inno-setup/setup-sdk-win32.txt +++ /dev/null @@ -1,3 +0,0 @@ -#include "setup.txt" -#define release_dir "Release" -OutputBaseFilename=unimrcp-sdk-{#= uni_version} diff --git a/libs/unimrcp/packages/inno-setup/setup-sdk-x64.txt b/libs/unimrcp/packages/inno-setup/setup-sdk-x64.txt deleted file mode 100644 index 0e5a2fe939..0000000000 --- a/libs/unimrcp/packages/inno-setup/setup-sdk-x64.txt +++ /dev/null @@ -1,4 +0,0 @@ -#include "setup.txt" -#define release_dir "x64\Release" -OutputBaseFilename=unimrcp-x64-sdk-{#= uni_version} -ArchitecturesInstallIn64BitMode=x64 diff --git a/libs/unimrcp/packages/inno-setup/setup-win32.txt b/libs/unimrcp/packages/inno-setup/setup-win32.txt deleted file mode 100644 index dab742af23..0000000000 --- a/libs/unimrcp/packages/inno-setup/setup-win32.txt +++ /dev/null @@ -1,3 +0,0 @@ -#include "setup.txt" -#define uni_outdir "..\..\Release" -OutputBaseFilename=unimrcp-{#= uni_version} diff --git a/libs/unimrcp/packages/inno-setup/setup-x64.txt b/libs/unimrcp/packages/inno-setup/setup-x64.txt deleted file mode 100644 index 74324882bc..0000000000 --- a/libs/unimrcp/packages/inno-setup/setup-x64.txt +++ /dev/null @@ -1,5 +0,0 @@ -#include "setup.txt" -#define uni_outdir "..\..\x64\Release" -OutputBaseFilename=unimrcp-x64-{#= uni_version} -ArchitecturesInstallIn64BitMode=x64 -ArchitecturesAllowed=x64 diff --git a/libs/unimrcp/packages/inno-setup/setup.txt b/libs/unimrcp/packages/inno-setup/setup.txt deleted file mode 100644 index 4091232256..0000000000 --- a/libs/unimrcp/packages/inno-setup/setup.txt +++ /dev/null @@ -1,14 +0,0 @@ -#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 diff --git a/libs/unimrcp/packages/inno-setup/unimrcp-sdk.iss b/libs/unimrcp/packages/inno-setup/unimrcp-sdk.iss deleted file mode 100644 index 8fb56cea1b..0000000000 --- a/libs/unimrcp/packages/inno-setup/unimrcp-sdk.iss +++ /dev/null @@ -1,56 +0,0 @@ -[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; diff --git a/libs/unimrcp/packages/inno-setup/unimrcp.iss b/libs/unimrcp/packages/inno-setup/unimrcp.iss deleted file mode 100644 index b4e9852a45..0000000000 --- a/libs/unimrcp/packages/inno-setup/unimrcp.iss +++ /dev/null @@ -1,91 +0,0 @@ -[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; diff --git a/libs/unimrcp/platforms/Makefile.am b/libs/unimrcp/platforms/Makefile.am deleted file mode 100644 index 13fc51f34e..0000000000 --- a/libs/unimrcp/platforms/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -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 diff --git a/libs/unimrcp/platforms/asr-client/Makefile.am b/libs/unimrcp/platforms/asr-client/Makefile.am deleted file mode 100644 index 62371acd75..0000000000 --- a/libs/unimrcp/platforms/asr-client/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ -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 diff --git a/libs/unimrcp/platforms/asr-client/asrclient.vcproj b/libs/unimrcp/platforms/asr-client/asrclient.vcproj deleted file mode 100644 index de7caff797..0000000000 --- a/libs/unimrcp/platforms/asr-client/asrclient.vcproj +++ /dev/null @@ -1,298 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/platforms/asr-client/asrclient.vcxproj b/libs/unimrcp/platforms/asr-client/asrclient.vcxproj deleted file mode 100644 index af032d1dca..0000000000 --- a/libs/unimrcp/platforms/asr-client/asrclient.vcxproj +++ /dev/null @@ -1,136 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {6B83AC6D-01CE-4E1C-81CE-02AD8116C684} - asrclient - - - - Application - - - Application - - - Application - - - Application - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - include;..\libasr-client\include;%(AdditionalIncludeDirectories) - MultiThreadedDebugDLL - - - libasrclient.lib;libapr-1.lib;%(AdditionalDependencies) - - - - - include;..\libasr-client\include;%(AdditionalIncludeDirectories) - - - libasrclient.lib;libapr-1.lib;%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - X64 - - - include;..\libasr-client\include;%(AdditionalIncludeDirectories) - MultiThreadedDebugDLL - ProgramDatabase - - - libasrclient.lib;libapr-1.lib;%(AdditionalDependencies) - - - - - X64 - - - include;..\libasr-client\include;%(AdditionalIncludeDirectories) - - - libasrclient.lib;libapr-1.lib;%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - - - - {272fafa8-2b2f-4716-b95f-3b37cf2e0cb3} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/platforms/asr-client/asrclient.vcxproj.filters b/libs/unimrcp/platforms/asr-client/asrclient.vcxproj.filters deleted file mode 100644 index 3efc5f63ae..0000000000 --- a/libs/unimrcp/platforms/asr-client/asrclient.vcxproj.filters +++ /dev/null @@ -1,18 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/platforms/asr-client/src/main.c b/libs/unimrcp/platforms/asr-client/src/main.c deleted file mode 100644 index 10f97cd065..0000000000 --- a/libs/unimrcp/platforms/asr-client/src/main.c +++ /dev/null @@ -1,300 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: main.c 2213 2014-11-06 03:02:45Z achaloyan@gmail.com $ - */ - -#include -#include -#include -#include -#include -#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; -} diff --git a/libs/unimrcp/platforms/libasr-client/Makefile.am b/libs/unimrcp/platforms/libasr-client/Makefile.am deleted file mode 100644 index 68ecd07b6a..0000000000 --- a/libs/unimrcp/platforms/libasr-client/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -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 diff --git a/libs/unimrcp/platforms/libasr-client/include/asr_engine.h b/libs/unimrcp/platforms/libasr-client/include/asr_engine.h deleted file mode 100644 index fbb2261eab..0000000000 --- a/libs/unimrcp/platforms/libasr-client/include/asr_engine.h +++ /dev/null @@ -1,133 +0,0 @@ -/* - * 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 */ diff --git a/libs/unimrcp/platforms/libasr-client/libasrclient.vcproj b/libs/unimrcp/platforms/libasr-client/libasrclient.vcproj deleted file mode 100644 index e48c41e261..0000000000 --- a/libs/unimrcp/platforms/libasr-client/libasrclient.vcproj +++ /dev/null @@ -1,308 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/platforms/libasr-client/libasrclient.vcxproj b/libs/unimrcp/platforms/libasr-client/libasrclient.vcxproj deleted file mode 100644 index 744bf1cf6e..0000000000 --- a/libs/unimrcp/platforms/libasr-client/libasrclient.vcxproj +++ /dev/null @@ -1,148 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3} - libasrclient - Win32Proj - - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - include;%(AdditionalIncludeDirectories) - ASR_CLIENT_LIB_EXPORT;%(PreprocessorDefinitions) - - - $(UniMRCPClientLibs);%(AdditionalDependencies) - true - - - - - include;%(AdditionalIncludeDirectories) - ASR_CLIENT_LIB_EXPORT;%(PreprocessorDefinitions) - - - $(UniMRCPClientLibs);%(AdditionalDependencies) - true - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - ASR_CLIENT_LIB_EXPORT;%(PreprocessorDefinitions) - ProgramDatabase - - - $(UniMRCPClientLibs);%(AdditionalDependencies) - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - ASR_CLIENT_LIB_EXPORT;%(PreprocessorDefinitions) - - - $(UniMRCPClientLibs);%(AdditionalDependencies) - - - - - - - - - - - {ee157390-1e85-416c-946e-620e32c9ad33} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/platforms/libasr-client/libasrclient.vcxproj.filters b/libs/unimrcp/platforms/libasr-client/libasrclient.vcxproj.filters deleted file mode 100644 index 3bdaf623d4..0000000000 --- a/libs/unimrcp/platforms/libasr-client/libasrclient.vcxproj.filters +++ /dev/null @@ -1,23 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {21e6c16e-f977-468a-9576-0c5981eb7da5} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - include - - - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/platforms/libasr-client/src/asr_engine.c b/libs/unimrcp/platforms/libasr-client/src/asr_engine.c deleted file mode 100644 index 1473a89604..0000000000 --- a/libs/unimrcp/platforms/libasr-client/src/asr_engine.c +++ /dev/null @@ -1,752 +0,0 @@ -/* - * 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 - -/* APR includes */ -#include -#include - -/* 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 -/* 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); -} diff --git a/libs/unimrcp/platforms/libunimrcp-client/Makefile.am b/libs/unimrcp/platforms/libunimrcp-client/Makefile.am deleted file mode 100644 index 28bc44aac3..0000000000 --- a/libs/unimrcp/platforms/libunimrcp-client/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -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 diff --git a/libs/unimrcp/platforms/libunimrcp-client/include/unimrcp_client.h b/libs/unimrcp/platforms/libunimrcp-client/include/unimrcp_client.h deleted file mode 100644 index b1536f4c0c..0000000000 --- a/libs/unimrcp/platforms/libunimrcp-client/include/unimrcp_client.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: unimrcp_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 */ diff --git a/libs/unimrcp/platforms/libunimrcp-client/libunimrcpclient.vcproj b/libs/unimrcp/platforms/libunimrcp-client/libunimrcpclient.vcproj deleted file mode 100644 index 170941bc41..0000000000 --- a/libs/unimrcp/platforms/libunimrcp-client/libunimrcpclient.vcproj +++ /dev/null @@ -1,272 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/platforms/libunimrcp-client/libunimrcpclient.vcxproj b/libs/unimrcp/platforms/libunimrcp-client/libunimrcpclient.vcxproj deleted file mode 100644 index eba5aa5662..0000000000 --- a/libs/unimrcp/platforms/libunimrcp-client/libunimrcpclient.vcxproj +++ /dev/null @@ -1,140 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {EE157390-1E85-416C-946E-620E32C9AD33} - libunimrcpclient - Win32Proj - - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - $(ProjectRootDir)modules\mrcp-sofiasip\include;$(ProjectRootDir)modules\mrcp-unirtsp\include;%(AdditionalIncludeDirectories) - - - - - $(ProjectRootDir)modules\mrcp-sofiasip\include;$(ProjectRootDir)modules\mrcp-unirtsp\include;%(AdditionalIncludeDirectories) - - - - - X64 - - - $(ProjectRootDir)modules\mrcp-sofiasip\include;$(ProjectRootDir)modules\mrcp-unirtsp\include;%(AdditionalIncludeDirectories) - ProgramDatabase - - - - - X64 - - - $(ProjectRootDir)modules\mrcp-sofiasip\include;$(ProjectRootDir)modules\mrcp-unirtsp\include;%(AdditionalIncludeDirectories) - - - - - - - - - - - - - {72782932-37cc-46ae-8c7f-9a7b1a6ee108} - false - - - {746f3632-5bb2-4570-9453-31d6d58a7d8e} - false - - - {deb01acb-d65f-4a62-aed9-58c1054499e9} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/platforms/libunimrcp-client/libunimrcpclient.vcxproj.filters b/libs/unimrcp/platforms/libunimrcp-client/libunimrcpclient.vcxproj.filters deleted file mode 100644 index a2d863b27f..0000000000 --- a/libs/unimrcp/platforms/libunimrcp-client/libunimrcpclient.vcxproj.filters +++ /dev/null @@ -1,29 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {15d2ec58-ba87-4dd8-9f7a-434f9e186e4e} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - include - - - include - - - include - - - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/platforms/libunimrcp-client/src/unimrcp_client.c b/libs/unimrcp/platforms/libunimrcp-client/src/unimrcp_client.c deleted file mode 100644 index 65cb74221a..0000000000 --- a/libs/unimrcp/platforms/libunimrcp-client/src/unimrcp_client.c +++ /dev/null @@ -1,1416 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: unimrcp_client.c 2252 2014-11-21 02:45:15Z achaloyan@gmail.com $ - */ - -#include -#include -#include -#include -#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 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 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); -} diff --git a/libs/unimrcp/platforms/libunimrcp-server/Makefile.am b/libs/unimrcp/platforms/libunimrcp-server/Makefile.am deleted file mode 100644 index 1226d61813..0000000000 --- a/libs/unimrcp/platforms/libunimrcp-server/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -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 diff --git a/libs/unimrcp/platforms/libunimrcp-server/include/unimrcp_server.h b/libs/unimrcp/platforms/libunimrcp-server/include/unimrcp_server.h deleted file mode 100644 index aaf81d387e..0000000000 --- a/libs/unimrcp/platforms/libunimrcp-server/include/unimrcp_server.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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 */ diff --git a/libs/unimrcp/platforms/libunimrcp-server/libunimrcpserver.vcproj b/libs/unimrcp/platforms/libunimrcp-server/libunimrcpserver.vcproj deleted file mode 100644 index 0f5b68f4e9..0000000000 --- a/libs/unimrcp/platforms/libunimrcp-server/libunimrcpserver.vcproj +++ /dev/null @@ -1,272 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/platforms/libunimrcp-server/libunimrcpserver.vcxproj b/libs/unimrcp/platforms/libunimrcp-server/libunimrcpserver.vcxproj deleted file mode 100644 index a4ba6c4943..0000000000 --- a/libs/unimrcp/platforms/libunimrcp-server/libunimrcpserver.vcxproj +++ /dev/null @@ -1,140 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {C98AF157-352E-4737-BD30-A24E2647F5AE} - libunimrcpserver - Win32Proj - - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - $(ProjectRootDir)modules\mrcp-sofiasip\include;$(ProjectRootDir)modules\mrcp-unirtsp\include;%(AdditionalIncludeDirectories) - - - - - $(ProjectRootDir)modules\mrcp-sofiasip\include;$(ProjectRootDir)modules\mrcp-unirtsp\include;%(AdditionalIncludeDirectories) - - - - - X64 - - - $(ProjectRootDir)modules\mrcp-sofiasip\include;$(ProjectRootDir)modules\mrcp-unirtsp\include;%(AdditionalIncludeDirectories) - ProgramDatabase - - - - - X64 - - - $(ProjectRootDir)modules\mrcp-sofiasip\include;$(ProjectRootDir)modules\mrcp-unirtsp\include;%(AdditionalIncludeDirectories) - - - - - - - - - - - - - {18b1f35a-10f8-4287-9b37-2d10501b0b38} - false - - - {746f3632-5bb2-4570-9453-31d6d58a7d8e} - false - - - {deb01acb-d65f-4a62-aed9-58c1054499e9} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/platforms/libunimrcp-server/libunimrcpserver.vcxproj.filters b/libs/unimrcp/platforms/libunimrcp-server/libunimrcpserver.vcxproj.filters deleted file mode 100644 index 67b6af97a6..0000000000 --- a/libs/unimrcp/platforms/libunimrcp-server/libunimrcpserver.vcxproj.filters +++ /dev/null @@ -1,29 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {c164436d-b3de-474f-99bc-6b2ca1a4c879} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - include - - - include - - - include - - - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/platforms/libunimrcp-server/src/unimrcp_server.c b/libs/unimrcp/platforms/libunimrcp-server/src/unimrcp_server.c deleted file mode 100644 index 90f1805412..0000000000 --- a/libs/unimrcp/platforms/libunimrcp-server/src/unimrcp_server.c +++ /dev/null @@ -1,1251 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: unimrcp_server.c 2252 2014-11-21 02:45:15Z achaloyan@gmail.com $ - */ - -#include -#include -#include -#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 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; -} diff --git a/libs/unimrcp/platforms/umc/Makefile.am b/libs/unimrcp/platforms/umc/Makefile.am deleted file mode 100644 index 5b41d43e2d..0000000000 --- a/libs/unimrcp/platforms/umc/Makefile.am +++ /dev/null @@ -1,26 +0,0 @@ -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 diff --git a/libs/unimrcp/platforms/umc/include/dtmfscenario.h b/libs/unimrcp/platforms/umc/include/dtmfscenario.h deleted file mode 100644 index 7847ab3237..0000000000 --- a/libs/unimrcp/platforms/umc/include/dtmfscenario.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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 */ diff --git a/libs/unimrcp/platforms/umc/include/dtmfsession.h b/libs/unimrcp/platforms/umc/include/dtmfsession.h deleted file mode 100644 index 4093fff43c..0000000000 --- a/libs/unimrcp/platforms/umc/include/dtmfsession.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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 */ diff --git a/libs/unimrcp/platforms/umc/include/recogscenario.h b/libs/unimrcp/platforms/umc/include/recogscenario.h deleted file mode 100644 index 6d40ebfe9e..0000000000 --- a/libs/unimrcp/platforms/umc/include/recogscenario.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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 */ diff --git a/libs/unimrcp/platforms/umc/include/recogsession.h b/libs/unimrcp/platforms/umc/include/recogsession.h deleted file mode 100644 index 02ba2a7f1d..0000000000 --- a/libs/unimrcp/platforms/umc/include/recogsession.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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 */ diff --git a/libs/unimrcp/platforms/umc/include/recorderscenario.h b/libs/unimrcp/platforms/umc/include/recorderscenario.h deleted file mode 100644 index 4a1f283c23..0000000000 --- a/libs/unimrcp/platforms/umc/include/recorderscenario.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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 */ diff --git a/libs/unimrcp/platforms/umc/include/recordersession.h b/libs/unimrcp/platforms/umc/include/recordersession.h deleted file mode 100644 index 31d53c8a45..0000000000 --- a/libs/unimrcp/platforms/umc/include/recordersession.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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 */ diff --git a/libs/unimrcp/platforms/umc/include/setparamscenario.h b/libs/unimrcp/platforms/umc/include/setparamscenario.h deleted file mode 100644 index bc1ad0ed89..0000000000 --- a/libs/unimrcp/platforms/umc/include/setparamscenario.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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 */ diff --git a/libs/unimrcp/platforms/umc/include/setparamsession.h b/libs/unimrcp/platforms/umc/include/setparamsession.h deleted file mode 100644 index 16754f309f..0000000000 --- a/libs/unimrcp/platforms/umc/include/setparamsession.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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 -#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 */ diff --git a/libs/unimrcp/platforms/umc/include/synthscenario.h b/libs/unimrcp/platforms/umc/include/synthscenario.h deleted file mode 100644 index 120afc7854..0000000000 --- a/libs/unimrcp/platforms/umc/include/synthscenario.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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 */ diff --git a/libs/unimrcp/platforms/umc/include/synthsession.h b/libs/unimrcp/platforms/umc/include/synthsession.h deleted file mode 100644 index d980431af8..0000000000 --- a/libs/unimrcp/platforms/umc/include/synthsession.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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 */ diff --git a/libs/unimrcp/platforms/umc/include/umcconsole.h b/libs/unimrcp/platforms/umc/include/umcconsole.h deleted file mode 100644 index 06dc221309..0000000000 --- a/libs/unimrcp/platforms/umc/include/umcconsole.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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 */ diff --git a/libs/unimrcp/platforms/umc/include/umcframework.h b/libs/unimrcp/platforms/umc/include/umcframework.h deleted file mode 100644 index fbbb47c441..0000000000 --- a/libs/unimrcp/platforms/umc/include/umcframework.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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 -#include -#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 */ diff --git a/libs/unimrcp/platforms/umc/include/umcscenario.h b/libs/unimrcp/platforms/umc/include/umcscenario.h deleted file mode 100644 index c3f3b03cc6..0000000000 --- a/libs/unimrcp/platforms/umc/include/umcscenario.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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 -#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 */ diff --git a/libs/unimrcp/platforms/umc/include/umcsession.h b/libs/unimrcp/platforms/umc/include/umcsession.h deleted file mode 100644 index a265d2a546..0000000000 --- a/libs/unimrcp/platforms/umc/include/umcsession.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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 */ diff --git a/libs/unimrcp/platforms/umc/include/verifierscenario.h b/libs/unimrcp/platforms/umc/include/verifierscenario.h deleted file mode 100644 index b4b49a382b..0000000000 --- a/libs/unimrcp/platforms/umc/include/verifierscenario.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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 */ diff --git a/libs/unimrcp/platforms/umc/include/verifiersession.h b/libs/unimrcp/platforms/umc/include/verifiersession.h deleted file mode 100644 index 777a58507a..0000000000 --- a/libs/unimrcp/platforms/umc/include/verifiersession.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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 */ diff --git a/libs/unimrcp/platforms/umc/src/dtmfscenario.cpp b/libs/unimrcp/platforms/umc/src/dtmfscenario.cpp deleted file mode 100644 index 190c9a87f1..0000000000 --- a/libs/unimrcp/platforms/umc/src/dtmfscenario.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: dtmfscenario.cpp 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#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); -} diff --git a/libs/unimrcp/platforms/umc/src/dtmfsession.cpp b/libs/unimrcp/platforms/umc/src/dtmfsession.cpp deleted file mode 100644 index b10b13946c..0000000000 --- a/libs/unimrcp/platforms/umc/src/dtmfsession.cpp +++ /dev/null @@ -1,279 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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; -} diff --git a/libs/unimrcp/platforms/umc/src/main.cpp b/libs/unimrcp/platforms/umc/src/main.cpp deleted file mode 100644 index d06873989e..0000000000 --- a/libs/unimrcp/platforms/umc/src/main.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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; -} diff --git a/libs/unimrcp/platforms/umc/src/recogscenario.cpp b/libs/unimrcp/platforms/umc/src/recogscenario.cpp deleted file mode 100644 index 658a46586d..0000000000 --- a/libs/unimrcp/platforms/umc/src/recogscenario.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: recogscenario.cpp 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#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); -} diff --git a/libs/unimrcp/platforms/umc/src/recogsession.cpp b/libs/unimrcp/platforms/umc/src/recogsession.cpp deleted file mode 100644 index 5779bf4418..0000000000 --- a/libs/unimrcp/platforms/umc/src/recogsession.cpp +++ /dev/null @@ -1,456 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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; -} diff --git a/libs/unimrcp/platforms/umc/src/recorderscenario.cpp b/libs/unimrcp/platforms/umc/src/recorderscenario.cpp deleted file mode 100644 index 6d303b848a..0000000000 --- a/libs/unimrcp/platforms/umc/src/recorderscenario.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: recorderscenario.cpp 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#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); -} diff --git a/libs/unimrcp/platforms/umc/src/recordersession.cpp b/libs/unimrcp/platforms/umc/src/recordersession.cpp deleted file mode 100644 index 886e3248fb..0000000000 --- a/libs/unimrcp/platforms/umc/src/recordersession.cpp +++ /dev/null @@ -1,286 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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; -} diff --git a/libs/unimrcp/platforms/umc/src/setparamscenario.cpp b/libs/unimrcp/platforms/umc/src/setparamscenario.cpp deleted file mode 100644 index cbb203379e..0000000000 --- a/libs/unimrcp/platforms/umc/src/setparamscenario.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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); -} diff --git a/libs/unimrcp/platforms/umc/src/setparamsession.cpp b/libs/unimrcp/platforms/umc/src/setparamsession.cpp deleted file mode 100644 index c1fabd3e77..0000000000 --- a/libs/unimrcp/platforms/umc/src/setparamsession.cpp +++ /dev/null @@ -1,390 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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; -} diff --git a/libs/unimrcp/platforms/umc/src/synthscenario.cpp b/libs/unimrcp/platforms/umc/src/synthscenario.cpp deleted file mode 100644 index de1718ce47..0000000000 --- a/libs/unimrcp/platforms/umc/src/synthscenario.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: synthscenario.cpp 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#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); -} diff --git a/libs/unimrcp/platforms/umc/src/synthsession.cpp b/libs/unimrcp/platforms/umc/src/synthsession.cpp deleted file mode 100644 index 07adaf6cbb..0000000000 --- a/libs/unimrcp/platforms/umc/src/synthsession.cpp +++ /dev/null @@ -1,299 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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; -} diff --git a/libs/unimrcp/platforms/umc/src/umcconsole.cpp b/libs/unimrcp/platforms/umc/src/umcconsole.cpp deleted file mode 100644 index a065208a91..0000000000 --- a/libs/unimrcp/platforms/umc/src/umcconsole.cpp +++ /dev/null @@ -1,333 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: umcconsole.cpp 2204 2014-10-31 01:01:42Z achaloyan@gmail.com $ - */ - -#include -#include -#include -#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; -} diff --git a/libs/unimrcp/platforms/umc/src/umcframework.cpp b/libs/unimrcp/platforms/umc/src/umcframework.cpp deleted file mode 100644 index 50ac00c415..0000000000 --- a/libs/unimrcp/platforms/umc/src/umcframework.cpp +++ /dev/null @@ -1,632 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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; -} diff --git a/libs/unimrcp/platforms/umc/src/umcscenario.cpp b/libs/unimrcp/platforms/umc/src/umcscenario.cpp deleted file mode 100644 index d9300dcf3c..0000000000 --- a/libs/unimrcp/platforms/umc/src/umcscenario.cpp +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: umcscenario.cpp 2232 2014-11-12 01:33:37Z achaloyan@gmail.com $ - */ - -#include -#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; iattrib_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; -} diff --git a/libs/unimrcp/platforms/umc/src/umcsession.cpp b/libs/unimrcp/platforms/umc/src/umcsession.cpp deleted file mode 100644 index 29618e0925..0000000000 --- a/libs/unimrcp/platforms/umc/src/umcsession.cpp +++ /dev/null @@ -1,252 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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; -} diff --git a/libs/unimrcp/platforms/umc/src/verifierscenario.cpp b/libs/unimrcp/platforms/umc/src/verifierscenario.cpp deleted file mode 100644 index e11d3f6e93..0000000000 --- a/libs/unimrcp/platforms/umc/src/verifierscenario.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: verifierscenario.cpp 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#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); -} diff --git a/libs/unimrcp/platforms/umc/src/verifiersession.cpp b/libs/unimrcp/platforms/umc/src/verifiersession.cpp deleted file mode 100644 index c9da9f4465..0000000000 --- a/libs/unimrcp/platforms/umc/src/verifiersession.cpp +++ /dev/null @@ -1,396 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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; -} diff --git a/libs/unimrcp/platforms/umc/umc.rc b/libs/unimrcp/platforms/umc/umc.rc deleted file mode 100644 index 98a3cf9209..0000000000 --- a/libs/unimrcp/platforms/umc/umc.rc +++ /dev/null @@ -1,39 +0,0 @@ -#include "uni_version.h" - -1 VERSIONINFO - FILEVERSION UNI_VERSION_STRING_CSV,0 - PRODUCTVERSION UNI_VERSION_STRING_CSV,0 - FILEFLAGSMASK 0x3fL -#if defined(_DEBUG) - FILEFLAGS 0x01L -#else - FILEFLAGS 0x00L -#endif -#if defined(WINNT) || defined(WIN64) - FILEOS 0x40004L -#else - FILEOS 0x4L -#endif - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "Comments", UNI_LICENSE "\0" - VALUE "CompanyName", "UniMRCP\0" - VALUE "FileDescription", "UniMRCP 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 diff --git a/libs/unimrcp/platforms/umc/umc.vcproj b/libs/unimrcp/platforms/umc/umc.vcproj deleted file mode 100644 index d003362f18..0000000000 --- a/libs/unimrcp/platforms/umc/umc.vcproj +++ /dev/null @@ -1,460 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/platforms/umc/umc.vcxproj b/libs/unimrcp/platforms/umc/umc.vcxproj deleted file mode 100644 index 36c4cb2aaa..0000000000 --- a/libs/unimrcp/platforms/umc/umc.vcxproj +++ /dev/null @@ -1,176 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {CD1C52C1-D8E1-4654-AE65-6CCAB38DE894} - umc - - - - Application - - - Application - - - Application - - - Application - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - include;%(AdditionalIncludeDirectories) - - - $(UniMRCPClientLibs);%(AdditionalDependencies) - - - - - include;%(AdditionalIncludeDirectories) - - - $(UniMRCPClientLibs);%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - ProgramDatabase - - - $(UniMRCPClientLibs);%(AdditionalDependencies) - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - - - $(UniMRCPClientLibs);%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ..\..\build;%(AdditionalIncludeDirectories) - ..\..\build;%(AdditionalIncludeDirectories) - ..\..\build;%(AdditionalIncludeDirectories) - ..\..\build;%(AdditionalIncludeDirectories) - - - - - {ee157390-1e85-416c-946e-620e32c9ad33} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/platforms/umc/umc.vcxproj.filters b/libs/unimrcp/platforms/umc/umc.vcxproj.filters deleted file mode 100644 index 8fbefd40bc..0000000000 --- a/libs/unimrcp/platforms/umc/umc.vcxproj.filters +++ /dev/null @@ -1,119 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/platforms/unimrcp-client/Makefile.am b/libs/unimrcp/platforms/unimrcp-client/Makefile.am deleted file mode 100644 index f7310d2765..0000000000 --- a/libs/unimrcp/platforms/unimrcp-client/Makefile.am +++ /dev/null @@ -1,16 +0,0 @@ -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 diff --git a/libs/unimrcp/platforms/unimrcp-client/include/demo_application.h b/libs/unimrcp/platforms/unimrcp-client/include/demo_application.h deleted file mode 100644 index a1f3899a7c..0000000000 --- a/libs/unimrcp/platforms/unimrcp-client/include/demo_application.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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 */ diff --git a/libs/unimrcp/platforms/unimrcp-client/include/demo_framework.h b/libs/unimrcp/platforms/unimrcp-client/include/demo_framework.h deleted file mode 100644 index e7b7ccdeaa..0000000000 --- a/libs/unimrcp/platforms/unimrcp-client/include/demo_framework.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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 */ diff --git a/libs/unimrcp/platforms/unimrcp-client/include/demo_util.h b/libs/unimrcp/platforms/unimrcp-client/include/demo_util.h deleted file mode 100644 index 7e686e275a..0000000000 --- a/libs/unimrcp/platforms/unimrcp-client/include/demo_util.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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 */ diff --git a/libs/unimrcp/platforms/unimrcp-client/src/demo_bypass_application.c b/libs/unimrcp/platforms/unimrcp-client/src/demo_bypass_application.c deleted file mode 100644 index 1eef85788c..0000000000 --- a/libs/unimrcp/platforms/unimrcp-client/src/demo_bypass_application.c +++ /dev/null @@ -1,213 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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; -} diff --git a/libs/unimrcp/platforms/unimrcp-client/src/demo_discover_application.c b/libs/unimrcp/platforms/unimrcp-client/src/demo_discover_application.c deleted file mode 100644 index 0218f5637d..0000000000 --- a/libs/unimrcp/platforms/unimrcp-client/src/demo_discover_application.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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; -} diff --git a/libs/unimrcp/platforms/unimrcp-client/src/demo_framework.c b/libs/unimrcp/platforms/unimrcp-client/src/demo_framework.c deleted file mode 100644 index e3738a2211..0000000000 --- a/libs/unimrcp/platforms/unimrcp-client/src/demo_framework.c +++ /dev/null @@ -1,245 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: demo_framework.c 2233 2014-11-12 01:34:59Z achaloyan@gmail.com $ - */ - -#include -#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; -} diff --git a/libs/unimrcp/platforms/unimrcp-client/src/demo_recog_application.c b/libs/unimrcp/platforms/unimrcp-client/src/demo_recog_application.c deleted file mode 100644 index a87ca874c9..0000000000 --- a/libs/unimrcp/platforms/unimrcp-client/src/demo_recog_application.c +++ /dev/null @@ -1,380 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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; -} diff --git a/libs/unimrcp/platforms/unimrcp-client/src/demo_synth_application.c b/libs/unimrcp/platforms/unimrcp-client/src/demo_synth_application.c deleted file mode 100644 index e99d5a8490..0000000000 --- a/libs/unimrcp/platforms/unimrcp-client/src/demo_synth_application.c +++ /dev/null @@ -1,317 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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; -} diff --git a/libs/unimrcp/platforms/unimrcp-client/src/demo_util.c b/libs/unimrcp/platforms/unimrcp-client/src/demo_util.c deleted file mode 100644 index fa59112578..0000000000 --- a/libs/unimrcp/platforms/unimrcp-client/src/demo_util.c +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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; -} diff --git a/libs/unimrcp/platforms/unimrcp-client/src/main.c b/libs/unimrcp/platforms/unimrcp-client/src/main.c deleted file mode 100644 index 702c254b8b..0000000000 --- a/libs/unimrcp/platforms/unimrcp-client/src/main.c +++ /dev/null @@ -1,275 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: main.c 2204 2014-10-31 01:01:42Z achaloyan@gmail.com $ - */ - -#include -#include -#include -#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; -} diff --git a/libs/unimrcp/platforms/unimrcp-client/unimrcpclient.rc b/libs/unimrcp/platforms/unimrcp-client/unimrcpclient.rc deleted file mode 100644 index 6bfb85f311..0000000000 --- a/libs/unimrcp/platforms/unimrcp-client/unimrcpclient.rc +++ /dev/null @@ -1,39 +0,0 @@ -#include "uni_version.h" - -1 VERSIONINFO - FILEVERSION UNI_VERSION_STRING_CSV,0 - PRODUCTVERSION UNI_VERSION_STRING_CSV,0 - FILEFLAGSMASK 0x3fL -#if defined(_DEBUG) - FILEFLAGS 0x01L -#else - FILEFLAGS 0x00L -#endif -#if defined(WINNT) || defined(WIN64) - FILEOS 0x40004L -#else - FILEOS 0x4L -#endif - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "Comments", UNI_LICENSE "\0" - VALUE "CompanyName", "UniMRCP\0" - VALUE "FileDescription", "UniMRCP 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 diff --git a/libs/unimrcp/platforms/unimrcp-client/unimrcpclient.vcproj b/libs/unimrcp/platforms/unimrcp-client/unimrcpclient.vcproj deleted file mode 100644 index 706498e4a4..0000000000 --- a/libs/unimrcp/platforms/unimrcp-client/unimrcpclient.vcproj +++ /dev/null @@ -1,368 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/platforms/unimrcp-client/unimrcpclient.vcxproj b/libs/unimrcp/platforms/unimrcp-client/unimrcpclient.vcxproj deleted file mode 100644 index e477078f01..0000000000 --- a/libs/unimrcp/platforms/unimrcp-client/unimrcpclient.vcxproj +++ /dev/null @@ -1,153 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {57FAF32E-49FD-491F-895D-132D0D5EFE0A} - unimrcpclient - - - - Application - - - Application - - - Application - - - Application - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - include;%(AdditionalIncludeDirectories) - - - $(UniMRCPClientLibs);%(AdditionalDependencies) - - - - - include;%(AdditionalIncludeDirectories) - - - $(UniMRCPClientLibs);%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - ProgramDatabase - - - $(UniMRCPClientLibs);%(AdditionalDependencies) - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - - - $(UniMRCPClientLibs);%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - - - - - - - - - - - - - - - ..\..\build;%(AdditionalIncludeDirectories) - ..\..\build;%(AdditionalIncludeDirectories) - ..\..\build;%(AdditionalIncludeDirectories) - ..\..\build;%(AdditionalIncludeDirectories) - - - - - {ee157390-1e85-416c-946e-620e32c9ad33} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/platforms/unimrcp-client/unimrcpclient.vcxproj.filters b/libs/unimrcp/platforms/unimrcp-client/unimrcpclient.vcxproj.filters deleted file mode 100644 index 83f0ded84c..0000000000 --- a/libs/unimrcp/platforms/unimrcp-client/unimrcpclient.vcxproj.filters +++ /dev/null @@ -1,50 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - - - include - - - include - - - include - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/platforms/unimrcp-server/Makefile.am b/libs/unimrcp/platforms/unimrcp-server/Makefile.am deleted file mode 100644 index 3e8b50823a..0000000000 --- a/libs/unimrcp/platforms/unimrcp-server/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -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 diff --git a/libs/unimrcp/platforms/unimrcp-server/src/main.c b/libs/unimrcp/platforms/unimrcp-server/src/main.c deleted file mode 100644 index a295a44934..0000000000 --- a/libs/unimrcp/platforms/unimrcp-server/src/main.c +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: main.c 2204 2014-10-31 01:01:42Z achaloyan@gmail.com $ - */ - -#include -#include -#include -#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; -} diff --git a/libs/unimrcp/platforms/unimrcp-server/src/uni_cmdline.c b/libs/unimrcp/platforms/unimrcp-server/src/uni_cmdline.c deleted file mode 100644 index e79132bb49..0000000000 --- a/libs/unimrcp/platforms/unimrcp-server/src/uni_cmdline.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: uni_cmdline.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include -#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; -} diff --git a/libs/unimrcp/platforms/unimrcp-server/src/uni_daemon.c b/libs/unimrcp/platforms/unimrcp-server/src/uni_daemon.c deleted file mode 100644 index 969f14dd60..0000000000 --- a/libs/unimrcp/platforms/unimrcp-server/src/uni_daemon.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: uni_daemon.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include -#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; -} diff --git a/libs/unimrcp/platforms/unimrcp-server/src/uni_service.c b/libs/unimrcp/platforms/unimrcp-server/src/uni_service.c deleted file mode 100644 index 31b70c0c39..0000000000 --- a/libs/unimrcp/platforms/unimrcp-server/src/uni_service.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: uni_service.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include -#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; -} diff --git a/libs/unimrcp/platforms/unimrcp-server/unimrcpserver.rc b/libs/unimrcp/platforms/unimrcp-server/unimrcpserver.rc deleted file mode 100644 index 4f6c5dd891..0000000000 --- a/libs/unimrcp/platforms/unimrcp-server/unimrcpserver.rc +++ /dev/null @@ -1,39 +0,0 @@ -#include "uni_version.h" - -1 VERSIONINFO - FILEVERSION UNI_VERSION_STRING_CSV,0 - PRODUCTVERSION UNI_VERSION_STRING_CSV,0 - FILEFLAGSMASK 0x3fL -#if defined(_DEBUG) - FILEFLAGS 0x01L -#else - FILEFLAGS 0x00L -#endif -#if defined(WINNT) || defined(WIN64) - FILEOS 0x40004L -#else - FILEOS 0x4L -#endif - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "Comments", UNI_LICENSE "\0" - VALUE "CompanyName", "UniMRCP\0" - VALUE "FileDescription", "UniMRCP 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 diff --git a/libs/unimrcp/platforms/unimrcp-server/unimrcpserver.vcproj b/libs/unimrcp/platforms/unimrcp-server/unimrcpserver.vcproj deleted file mode 100644 index 46e57dab5a..0000000000 --- a/libs/unimrcp/platforms/unimrcp-server/unimrcpserver.vcproj +++ /dev/null @@ -1,340 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/platforms/unimrcp-server/unimrcpserver.vcxproj b/libs/unimrcp/platforms/unimrcp-server/unimrcpserver.vcxproj deleted file mode 100644 index e2d74c9575..0000000000 --- a/libs/unimrcp/platforms/unimrcp-server/unimrcpserver.vcxproj +++ /dev/null @@ -1,135 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {592CF22D-3F8F-4A77-A174-130D77B7623B} - unimrcpserver - - - - Application - - - Application - - - Application - - - Application - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - $(UniMRCPServerLibs);%(AdditionalDependencies) - - - - - $(UniMRCPServerLibs);%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - X64 - - - ProgramDatabase - - - $(UniMRCPServerLibs);%(AdditionalDependencies) - - - - - X64 - - - $(UniMRCPServerLibs);%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - - - - - - - ..\..\build;%(AdditionalIncludeDirectories) - ..\..\build;%(AdditionalIncludeDirectories) - ..\..\build;%(AdditionalIncludeDirectories) - ..\..\build;%(AdditionalIncludeDirectories) - - - - - {c98af157-352e-4737-bd30-a24e2647f5ae} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/platforms/unimrcp-server/unimrcpserver.vcxproj.filters b/libs/unimrcp/platforms/unimrcp-server/unimrcpserver.vcxproj.filters deleted file mode 100644 index 6b335bf544..0000000000 --- a/libs/unimrcp/platforms/unimrcp-server/unimrcpserver.vcxproj.filters +++ /dev/null @@ -1,30 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - - - src - - - src - - - src - - - src - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/plugins/Makefile.am b/libs/unimrcp/plugins/Makefile.am deleted file mode 100644 index 2300a4934a..0000000000 --- a/libs/unimrcp/plugins/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ -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 diff --git a/libs/unimrcp/plugins/demo-recog/Makefile.am b/libs/unimrcp/plugins/demo-recog/Makefile.am deleted file mode 100644 index 51babdaaa3..0000000000 --- a/libs/unimrcp/plugins/demo-recog/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -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 diff --git a/libs/unimrcp/plugins/demo-recog/demorecog.vcproj b/libs/unimrcp/plugins/demo-recog/demorecog.vcproj deleted file mode 100644 index 567aa3d158..0000000000 --- a/libs/unimrcp/plugins/demo-recog/demorecog.vcproj +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/plugins/demo-recog/demorecog.vcxproj b/libs/unimrcp/plugins/demo-recog/demorecog.vcxproj deleted file mode 100644 index 562c8b4902..0000000000 --- a/libs/unimrcp/plugins/demo-recog/demorecog.vcxproj +++ /dev/null @@ -1,123 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {B495B6D9-AF84-479D-B30A-313C16EF8BFD} - demorecog - Win32Proj - - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - include;%(AdditionalIncludeDirectories) - - - - - include;%(AdditionalIncludeDirectories) - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - ProgramDatabase - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - - - - - - - - {843425be-9a9a-44f4-a4e3-4b57d6abd53c} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/plugins/demo-recog/demorecog.vcxproj.filters b/libs/unimrcp/plugins/demo-recog/demorecog.vcxproj.filters deleted file mode 100644 index af5b05f706..0000000000 --- a/libs/unimrcp/plugins/demo-recog/demorecog.vcxproj.filters +++ /dev/null @@ -1,18 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {4c5e54ad-7563-43a7-8b11-5067a45289e9} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/plugins/demo-recog/src/demo_recog_engine.c b/libs/unimrcp/plugins/demo-recog/src/demo_recog_engine.c deleted file mode 100644 index 75954a45b2..0000000000 --- a/libs/unimrcp/plugins/demo-recog/src/demo_recog_engine.c +++ /dev/null @@ -1,564 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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; -} diff --git a/libs/unimrcp/plugins/demo-synth/Makefile.am b/libs/unimrcp/plugins/demo-synth/Makefile.am deleted file mode 100644 index 4b62aef593..0000000000 --- a/libs/unimrcp/plugins/demo-synth/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -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 diff --git a/libs/unimrcp/plugins/demo-synth/demosynth.vcproj b/libs/unimrcp/plugins/demo-synth/demosynth.vcproj deleted file mode 100644 index 673fb07f30..0000000000 --- a/libs/unimrcp/plugins/demo-synth/demosynth.vcproj +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/plugins/demo-synth/demosynth.vcxproj b/libs/unimrcp/plugins/demo-synth/demosynth.vcxproj deleted file mode 100644 index 4df06203cb..0000000000 --- a/libs/unimrcp/plugins/demo-synth/demosynth.vcxproj +++ /dev/null @@ -1,123 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {92BFA534-C419-4EB2-AAA3-510653F38F08} - demosynth - Win32Proj - - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - include;%(AdditionalIncludeDirectories) - - - - - include;%(AdditionalIncludeDirectories) - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - ProgramDatabase - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - - - - - - - - {843425be-9a9a-44f4-a4e3-4b57d6abd53c} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/plugins/demo-synth/demosynth.vcxproj.filters b/libs/unimrcp/plugins/demo-synth/demosynth.vcxproj.filters deleted file mode 100644 index 1c71d5467d..0000000000 --- a/libs/unimrcp/plugins/demo-synth/demosynth.vcxproj.filters +++ /dev/null @@ -1,18 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {c816d2c0-8f04-4474-ad43-cfac130a1a84} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/plugins/demo-synth/src/demo_synth_engine.c b/libs/unimrcp/plugins/demo-synth/src/demo_synth_engine.c deleted file mode 100644 index bc68c895fa..0000000000 --- a/libs/unimrcp/plugins/demo-synth/src/demo_synth_engine.c +++ /dev/null @@ -1,557 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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; -} diff --git a/libs/unimrcp/plugins/demo-verifier/Makefile.am b/libs/unimrcp/plugins/demo-verifier/Makefile.am deleted file mode 100644 index 9da71c1024..0000000000 --- a/libs/unimrcp/plugins/demo-verifier/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -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 diff --git a/libs/unimrcp/plugins/demo-verifier/demoverifier.vcproj b/libs/unimrcp/plugins/demo-verifier/demoverifier.vcproj deleted file mode 100644 index efe5f79423..0000000000 --- a/libs/unimrcp/plugins/demo-verifier/demoverifier.vcproj +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/plugins/demo-verifier/demoverifier.vcxproj b/libs/unimrcp/plugins/demo-verifier/demoverifier.vcxproj deleted file mode 100644 index 6dfd17cd6b..0000000000 --- a/libs/unimrcp/plugins/demo-verifier/demoverifier.vcxproj +++ /dev/null @@ -1,123 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {F7563CAD-5C95-46E5-89B7-0953C6C6E746} - demoverifier - Win32Proj - - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - include;%(AdditionalIncludeDirectories) - - - - - include;%(AdditionalIncludeDirectories) - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - ProgramDatabase - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - - - - - - - - {843425be-9a9a-44f4-a4e3-4b57d6abd53c} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/plugins/demo-verifier/demoverifier.vcxproj.filters b/libs/unimrcp/plugins/demo-verifier/demoverifier.vcxproj.filters deleted file mode 100644 index afd5da4d9f..0000000000 --- a/libs/unimrcp/plugins/demo-verifier/demoverifier.vcxproj.filters +++ /dev/null @@ -1,18 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {42255732-d637-4aef-ab75-104eb723ff72} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/plugins/demo-verifier/src/demo_verifier_engine.c b/libs/unimrcp/plugins/demo-verifier/src/demo_verifier_engine.c deleted file mode 100644 index 6e3d290d36..0000000000 --- a/libs/unimrcp/plugins/demo-verifier/src/demo_verifier_engine.c +++ /dev/null @@ -1,589 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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; -} diff --git a/libs/unimrcp/plugins/mrcp-recorder/Makefile.am b/libs/unimrcp/plugins/mrcp-recorder/Makefile.am deleted file mode 100644 index fe49710588..0000000000 --- a/libs/unimrcp/plugins/mrcp-recorder/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -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 diff --git a/libs/unimrcp/plugins/mrcp-recorder/mrcprecorder.vcproj b/libs/unimrcp/plugins/mrcp-recorder/mrcprecorder.vcproj deleted file mode 100644 index 71194f7b10..0000000000 --- a/libs/unimrcp/plugins/mrcp-recorder/mrcprecorder.vcproj +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/plugins/mrcp-recorder/mrcprecorder.vcxproj b/libs/unimrcp/plugins/mrcp-recorder/mrcprecorder.vcxproj deleted file mode 100644 index 9a3a6a5aa6..0000000000 --- a/libs/unimrcp/plugins/mrcp-recorder/mrcprecorder.vcxproj +++ /dev/null @@ -1,123 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2} - mrcprecorder - Win32Proj - - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - include;%(AdditionalIncludeDirectories) - - - - - include;%(AdditionalIncludeDirectories) - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - ProgramDatabase - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - - - - - - - - {843425be-9a9a-44f4-a4e3-4b57d6abd53c} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/plugins/mrcp-recorder/mrcprecorder.vcxproj.filters b/libs/unimrcp/plugins/mrcp-recorder/mrcprecorder.vcxproj.filters deleted file mode 100644 index 6fe96d5625..0000000000 --- a/libs/unimrcp/plugins/mrcp-recorder/mrcprecorder.vcxproj.filters +++ /dev/null @@ -1,18 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {b1d2c804-b3bb-4413-8d11-7ff67d4e874c} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/plugins/mrcp-recorder/src/mrcp_recorder_engine.c b/libs/unimrcp/plugins/mrcp-recorder/src/mrcp_recorder_engine.c deleted file mode 100644 index 785be23efb..0000000000 --- a/libs/unimrcp/plugins/mrcp-recorder/src/mrcp_recorder_engine.c +++ /dev/null @@ -1,481 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mrcp_recorder_engine.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, - ";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; -} diff --git a/libs/unimrcp/tests/Makefile.am b/libs/unimrcp/tests/Makefile.am deleted file mode 100644 index fc52c02681..0000000000 --- a/libs/unimrcp/tests/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -SUBDIRS = apttest mpftest mrcptest rtsptest strtablegen diff --git a/libs/unimrcp/tests/apttest/Makefile.am b/libs/unimrcp/tests/apttest/Makefile.am deleted file mode 100644 index 205207400a..0000000000 --- a/libs/unimrcp/tests/apttest/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -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 diff --git a/libs/unimrcp/tests/apttest/apttest.vcproj b/libs/unimrcp/tests/apttest/apttest.vcproj deleted file mode 100644 index 4765530fc9..0000000000 --- a/libs/unimrcp/tests/apttest/apttest.vcproj +++ /dev/null @@ -1,304 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/tests/apttest/apttest.vcxproj b/libs/unimrcp/tests/apttest/apttest.vcxproj deleted file mode 100644 index a766f033b1..0000000000 --- a/libs/unimrcp/tests/apttest/apttest.vcxproj +++ /dev/null @@ -1,127 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {429C907B-97D1-4B2D-9B0E-A14A5BFDAD15} - apttest - - - - Application - - - Application - - - Application - - - Application - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - - - - - aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - X64 - - - ProgramDatabase - - - aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - - - - - X64 - - - aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - - - - - - - {13deeca0-bdd4-4744-a1a2-8eb0a44df3d2} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/tests/apttest/apttest.vcxproj.filters b/libs/unimrcp/tests/apttest/apttest.vcxproj.filters deleted file mode 100644 index eba965070c..0000000000 --- a/libs/unimrcp/tests/apttest/apttest.vcxproj.filters +++ /dev/null @@ -1,27 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - - - src - - - src - - - src - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/tests/apttest/src/consumer_task_suite.c b/libs/unimrcp/tests/apttest/src/consumer_task_suite.c deleted file mode 100644 index 74f8197b05..0000000000 --- a/libs/unimrcp/tests/apttest/src/consumer_task_suite.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: consumer_task_suite.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#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; -} diff --git a/libs/unimrcp/tests/apttest/src/main.c b/libs/unimrcp/tests/apttest/src/main.c deleted file mode 100644 index 772f7f0003..0000000000 --- a/libs/unimrcp/tests/apttest/src/main.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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; -} diff --git a/libs/unimrcp/tests/apttest/src/multipart_suite.c b/libs/unimrcp/tests/apttest/src/multipart_suite.c deleted file mode 100644 index 74a9c29b1a..0000000000 --- a/libs/unimrcp/tests/apttest/src/multipart_suite.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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, - "\r\n" - " You have 4 new messages.

\r\n" - "
"); - 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; -} diff --git a/libs/unimrcp/tests/apttest/src/task_suite.c b/libs/unimrcp/tests/apttest/src/task_suite.c deleted file mode 100644 index e42f14e598..0000000000 --- a/libs/unimrcp/tests/apttest/src/task_suite.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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; -} diff --git a/libs/unimrcp/tests/mpftest/Makefile.am b/libs/unimrcp/tests/mpftest/Makefile.am deleted file mode 100644 index 0a032d121b..0000000000 --- a/libs/unimrcp/tests/mpftest/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -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 diff --git a/libs/unimrcp/tests/mpftest/mpftest.vcproj b/libs/unimrcp/tests/mpftest/mpftest.vcproj deleted file mode 100644 index 7a359cf1e0..0000000000 --- a/libs/unimrcp/tests/mpftest/mpftest.vcproj +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/tests/mpftest/mpftest.vcxproj b/libs/unimrcp/tests/mpftest/mpftest.vcxproj deleted file mode 100644 index a28878891a..0000000000 --- a/libs/unimrcp/tests/mpftest/mpftest.vcxproj +++ /dev/null @@ -1,125 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {DCF01B1C-5268-44F3-9130-D647FABFB663} - mpftest - - - - Application - - - Application - - - Application - - - Application - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - mpf.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;ws2_32.lib;winmm.lib;%(AdditionalDependencies) - - - - - mpf.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;ws2_32.lib;winmm.lib;%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - X64 - - - ProgramDatabase - - - mpf.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;ws2_32.lib;winmm.lib;%(AdditionalDependencies) - - - - - X64 - - - mpf.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;ws2_32.lib;winmm.lib;%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - - - - - {b5a00bfa-6083-4fae-a097-71642d6473b5} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/tests/mpftest/mpftest.vcxproj.filters b/libs/unimrcp/tests/mpftest/mpftest.vcxproj.filters deleted file mode 100644 index dbe64db07d..0000000000 --- a/libs/unimrcp/tests/mpftest/mpftest.vcxproj.filters +++ /dev/null @@ -1,21 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - - - src - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/tests/mpftest/src/main.c b/libs/unimrcp/tests/mpftest/src/main.c deleted file mode 100644 index 7e61aa19e7..0000000000 --- a/libs/unimrcp/tests/mpftest/src/main.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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; -} diff --git a/libs/unimrcp/tests/mpftest/src/mpf_suite.c b/libs/unimrcp/tests/mpftest/src/mpf_suite.c deleted file mode 100644 index a18e3319ae..0000000000 --- a/libs/unimrcp/tests/mpftest/src/mpf_suite.c +++ /dev/null @@ -1,571 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: mpf_suite.c 2214 2014-11-06 03:05:51Z achaloyan@gmail.com $ - */ - -#include -#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; icount; 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; -} diff --git a/libs/unimrcp/tests/mrcptest/Makefile.am b/libs/unimrcp/tests/mrcptest/Makefile.am deleted file mode 100644 index 02bba67955..0000000000 --- a/libs/unimrcp/tests/mrcptest/Makefile.am +++ /dev/null @@ -1,17 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -AM_CPPFLAGS = -I$(top_srcdir)/libs/mrcp/include \ - -I$(top_srcdir)/libs/mrcp/message/include \ - -I$(top_srcdir)/libs/mrcp/control/include \ - -I$(top_srcdir)/libs/mrcp/resources/include \ - -I$(top_srcdir)/libs/apr-toolkit/include \ - $(UNIMRCP_APR_INCLUDES) - -noinst_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 diff --git a/libs/unimrcp/tests/mrcptest/mrcptest.vcproj b/libs/unimrcp/tests/mrcptest/mrcptest.vcproj deleted file mode 100644 index eaba7349cf..0000000000 --- a/libs/unimrcp/tests/mrcptest/mrcptest.vcproj +++ /dev/null @@ -1,304 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/tests/mrcptest/mrcptest.vcxproj b/libs/unimrcp/tests/mrcptest/mrcptest.vcxproj deleted file mode 100644 index c49e4193a6..0000000000 --- a/libs/unimrcp/tests/mrcptest/mrcptest.vcxproj +++ /dev/null @@ -1,127 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {3CA97077-6210-4362-998A-D15A35EEAA08} - mrcptest - - - - Application - - - Application - - - Application - - - Application - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - mrcp.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - - - - - mrcp.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - X64 - - - ProgramDatabase - - - mrcp.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - - - - - X64 - - - mrcp.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - - - - - - - {1c320193-46a6-4b34-9c56-8ab584fc1b56} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/tests/mrcptest/mrcptest.vcxproj.filters b/libs/unimrcp/tests/mrcptest/mrcptest.vcxproj.filters deleted file mode 100644 index b0435c5f24..0000000000 --- a/libs/unimrcp/tests/mrcptest/mrcptest.vcxproj.filters +++ /dev/null @@ -1,27 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - - - src - - - src - - - src - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/tests/mrcptest/src/main.c b/libs/unimrcp/tests/mrcptest/src/main.c deleted file mode 100644 index dd12d22177..0000000000 --- a/libs/unimrcp/tests/mrcptest/src/main.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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; -} diff --git a/libs/unimrcp/tests/mrcptest/src/parse_gen_suite.c b/libs/unimrcp/tests/mrcptest/src/parse_gen_suite.c deleted file mode 100644 index 9d087cdcb3..0000000000 --- a/libs/unimrcp/tests/mrcptest/src/parse_gen_suite.c +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: parse_gen_suite.c 2249 2014-11-19 05:26:24Z achaloyan@gmail.com $ - */ - -#include -#include -#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; -} diff --git a/libs/unimrcp/tests/mrcptest/src/set_get_suite.c b/libs/unimrcp/tests/mrcptest/src/set_get_suite.c deleted file mode 100644 index f7ac1cfcef..0000000000 --- a/libs/unimrcp/tests/mrcptest/src/set_get_suite.c +++ /dev/null @@ -1,326 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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: "); - 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: "); - 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; -} diff --git a/libs/unimrcp/tests/mrcptest/src/transparent_set_get_suite.c b/libs/unimrcp/tests/mrcptest/src/transparent_set_get_suite.c deleted file mode 100644 index 19ab6e4206..0000000000 --- a/libs/unimrcp/tests/mrcptest/src/transparent_set_get_suite.c +++ /dev/null @@ -1,252 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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; -} diff --git a/libs/unimrcp/tests/mrcptest/v1/definegrammar.msg b/libs/unimrcp/tests/mrcptest/v1/definegrammar.msg deleted file mode 100644 index 1ea765535a..0000000000 --- a/libs/unimrcp/tests/mrcptest/v1/definegrammar.msg +++ /dev/null @@ -1,18 +0,0 @@ -//speechrecog -DEFINE-GRAMMAR 543257 MRCP/1.0 -Content-Type:application/grammar+xml -Content-Id:request1@form-level.store -Content-Length:309 - - - - - - - - - - oui - yes - - \ No newline at end of file diff --git a/libs/unimrcp/tests/mrcptest/v1/getparams.msg b/libs/unimrcp/tests/mrcptest/v1/getparams.msg deleted file mode 100644 index 61ef0b9f93..0000000000 --- a/libs/unimrcp/tests/mrcptest/v1/getparams.msg +++ /dev/null @@ -1,5 +0,0 @@ -//speechsynth -GET-PARAMS 543256 MRCP/1.0 -Voice-gender: -Voice-variant: - diff --git a/libs/unimrcp/tests/mrcptest/v1/multi.msg b/libs/unimrcp/tests/mrcptest/v1/multi.msg deleted file mode 100644 index 8a1f44e772..0000000000 --- a/libs/unimrcp/tests/mrcptest/v1/multi.msg +++ /dev/null @@ -1,27 +0,0 @@ -//speechsynth -GET-PARAMS 543256 MRCP/1.0 -Voice-gender: -Voice-variant: - -SET-PARAMS 543256 MRCP/1.0 -Voice-gender:female -Voice-variant:3 - -SPEAK 543257 MRCP/1.0 -Kill-On-Barge-In:false -Voice-gender:neutral -Prosody-volume:medium -Content-Type:application/synthesis+ssml -Content-Length:412 - - - - - You have 4 new messages. - The first is from Stephanie Williams - and arrived at - 3:45pm. - - The subject is ski trip - - \ No newline at end of file diff --git a/libs/unimrcp/tests/mrcptest/v1/pause.msg b/libs/unimrcp/tests/mrcptest/v1/pause.msg deleted file mode 100644 index 1ba3d79deb..0000000000 --- a/libs/unimrcp/tests/mrcptest/v1/pause.msg +++ /dev/null @@ -1,3 +0,0 @@ -//speechsynth -PAUSE 543258 MRCP/1.0 - diff --git a/libs/unimrcp/tests/mrcptest/v1/recognitioncomplete.msg b/libs/unimrcp/tests/mrcptest/v1/recognitioncomplete.msg deleted file mode 100644 index 054700a496..0000000000 --- a/libs/unimrcp/tests/mrcptest/v1/recognitioncomplete.msg +++ /dev/null @@ -1,20 +0,0 @@ -//speechrecog -RECOGNITION-COMPLETE 543257 COMPLETE MRCP/1.0 -Completion-Cause:000 success -Waveform-URL:http://web.media.com/session123/audio.wav -Content-Type:application/x-nlsml -Content-Length:446 - - - - - - - Andre Roy - - - may I speak to Andre Roy - - \ No newline at end of file diff --git a/libs/unimrcp/tests/mrcptest/v1/recognize.msg b/libs/unimrcp/tests/mrcptest/v1/recognize.msg deleted file mode 100644 index 0f1c55d6d3..0000000000 --- a/libs/unimrcp/tests/mrcptest/v1/recognize.msg +++ /dev/null @@ -1,30 +0,0 @@ -//speechrecog -RECOGNIZE 543257 MRCP/1.0 -Confidence-Threshold:90 -Content-Type:application/grammar+xml -Content-Id:request1@form-level.store -Content-Length:608 - - - - - - - - - - oui - yes - - - - - - may I speak to - - Michel Tremblay - Andre Roy - - - - \ No newline at end of file diff --git a/libs/unimrcp/tests/mrcptest/v1/response.msg b/libs/unimrcp/tests/mrcptest/v1/response.msg deleted file mode 100644 index 744fe11ec7..0000000000 --- a/libs/unimrcp/tests/mrcptest/v1/response.msg +++ /dev/null @@ -1,3 +0,0 @@ -//speechsynth -MRCP/1.0 543257 200 IN-PROGRESS - diff --git a/libs/unimrcp/tests/mrcptest/v1/resume.msg b/libs/unimrcp/tests/mrcptest/v1/resume.msg deleted file mode 100644 index 25bd8ab873..0000000000 --- a/libs/unimrcp/tests/mrcptest/v1/resume.msg +++ /dev/null @@ -1,3 +0,0 @@ -//speechsynth -RESUME 543260 MRCP/1.0 - diff --git a/libs/unimrcp/tests/mrcptest/v1/setparams.msg b/libs/unimrcp/tests/mrcptest/v1/setparams.msg deleted file mode 100644 index 4fad0b2082..0000000000 --- a/libs/unimrcp/tests/mrcptest/v1/setparams.msg +++ /dev/null @@ -1,5 +0,0 @@ -//speechsynth -SET-PARAMS 543256 MRCP/1.0 -Voice-gender:female -Voice-variant:3 - diff --git a/libs/unimrcp/tests/mrcptest/v1/speak.msg b/libs/unimrcp/tests/mrcptest/v1/speak.msg deleted file mode 100644 index d0f7d38db5..0000000000 --- a/libs/unimrcp/tests/mrcptest/v1/speak.msg +++ /dev/null @@ -1,19 +0,0 @@ -//speechsynth -SPEAK 543257 MRCP/1.0 -Kill-On-Barge-In:false -Voice-gender:neutral -Prosody-volume:medium -Content-Type:application/synthesis+ssml -Content-Length:412 - - - - - You have 4 new messages. - The first is from Stephanie Williams - and arrived at - 3:45pm. - - The subject is ski trip - - \ No newline at end of file diff --git a/libs/unimrcp/tests/mrcptest/v1/speakcomplete.msg b/libs/unimrcp/tests/mrcptest/v1/speakcomplete.msg deleted file mode 100644 index 52cadadbec..0000000000 --- a/libs/unimrcp/tests/mrcptest/v1/speakcomplete.msg +++ /dev/null @@ -1,4 +0,0 @@ -//speechsynth -SPEAK-COMPLETE 543260 COMPLETE MRCP/1.0 -Completion-Cause:000 normal - diff --git a/libs/unimrcp/tests/mrcptest/v1/stop.msg b/libs/unimrcp/tests/mrcptest/v1/stop.msg deleted file mode 100644 index 2f44e1f9aa..0000000000 --- a/libs/unimrcp/tests/mrcptest/v1/stop.msg +++ /dev/null @@ -1,3 +0,0 @@ -//speechsynth -STOP 543258 MRCP/1.0 - diff --git a/libs/unimrcp/tests/mrcptest/v2/definegrammar.msg b/libs/unimrcp/tests/mrcptest/v2/definegrammar.msg deleted file mode 100644 index e96d3d3fa7..0000000000 --- a/libs/unimrcp/tests/mrcptest/v2/definegrammar.msg +++ /dev/null @@ -1,30 +0,0 @@ -MRCP/2.0 865 DEFINE-GRAMMAR 543257 -Channel-Identifier:32AECB23433801@speechrecog -Content-Type:application/srgs+xml -Content-ID: -Content-Length:685 - - - - - - - - - - oui - yes - - - - - - may I speak to - - Michel Tremblay - Andre Roy - - - - \ No newline at end of file diff --git a/libs/unimrcp/tests/mrcptest/v2/getparams.msg b/libs/unimrcp/tests/mrcptest/v2/getparams.msg deleted file mode 100644 index 9b02a762ae..0000000000 --- a/libs/unimrcp/tests/mrcptest/v2/getparams.msg +++ /dev/null @@ -1,5 +0,0 @@ -MRCP/2.0 112 GET-PARAMS 543256 -Channel-Identifier:32AECB23433802@speechsynth -Voice-gender: -Voice-variant: - diff --git a/libs/unimrcp/tests/mrcptest/v2/recognitioncomplete.msg b/libs/unimrcp/tests/mrcptest/v2/recognitioncomplete.msg deleted file mode 100644 index e68d28fe01..0000000000 --- a/libs/unimrcp/tests/mrcptest/v2/recognitioncomplete.msg +++ /dev/null @@ -1,20 +0,0 @@ -MRCP/2.0 616 RECOGNITION-COMPLETE 543257 COMPLETE -Channel-Identifier:32AECB23433801@speechrecog -Completion-Cause:000 success -Waveform-URI:;size=342456;duration=25435 -Content-Type:application/nlsml+xml -Content-Length:430 - - - - - - - Andre Roy - - - may I speak to Andre Roy - - \ No newline at end of file diff --git a/libs/unimrcp/tests/mrcptest/v2/recognize.msg b/libs/unimrcp/tests/mrcptest/v2/recognize.msg deleted file mode 100644 index e378491422..0000000000 --- a/libs/unimrcp/tests/mrcptest/v2/recognize.msg +++ /dev/null @@ -1,30 +0,0 @@ -MRCP/2.0 903 RECOGNIZE 543257 -Channel-Identifier:32AECB23433801@speechrecog -Confidence-Threshold:0.9 -Content-Type:application/srgs+xml -Content-ID: -Content-Length:702 - - - - - - - - - - oui - yes - - - - - - may I speak to - - Michel Tremblay - Andre Roy - - - \ No newline at end of file diff --git a/libs/unimrcp/tests/mrcptest/v2/setparams.msg b/libs/unimrcp/tests/mrcptest/v2/setparams.msg deleted file mode 100644 index 02db19e22e..0000000000 --- a/libs/unimrcp/tests/mrcptest/v2/setparams.msg +++ /dev/null @@ -1,5 +0,0 @@ -MRCP/2.0 119 SET-PARAMS 543256 -Channel-Identifier:32AECB23433802@speechsynth -Voice-gender:female -Voice-variant:3 - diff --git a/libs/unimrcp/tests/mrcptest/v2/speak.msg b/libs/unimrcp/tests/mrcptest/v2/speak.msg deleted file mode 100644 index 4c540322e5..0000000000 --- a/libs/unimrcp/tests/mrcptest/v2/speak.msg +++ /dev/null @@ -1,26 +0,0 @@ -MRCP/2.0 732 SPEAK 543257 -Channel-Identifier:32AECB23433802@speechsynth -Voice-gender:neutral -Voice-Age:25 -Prosody-volume:medium -Content-Type:application/ssml+xml -Content-Length:542 - - - -

- You have 4 new messages. - The first is from Stephanie Williams and arrived at - - 0345p. - - The subject is - ski trip - -

-
\ No newline at end of file diff --git a/libs/unimrcp/tests/mrcptest/v2/speakcomplete.msg b/libs/unimrcp/tests/mrcptest/v2/speakcomplete.msg deleted file mode 100644 index 2f1cf96765..0000000000 --- a/libs/unimrcp/tests/mrcptest/v2/speakcomplete.msg +++ /dev/null @@ -1,5 +0,0 @@ -MRCP/2.0 161 SPEAK-COMPLETE 543257 COMPLETE -Channel-Identifier:32AECB23433802@speechsynth -Completion-Cause:000 normal -Speech-Marker:timestamp=857206027059 - diff --git a/libs/unimrcp/tests/mrcptest/v2/stop.msg b/libs/unimrcp/tests/mrcptest/v2/stop.msg deleted file mode 100644 index 003c767cb7..0000000000 --- a/libs/unimrcp/tests/mrcptest/v2/stop.msg +++ /dev/null @@ -1,3 +0,0 @@ -MRCP/2.0 74 STOP 543258 -Channel-Identifier:32AECB23433802@speechsynth - diff --git a/libs/unimrcp/tests/rtsptest/Makefile.am b/libs/unimrcp/tests/rtsptest/Makefile.am deleted file mode 100644 index 0a6f82f231..0000000000 --- a/libs/unimrcp/tests/rtsptest/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -AM_CPPFLAGS = -I$(top_srcdir)/libs/uni-rtsp/include \ - -I$(top_srcdir)/libs/apr-toolkit/include \ - $(UNIMRCP_APR_INCLUDES) - -noinst_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 diff --git a/libs/unimrcp/tests/rtsptest/msg/announce.msg b/libs/unimrcp/tests/rtsptest/msg/announce.msg deleted file mode 100644 index 142f16ce35..0000000000 --- a/libs/unimrcp/tests/rtsptest/msg/announce.msg +++ /dev/null @@ -1,24 +0,0 @@ -ANNOUNCE rtsp://media.server.com/media/synthesizer RTSP/1.0 -CSeq:4 -Session:12345678 -Content-Type:application/mrcp -Content-Length:567 - -SPEAK 543257 MRCP/1.0 -Kill-On-Barge-In:false -Voice-gender:neutral -Prosody-volume:medium -Content-Type:application/synthesis+ssml -Content-Length:412 - - - - - You have 4 new messages. - The first is from Stephanie Williams - and arrived at - 3:45pm. - - The subject is ski trip - - \ No newline at end of file diff --git a/libs/unimrcp/tests/rtsptest/msg/ok.msg b/libs/unimrcp/tests/rtsptest/msg/ok.msg deleted file mode 100644 index b88ac1ca40..0000000000 --- a/libs/unimrcp/tests/rtsptest/msg/ok.msg +++ /dev/null @@ -1,16 +0,0 @@ -RTSP/1.0 200 OK -CSeq:2 -Transport:RTP/AVP;unicast;client_port=46456-46457;server_port=46460-46461 -Session:12345678 -Content-Length:188 -Content-Type:application/sdp - -v=0 -o=- 3211724219 3211724219 IN IP4 10.3.2.88 -s=Media Server -c=IN IP4 0.0.0.0 -t=0 0 -m=audio 46460 RTP/AVP 0 96 -a=rtpmap:0 pcmu/8000 -a=rtpmap:96 telephone-event/8000 -a=fmtp:96 0-15 \ No newline at end of file diff --git a/libs/unimrcp/tests/rtsptest/msg/re-ok.msg b/libs/unimrcp/tests/rtsptest/msg/re-ok.msg deleted file mode 100644 index 2b8dd7503a..0000000000 --- a/libs/unimrcp/tests/rtsptest/msg/re-ok.msg +++ /dev/null @@ -1,6 +0,0 @@ -RTSP/1.0 200 OK -CSeq:3 -Transport:RTP/AVP;unicast;client_port=46456-46457; - server_port=46460-46461;mode=record;ttl=127 -Session:12345678 - diff --git a/libs/unimrcp/tests/rtsptest/msg/re-setup.msg b/libs/unimrcp/tests/rtsptest/msg/re-setup.msg deleted file mode 100644 index 288ef23b30..0000000000 --- a/libs/unimrcp/tests/rtsptest/msg/re-setup.msg +++ /dev/null @@ -1,6 +0,0 @@ -SETUP rtsp://media.server.com/media/recognizer RTSP/1.0 -CSeq:3 -Transport:RTP/AVP;unicast;client_port=46456-46457; - mode=record;ttl=127 -Session:12345678;timeout=200 - diff --git a/libs/unimrcp/tests/rtsptest/msg/setup.msg b/libs/unimrcp/tests/rtsptest/msg/setup.msg deleted file mode 100644 index 1606500258..0000000000 --- a/libs/unimrcp/tests/rtsptest/msg/setup.msg +++ /dev/null @@ -1,16 +0,0 @@ -SETUP rtsp://media.server.com/media/synthesizer RTSP/1.0 -CSeq:2 -Transport:RTP/AVP;unicast;client_port=46456-46457 -Content-Type:application/sdp -Content-Length:188 - -v=0 -o=- 123 456 IN IP4 10.0.0.1 -s=Media Server -p=+1-888-555-1212 -c=IN IP4 0.0.0.0 -t=0 0 -m=audio 0 RTP/AVP 0 96 -a=rtpmap:0 pcmu/8000 -a=rtpmap:96 telephone-event/8000 -a=fmtp:96 0-15 \ No newline at end of file diff --git a/libs/unimrcp/tests/rtsptest/msg/teardown.msg b/libs/unimrcp/tests/rtsptest/msg/teardown.msg deleted file mode 100644 index f673a0ccd8..0000000000 --- a/libs/unimrcp/tests/rtsptest/msg/teardown.msg +++ /dev/null @@ -1,4 +0,0 @@ -TEARDOWN rtsp://media.server.com/media/synthesizer RTSP/1.0 -CSeq:12 -Session:12345678 - diff --git a/libs/unimrcp/tests/rtsptest/msg/ultimate.msg b/libs/unimrcp/tests/rtsptest/msg/ultimate.msg deleted file mode 100644 index bac7ffe683..0000000000 --- a/libs/unimrcp/tests/rtsptest/msg/ultimate.msg +++ /dev/null @@ -1,46 +0,0 @@ -RTSP/1.0 200 OK -CSeq:3 -Transport:RTP/AVP;unicast;client_port=46456-46457; - server_port=46460-46461;mode=record;ttl=127 -Session:12345678 - -SETUP rtsp://media.server.com/media/synthesizer RTSP/1.0 -CSeq:2 -Transport:RTP/AVP;unicast;client_port=46456-46457 -Content-Type:application/sdp -Content-Length:190 - -v=0 -o=- 123 456 IN IP4 10.0.0.1 -s=Media Server -p=+1-888-555-1212 -c=IN IP4 0.0.0.0 -t=0 0 -m=audio 0 RTP/AVP 0 96 -a=rtpmap:0 pcmu/8000 -a=rtpmap:96 telephone-event/8000 -a=fmtp:96 0-15 -ANNOUNCE rtsp://media.server.com/media/synthesizer RTSP/1.0 -CSeq:4 -Session:12345678 -Content-Type:application/mrcp -Content-Length:567 - -SPEAK 543257 MRCP/1.0 -Kill-On-Barge-In:false -Voice-gender:neutral -Prosody-volume:medium -Content-Type:application/synthesis+ssml -Content-Length:412 - - - - - You have 4 new messages. - The first is from Stephanie Williams - and arrived at - 3:45pm. - - The subject is ski trip - - \ No newline at end of file diff --git a/libs/unimrcp/tests/rtsptest/rtsptest.vcproj b/libs/unimrcp/tests/rtsptest/rtsptest.vcproj deleted file mode 100644 index 6051b862bd..0000000000 --- a/libs/unimrcp/tests/rtsptest/rtsptest.vcproj +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/tests/rtsptest/rtsptest.vcxproj b/libs/unimrcp/tests/rtsptest/rtsptest.vcxproj deleted file mode 100644 index 5f0b4546fc..0000000000 --- a/libs/unimrcp/tests/rtsptest/rtsptest.vcxproj +++ /dev/null @@ -1,125 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {17A33F3F-BAF5-403F-8EF4-FECDA7D9A335} - rtsptest - - - - Application - - - Application - - - Application - - - Application - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - unirtsp.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - - - - - unirtsp.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - X64 - - - ProgramDatabase - - - unirtsp.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - - - - - X64 - - - unirtsp.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - - - - - {504b3154-7a4f-459d-9877-b951021c3f1f} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/tests/rtsptest/rtsptest.vcxproj.filters b/libs/unimrcp/tests/rtsptest/rtsptest.vcxproj.filters deleted file mode 100644 index 62dd2c5691..0000000000 --- a/libs/unimrcp/tests/rtsptest/rtsptest.vcxproj.filters +++ /dev/null @@ -1,21 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - - - src - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/tests/rtsptest/src/main.c b/libs/unimrcp/tests/rtsptest/src/main.c deleted file mode 100644 index df5bad58fd..0000000000 --- a/libs/unimrcp/tests/rtsptest/src/main.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: 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; -} diff --git a/libs/unimrcp/tests/rtsptest/src/parse_gen_suite.c b/libs/unimrcp/tests/rtsptest/src/parse_gen_suite.c deleted file mode 100644 index 136ded899b..0000000000 --- a/libs/unimrcp/tests/rtsptest/src/parse_gen_suite.c +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: parse_gen_suite.c 2249 2014-11-19 05:26:24Z achaloyan@gmail.com $ - */ - -#include -#include -#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; -} diff --git a/libs/unimrcp/tests/sipp/mrcp_uac_multi b/libs/unimrcp/tests/sipp/mrcp_uac_multi deleted file mode 100644 index 5b2cbdab87..0000000000 --- a/libs/unimrcp/tests/sipp/mrcp_uac_multi +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - - - ;tag=[call_number] - To: sut - 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 - - ]]> - - - - - - - - - - - - - - - - - - ;tag=[call_number] - To: sut [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 - - ]]> - - - - - - - - - ;tag=[call_number] - To: sut [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 - - ]]> - - - - - - - - - - - - diff --git a/libs/unimrcp/tests/sipp/mrcp_uac_recog b/libs/unimrcp/tests/sipp/mrcp_uac_recog deleted file mode 100644 index 13ea1f4448..0000000000 --- a/libs/unimrcp/tests/sipp/mrcp_uac_recog +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - - - ;tag=[call_number] - To: sut - 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 - - ]]> - - - - - - - - - - - - - - - - - - ;tag=[call_number] - To: sut [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 - - ]]> - - - - - - - - - ;tag=[call_number] - To: sut [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 - - ]]> - - - - - - - - - - - - diff --git a/libs/unimrcp/tests/sipp/mrcp_uac_synth b/libs/unimrcp/tests/sipp/mrcp_uac_synth deleted file mode 100644 index 627c8894db..0000000000 --- a/libs/unimrcp/tests/sipp/mrcp_uac_synth +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - - - ;tag=[call_number] - To: sut - 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 - - ]]> - - - - - - - - - - - - - - - - - - ;tag=[call_number] - To: sut [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 - - ]]> - - - - - - - - - ;tag=[call_number] - To: sut [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 - - ]]> - - - - - - - - - - - - diff --git a/libs/unimrcp/tests/sipp/mrcp_uac_unknown b/libs/unimrcp/tests/sipp/mrcp_uac_unknown deleted file mode 100644 index 190d924491..0000000000 --- a/libs/unimrcp/tests/sipp/mrcp_uac_unknown +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - - - ;tag=[call_number] - To: sut - 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 - - ]]> - - - - - - - - - - - - - - - - - - ;tag=[call_number] - To: sut [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 - - ]]> - - - - - - - - - ;tag=[call_number] - To: sut [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 - - ]]> - - - - - - - - - - - - diff --git a/libs/unimrcp/tests/sipp/mrcp_uac_update b/libs/unimrcp/tests/sipp/mrcp_uac_update deleted file mode 100644 index da91fee311..0000000000 --- a/libs/unimrcp/tests/sipp/mrcp_uac_update +++ /dev/null @@ -1,179 +0,0 @@ - - - - - - - - - ;tag=[call_number] - To: sut - 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 - - ]]> - - - - - - - - - - - - - - - - - - ;tag=[call_number] - To: sut [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 - - ]]> - - - - - - - - - - ;tag=[call_number] - To: sut - 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 - - ]]> - - - - - - - - - - - - - - - - - - ;tag=[call_number] - To: sut [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 - - ]]> - - - - - - - - - - ;tag=[call_number] - To: sut [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 - - ]]> - - - - - - - - - - - - diff --git a/libs/unimrcp/tests/sipp/mrcp_uas_recog b/libs/unimrcp/tests/sipp/mrcp_uas_recog deleted file mode 100644 index 27bc361a5d..0000000000 --- a/libs/unimrcp/tests/sipp/mrcp_uas_recog +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - ]]> - - - - - - - - - - - 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 - - ]]> - - - - - - - - - - - Content-Length: 0 - - ]]> - - - - - - - - - - - - - - diff --git a/libs/unimrcp/tests/sipp/mrcp_uas_reject b/libs/unimrcp/tests/sipp/mrcp_uas_reject deleted file mode 100644 index 5f6af6b117..0000000000 --- a/libs/unimrcp/tests/sipp/mrcp_uas_reject +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - Content-Length: 0 - ]]> - - - - - - - - - - - - diff --git a/libs/unimrcp/tests/sipp/mrcp_uas_synth b/libs/unimrcp/tests/sipp/mrcp_uas_synth deleted file mode 100644 index b2400aaddd..0000000000 --- a/libs/unimrcp/tests/sipp/mrcp_uas_synth +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - ]]> - - - - - - - - - - - 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 - - ]]> - - - - - - - - - - - Content-Length: 0 - - ]]> - - - - - - - - - - - - - - diff --git a/libs/unimrcp/tests/sipp/mrcp_uas_unknown b/libs/unimrcp/tests/sipp/mrcp_uas_unknown deleted file mode 100644 index e3a1b1e50d..0000000000 --- a/libs/unimrcp/tests/sipp/mrcp_uas_unknown +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - ]]> - - - - - - - - - - - Content-Length: 0 - - ]]> - - - - - - - - - - - - - - diff --git a/libs/unimrcp/tests/strtablegen/Makefile.am b/libs/unimrcp/tests/strtablegen/Makefile.am deleted file mode 100644 index 5ffb011dc7..0000000000 --- a/libs/unimrcp/tests/strtablegen/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -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 diff --git a/libs/unimrcp/tests/strtablegen/src/main.c b/libs/unimrcp/tests/strtablegen/src/main.c deleted file mode 100644 index ef82abc796..0000000000 --- a/libs/unimrcp/tests/strtablegen/src/main.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Id: main.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include -#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; ivalue,&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; ivalue.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; -} diff --git a/libs/unimrcp/tests/strtablegen/stringtable.in b/libs/unimrcp/tests/strtablegen/stringtable.in deleted file mode 100644 index 7f045949cd..0000000000 --- a/libs/unimrcp/tests/strtablegen/stringtable.in +++ /dev/null @@ -1,12 +0,0 @@ -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 diff --git a/libs/unimrcp/tests/strtablegen/strtablegen.vcproj b/libs/unimrcp/tests/strtablegen/strtablegen.vcproj deleted file mode 100644 index 72d6686182..0000000000 --- a/libs/unimrcp/tests/strtablegen/strtablegen.vcproj +++ /dev/null @@ -1,292 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/tests/strtablegen/strtablegen.vcxproj b/libs/unimrcp/tests/strtablegen/strtablegen.vcxproj deleted file mode 100644 index 11845bbc67..0000000000 --- a/libs/unimrcp/tests/strtablegen/strtablegen.vcxproj +++ /dev/null @@ -1,124 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {79EF9F1D-E211-4ED1-91D2-FC935AB3A872} - strtablegen - - - - Application - - - Application - - - Application - - - Application - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - - - - - aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - X64 - - - ProgramDatabase - - - aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - - - - - X64 - - - aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - - - - {13deeca0-bdd4-4744-a1a2-8eb0a44df3d2} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/tests/strtablegen/strtablegen.vcxproj.filters b/libs/unimrcp/tests/strtablegen/strtablegen.vcxproj.filters deleted file mode 100644 index 3efc5f63ae..0000000000 --- a/libs/unimrcp/tests/strtablegen/strtablegen.vcxproj.filters +++ /dev/null @@ -1,18 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/unimrcp-2010.sln b/libs/unimrcp/unimrcp-2010.sln deleted file mode 100644 index 957d126a62..0000000000 --- a/libs/unimrcp/unimrcp-2010.sln +++ /dev/null @@ -1,358 +0,0 @@ - -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 diff --git a/libs/unimrcp/unimrcp.sln b/libs/unimrcp/unimrcp.sln deleted file mode 100644 index 10b74f6232..0000000000 --- a/libs/unimrcp/unimrcp.sln +++ /dev/null @@ -1,447 +0,0 @@ - -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 diff --git a/src/include/switch.h b/src/include/switch.h index 8bfd15a3f6..68c20044c5 100644 --- a/src/include/switch.h +++ b/src/include/switch.h @@ -188,9 +188,6 @@ * mod_pocketsphinx * - PocketSphinx (http://www.speech.cs.cmu.edu/pocketsphinx/) * - * mod_unimrcp - * - MRCP (http://www.unimrcp.org/) - * * * Codecs * mod_amr diff --git a/src/mod/.gitignore b/src/mod/.gitignore index 056bfb1fe2..90608ed1ed 100644 --- a/src/mod/.gitignore +++ b/src/mod/.gitignore @@ -27,9 +27,6 @@ /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 diff --git a/src/mod/Makefile.am b/src/mod/Makefile.am index 4225ec7fd9..325e8e81d7 100644 --- a/src/mod/Makefile.am +++ b/src/mod/Makefile.am @@ -9,7 +9,6 @@ check: $(OUR_CHECK_MODULES) 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 diff --git a/src/mod/asr_tts/mod_unimrcp/Makefile.am b/src/mod/asr_tts/mod_unimrcp/Makefile.am deleted file mode 100644 index 6f144744fe..0000000000 --- a/src/mod/asr_tts/mod_unimrcp/Makefile.am +++ /dev/null @@ -1,44 +0,0 @@ -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) diff --git a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.2017.vcxproj b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.2017.vcxproj deleted file mode 100644 index ad2634981f..0000000000 --- a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.2017.vcxproj +++ /dev/null @@ -1,205 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - mod_unimrcp - {D07C378A-F5F7-438F-ADF3-4AC4FB1883CD} - mod_unimrcp - Win32Proj - - - - DynamicLibrary - MultiByte - $(DefaultPlatformToolset) - - - DynamicLibrary - MultiByte - $(DefaultPlatformToolset) - - - DynamicLibrary - MultiByte - $(DefaultPlatformToolset) - - - DynamicLibrary - MultiByte - $(DefaultPlatformToolset) - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(Configuration)\ - $(Platform)\$(Configuration)\ - - - - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) - - - - - $(SolutionDir)Debug/bin;%(AdditionalLibraryDirectories) - false - - - - - - - X64 - - - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) - - - - - $(SolutionDir)$(PlatformName)\$(Configuration)\;%(AdditionalLibraryDirectories) - false - - - MachineX64 - - - - - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) - - - - - $(SolutionDir)Release/bin;%(AdditionalLibraryDirectories) - false - - - - - - - X64 - - - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) - - - - - $(SolutionDir)$(PlatformName)\$(Configuration)\;%(AdditionalLibraryDirectories) - false - - - MachineX64 - - - - - CompileAsC - CompileAsC - CompileAsC - CompileAsC - - - - - {13deeca0-bdd4-4744-a1a2-8eb0a44df3d2} - false - - - {b5a00bfa-6083-4fae-a097-71642d6473b5} - false - - - {72782932-37cc-46ae-8c7f-9a7b1a6ee108} - false - - - {12a49562-bab9-43a3-a21d-15b60bbb4c31} - false - - - {a9edac04-6a5f-4ba7-bc0d-cce7b255b6ea} - false - - - {1c320193-46a6-4b34-9c56-8ab584fc1b56} - false - - - {504b3154-7a4f-459d-9877-b951021c3f1f} - false - - - {746f3632-5bb2-4570-9453-31d6d58a7d8e} - false - - - {deb01acb-d65f-4a62-aed9-58c1054499e9} - false - - - {f057da7f-79e5-4b00-845c-ef446ef055e3} - false - - - {f6c55d93-b927-4483-bb69-15aef3dd2dff} - false - - - {df018947-0fff-4eb3-bdee-441dc81da7a4} - - - {70a49bc2-7500-41d0-b75d-edcc5be987a0} - - - {202d7a4e-760d-4d0e-afa1-d7459ced30ff} - false - - - - - - \ No newline at end of file diff --git a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c deleted file mode 100644 index a89329f4b5..0000000000 --- a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c +++ /dev/null @@ -1,4631 +0,0 @@ -/* - * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2009-2015, Anthony Minessale II - * - * 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 - * - * Portions created by the Initial Developer are Copyright (C) - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Brian West - * Christopher M. Rienzo - * Luke Dashjr (OpenMethods, LLC) - * - * Maintainer: Christopher M. Rienzo - * - * mod_unimrcp.c -- UniMRCP module (MRCP client) - * - */ -#include - -/* 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 " 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, " 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: - */ diff --git a/src/mod/asr_tts/mod_unimrcp/unimrcp.props b/src/mod/asr_tts/mod_unimrcp/unimrcp.props deleted file mode 100644 index 6f304ae5f0..0000000000 --- a/src/mod/asr_tts/mod_unimrcp/unimrcp.props +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - $(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) - MRCP_STATIC_LIB;MPF_STATIC_LIB;APT_STATIC_LIB;%(PreprocessorDefinitions) - - - \ No newline at end of file diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/rayo.conf.xml b/src/mod/event_handlers/mod_rayo/conf/autoload_configs/rayo.conf.xml index e5191909cb..9f525c597c 100644 --- a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/rayo.conf.xml +++ b/src/mod/event_handlers/mod_rayo/conf/autoload_configs/rayo.conf.xml @@ -277,36 +277,6 @@ ]]>
- - - - yesno - ]]]]> - - - ]]> - - - - - yesno - ]]]]> - - - ]]> -