How unispeech/unimrcp works
Project Type and Purpose
• UniMRCP is an open‑source, C‑based protocol stack and toolkit implementing MRCPv1/v2 (Media Resource Control Protocol).
• It provides a layered, extensible framework for building MRCP clients, servers, media engines (ASR/TTS), and transport/signaling modules (SIP, RTSP).
File‑Structure Analysis
• Top‑level build system (Autotools/CMake): configure.ac, CMakeLists.txt, Makefile.am, build/, acinclude.m4, etc.
• Core libraries under libs/:
• apr-toolkit: abstraction and utility layer (based on Apache Portable Runtime).
• mpf: media processing framework (codecs, RTP, mixer, resampler).
• mrcp*: protocol stack split into control, message, resources, signaling, transport.
• mrcp-client, mrcp-server: client and server API layers.
• mrcp-engine: engine management, state machines, plugin loader.
• mrcpv2-transport, uni-rtsp: transport modules for MRCPv2 over SIP or RTSP.
• Extension points:
• modules/: protocol adapters (Sofia-SIP, Uni-RTSP).
• plugins/: sample engines (demo‑recog, demo‑synth, demo‑verifier, mrcp‑recorder).
• Platforms/binaries:
• platforms/umc: a unified media client console (C++).
• platforms/unimrcp-client, unimrcp-server, asr-client, libraries (libunimrcp-client, libunimrcp-server, libasr-client).
• Configuration and scenarios: conf/ holds XML profiles, scenarios, XSDs.
• Data and tests: data/ (sample audio/grammar), tests/ (unit/integration suites, SIPp scenarios).
• Documentation: Doxygen (docs/dox), UML/design (docs/ea).
README Insights
• Confirms MRCPv1/v2 compliance, links to Doxygen and UML docs, and build/install instructions in INSTALL.
• Emphasizes extensibility and community resources.
a. Main Components (layered view):
• Foundation Layer: APR Toolkit (memory, threading, logging).
• Media Layer: MPF (audio codecs, RTP handling, mixing).
• Protocol Layer: MRCP Core split into:
• Control (resource/factory/stream API)
• Message (header/line parsing)
• Resources (recog/synth/recorder/verifier headers)
• Engine Layer: MRCP‑Engine (engine factory, state machines, plugin loader)
• Signaling/Transport Layer:
• MRCP-Signaling (session descriptor, agent)
• MRCPv2-Transport (SIP/RTSP channels)
• API Layer: mrcp-client and mrcp-server libraries
• Application Layer: Binaries (unimrcp-client, unimrcp-server, umc, asr-client)
• Extension Modules/Plugins: modules/mrcp-sofiasip, modules/mrcp-unirtsp, plugins/*
b. Relationships & Interactions:
• Binaries link against API Layer → which calls into Protocol, Engine, Media, Foundation.
• MRCP commands flow: Application → Client API → Protocol Control → Engine → MPF (media) → Transport → Network.
• Transport passes MRCP messages to remote servers or engines via SIP/RTSP; responses traverse back up.
• Engine plugins (plugins/*) are loaded by MRCP‑Engine at runtime.
• Configuration (conf/*.xml) drives session setup, resource profiles, and scenario behavior.
c. Architectural Patterns & Principles:
• Layered architecture with clear separation of concerns (Foundation → Media → Protocol → Signaling/Transport → Application).
• Plugin architecture for media engines and protocol adapters, enabling runtime extensibility.
• Use of factory and state‑machine patterns in the MRCP‑Engine layer.
• Build portability via APR and Autotools/CMake abstraction.
d. Key Technologies & Frameworks:
• C89/C99 codebase, Apache Portable Runtime (APR)
• Autotools and CMake build scripts, Visual Studio project files for Windows.