Metadata-Version: 2.5
Name: ragleap-phone
Version: 0.1.0
Summary: Media layer for phone calls over RTP (G.711): frames, resampling, RTP packets and a one-call UDP endpoint. Pre-alpha: no SIP signalling, never tried against a real PBX or trunk.
Project-URL: Homepage, https://github.com/ragleap/ragleap-core
Project-URL: Repository, https://github.com/ragleap/ragleap-core
Project-URL: Issues, https://github.com/ragleap/ragleap-core/issues
Project-URL: Documentation, https://github.com/ragleap/ragleap-core/tree/main/packages/ragleap-phone/docs
Author-email: Antony <antony@ragleap.com>
License-Expression: MIT
License-File: LICENSE
Keywords: open-source,sip,telephony,voice
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.10
Provides-Extra: test
Requires-Dist: pytest>=8.0.0; extra == 'test'
Description-Content-Type: text/markdown

# ragleap-phone

**Status: pre-alpha, version 0.1.0. A media library, not a phone product.** It handles the audio of one call over RTP once something else (a PBX, a SIP server) has set the call up. It does not place or answer calls by itself, and it has never been tried against a real PBX or trunk.

## What it has

Standard library only, no runtime dependencies, Python 3.10 or newer:

- `Frame`, a frozen audio frame (16-bit PCM, mono) that carries its own sample rate and timestamp.
- `Resampler`: 16 kHz to and from 8 kHz and 48 kHz (windowed-sinc filters copied from ragleap-voice, checked against them by a test).
- G.711 mu-law and A-law, and the inbound and outbound audio paths built on them. The mu-law encoder and the A-law tables are not verified against the standard.
- RTP packet parsing and building for G.711 (static payload types 0 and 8) with a receiver that handles reordering, loss gaps and sequence restarts by fixed rules.
- `RtpMediaEndpoint`: one call over UDP. It listens on 127.0.0.1 unless the operator opts in to another address, and the operator supplies the expected remote address. Rate limit, idle timeout (10 s) and maximum call length are built in. No audio, payload, number or address is logged.
- Receiving DTMF (RFC 4733), off by default and without integrity: do not use it for PINs.
- The adapter interfaces (`Adapter`, `Call`, `Capabilities`, `Event`) that a signalling backend would implement. No backend exists yet.

## What it does not have

SIP signalling (hangup() ends only our media), several calls at once, sending DTMF, SRTP, RTCP, a jitter buffer, any backend adapter (Asterisk, jambonz, LiveKit, WebSocket) and Twilio behind the adapter. Media is not encrypted or authenticated. Emergency calling will never be supported.

## Evidence

- 245 unit tests pass with 1 skipped (fakes and loopback sockets only).
- One run against Asterisk 22.12.0 on loopback with a synthetic tone, the UnicastRTP route only, one run per case. Details and limits: docs/design/real-traffic-test-asterisk.md in the repository.
- Not tested: a real PBX or trunk, packet loss, jitter, hang-up from the signalling side, SRTP, the externalMedia route, real calls of any length.
- For speech recognition on telephone-quality audio, ragleap-voice has simulated measurements only: an 8 kHz mu-law path alone cost no measurable accuracy on clean read speech, while noise together with that path did.

## More

The goal is phone calls for RagLeap without Twilio, as independent of any single provider as possible. Speech stays in ragleap-voice. The plan, decisions and conventions are in docs/HANDOVER.md and docs/design/media-release-plan.md in the repository (packages/ragleap-phone at github.com/ragleap/ragleap-core). The call for contributors, country by country, is issue 814 in the ragleap-core repository.
