Dmytro Bogovych c8d9bad845 - replace the LGPL G.722 codec with Asterisk's public-domain copy
The previous src/libs/g722 was spandsp's G.722 offered only under GPL-2 or
LGPL-2.1. That blocks shipping rtphone statically linked in a closed binary
(the freeware VQ for Asterisk engine) without a relink offer. Asterisk's
codecs/g722 is the same code: Steve Underwood placed his contributions in the
public domain there, and the CMU 1993 code under it is "completely
unrestricted" for any use. src/libs/g722/README.md records the provenance and
both statements.

It also fixes the decoded level. Asterisk's copy halves the encoder input and
doubles the decoder output, so streams from Asterisk and ffmpeg decode at
their original level. The old copy decoded them 6 dB too quiet (ITU-convention
streams from pjmedia 12 dB), and its encoder clipped input above -6 dBFS.

Local changes to Asterisk's files:
- the decoder saturates its output instead of casting. Asterisk's cast wraps:
  259 samples in 11 s of speech peaking at -0.2 dBFS came out with the
  opposite sign;
- g722.h includes <stdint.h> and maps __inline__ for MSVC (the removed
  g722_inttypes.h used to).
Dropped: g722_bitstream.*, g722codec.c and three helper headers, none used.
The API is unchanged (g722_encode_init / g722_decode, same options).

Measured in vq-core (16 simultaneous replayed calls, NISQA speech):
- G.711 control calls score identically;
- normal-level G.722: SilentCall -0.09..-0.14, DeadAir-01 -0.06..-0.09, MOS
  unchanged;
- loud G.722 with a clipped source now shows AmpClipping 0.02-0.03 and MOS
  3.89/4.28 instead of 4.45: the codec overshoots on the clipped peaks at the
  correct level, which the old -6 dB hid;
- results are identical across runs (the old decoder varied by up to 0.30 MOS).

G.722 still loses about 44% of its packets in AudioReceiver because
G722Codec::info() reports an 8 kHz sample rate for 16 kHz audio. That is fixed
separately.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-21 17:54:18 +02:00
2026-09-03 10:30:22 +03:00
2026-01-06 12:50:51 +03:00
2026-07-17 14:44:27 +03:00
2022-10-16 17:08:57 +03:00

RTPhone Platform

RTPhone is a comprehensive real-time communication (RTC) platform that provides a complete software stack for building VoIP/SIP-based communication applications. Developed by VoIP Objects (Sevana), RTPhone delivers production-ready voice communication capabilities with extensive codec support and cross-platform compatibility.

Overview

RTPhone serves as a static library (librtphone.a) that can be integrated into larger telephony and communication systems. It provides a JSON-based command interface for easy integration and control, making it suitable for building softphones, PBX systems, WebRTC gateways, and carrier-grade voice solutions.

Key Features

Audio Codec Support

RTPhone supports an extensive range of audio codecs:

Standard Codecs:

  • G.711 (A-law/¼-law)
  • G.722 (16kHz wideband)
  • G.729
  • GSM (Full Rate, Half Rate, Enhanced Full Rate)
  • iLBC (20ms/30ms)
  • ISAC (16kHz/32kHz)

Advanced Codecs:

  • AMR-NB/AMR-WB (Adaptive Multi-Rate Narrowband/Wideband) - please be aware - there is no patents for AMR codecs usage included ! You should acquire them on your own.
  • EVS (Enhanced Voice Services) - 3GPP's latest codec. Again - please be aware - there is no patents for EVS codec usage included ! You should acquire them on your own.
  • Opus - Modern low-latency codec
  • Speex (with acoustic echo cancellation)

Codec Features:

  • Bandwidth-efficient and octet-aligned modes
  • IuUP (Iu User Plane) protocol support for 3G networks
  • Dynamic codec switching
  • Packet loss concealment (PLC)
  • Comfort noise generation (CNG)

Network & Protocol Support

SIP Features:

  • Full SIP 2.0 implementation via reSIProcate
  • Multiple transport protocols (UDP, TCP, TLS)
  • Registration, authentication, and session management
  • SIP MESSAGE, presence, and REFER support

Media Transport:

  • RTP/RTCP for media streaming
  • SRTP for secure media
  • ICE for NAT traversal with STUN/TURN support
  • WebRTC integration components
  • IPv4 and IPv6 support

Cross-Platform Audio Support

  • DirectSound/WMME (Windows)
  • Core Audio (macOS/iOS)
  • ALSA/PulseAudio (Linux)
  • Oboe (Android) for low-latency audio
  • PortAudio fallback support

Audio Quality Features

  • 48kHz sample rate support
  • Acoustic Echo Cancellation (AEC)
  • Audio resampling and format conversion
  • Multi-channel audio mixing
  • Perceptual Voice Quality Assessment (PVQA)

Architecture

The platform is organized into several core modules:

  • Engine/Agent: JSON-based command interface
  • Engine/Endpoint: SIP user agent implementation
  • Engine/Media: Audio codec management and processing
  • Engine/Audio: Cross-platform audio I/O handling
  • Engine/Helper: Utility functions (networking, logging, threading)

Supported Platforms

  • Linux (x64, ARM/Raspberry Pi)
  • Windows (32/64-bit)
  • macOS
  • Android (with Oboe integration)
  • iOS

Building

RTPhone uses a CMake-based build system with cross-compilation support:

Linux

python3 build_linux.py

Android

python3 build_android.py
# or
./build_android.sh

Dependencies

  • CMake 3.10+
  • OpenSSL 1.1+
  • Boost libraries
  • Platform-specific audio libraries

Recent Updates

Recent development has focused on:

  • AMR codec parsing and decoding improvements
  • Octet-aligned mode fixes for AMR-WB
  • RTP SSRC handling enhancements
  • Build system optimizations
  • Code modernization to C++20

Use Cases

RTPhone is good for building:

  • VoIP softphones and mobile applications
  • PBX and telephony server systems
  • RTP proxies
  • Carrier-grade voice communication platforms
  • 3GPP/IMS-compliant systems

Security

RTPhone includes comprehensive security features:

  • OpenSSL 1.1 integration for encryption
  • TLS transport layer security
  • SRTP media encryption
  • Certificate management support

Integration

The platform provides a developer-friendly interface with:

  • Event-driven architecture
  • Comprehensive logging system
  • Modern C++20 codebase

For detailed integration instructions and API documentation, please refer to the source code and header files in the /src/engine/ directory.

License

Our source code is licensed under the MPL license. Naturally, any third-party components we use are subject to their respective licenses.

S
Description
No description provided
Readme 129 MiB
Languages
C++ 49.7%
C 42.7%
Makefile 1.3%
C# 1.3%
Shell 1.2%
Other 3%