Skip to main content

dTelecom RTC for Python

Join a dTelecom room from a Python process, receive remote audio as PCM16, and publish audio or room data. Supply a participant grant from your backend. Its response includes the signaling URL, token and ranked fallback URLs. Room connections

Install on Python 3.11 or later.

python -m pip install dtelecom-rtc
import asyncio
from contextlib import aclosing, closing

from dtelecom_rtc import AudioSource, Room

async def echo(grant, finished):
    with closing(AudioSource(sample_rate=16000)) as source:
        async with asyncio.TaskGroup() as writers, Room() as room:
            forwarding = {}

            async def forward(track):
                async with aclosing(track.stream(sample_rate=16000)) as frames:
                    async for frame in frames:
                        await source.capture_frame(frame)

            @room.on("track_subscribed")
            def subscribed(track, publication, participant):
                forwarding[track] = writers.create_task(forward(track))

            @room.on("track_unsubscribed")
            def unsubscribed(track, publication, participant):
                if task := forwarding.pop(track, None):
                    task.cancel()

            await room.connect(grant.ws_url, grant.token, fallback_urls=grant.fallback_urls)
            await room.publish_audio("echo", source)
            await finished.wait()

Use a distinct identity for each participant. Set auto_subscribe=False to choose remote tracks explicitly with set_subscribed. Register event handlers before joining to include publications already present in the room. A data_received handler receives payload bytes, the sender when known, the delivery kind and topic. publish_data accepts a string or bytes, optional topic and destination participant SIDs, and reliable or lossy delivery.

The SDK tries the issuer's ranked endpoints with the same grant after a transport failure. When extending a grant through Cloud, call room.update_connection_token(token, fallback_urls) so the room uses the refreshed credentials after a reconnect. Use disconnect() or exit the async context to leave.

Configure SDK log levels using Python's standard logging.getLogger("dtelecom_rtc").setLevel(...). Use AudioFrame.duration, samples_per_channel, and the resample, downsample and upsample helpers for standalone PCM. create_text_message, encode_data_packet and decode_data_packet expose the fork's room-data format. The protocol message models and enums are exported from dtelecom_rtc.models.

For a live interoperability check, install Playwright and use the ESM bundle of @dtelecom/livekit-client@1.13.0. Set DTELECOM_API_KEY, DTELECOM_API_SECRET, DTELECOM_CLOUD_URL and DTELECOM_BROWSER_MODULE, then run python tests/integration/browser_call.py. The script creates a disposable room and uses synthetic audio. Add --recovery to test a grant with three ranked nodes and reconnect the Python publisher. CHROME_EXECUTABLE selects a local browser when needed.

On transport loss, room.state becomes "reconnecting" and the room emits reconnecting before releasing remote tracks and participants. A service can keep per-speaker state through that teardown, then reconcile the identities present at reconnected. A terminal disconnected ends the session.

Metadata

Release files for dtelecom-rtc 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dtelecom-rtc 0.1.1
File Size Uploaded Provenance Actions
dtelecom_rtc-0.1.1.tar.gz 28.1 kB With provenance Details for dtelecom_rtc-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dtelecom-rtc 0.1.1
File Interpreter ABI Platform Actions
dtelecom_rtc-0.1.1-py3-none-any.whl Python 3 none any Details for dtelecom_rtc-0.1.1-py3-none-any.whl

Total release size: 51.0 kB

Release files / dtelecom_rtc-0.1.1.tar.gz

Download URL dtelecom_rtc-0.1.1.tar.gz
Size 28.1 kB
Tags Source
SHA-256 checksum
How to use checksums
754d18e4e7085de96ec40674968f41cb4b80f6f4879d118c5964f91c89246445
BLAKE2b-256 checksum
How to use checksums
3c0ca236e5a16c8023eb019843c1815d668e71d66b216ae0fe384624628bcaaf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / dtelecom_rtc-0.1.1-py3-none-any.whl

Download URL dtelecom_rtc-0.1.1-py3-none-any.whl
Size 23.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2e33ea11be712180c8c2758c092870d4415e0be5730bc8c2c0c12c5f7a2f43ef
BLAKE2b-256 checksum
How to use checksums
81472ff6faa1b4e531a7648fc1d6781c9a883ffc8f19a9940d782a699d8f9899
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Security for dtelecom-rtc 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for dtelecom_rtc-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page