Skip to main content

tgcalls
Voice chats, private incoming and outgoing calls in Telegram for Developers
Examples • Documentation • Channel • Chat

Telegram WebRTC (VoIP)

from pyrogram import Client, filters
from pyrogram.utils import MAX_CHANNEL_ID

from pytgcalls import GroupCall

app = Client('pytgcalls')
group_call = GroupCall(app, 'input.raw')


@group_call.on_network_status_changed
async def on_network_changed(gc: GroupCall, is_connected: bool):
    chat_id = MAX_CHANNEL_ID - gc.full_chat.id
    if is_connected:
        await app.send_message(chat_id, 'Successfully joined!')
    else:
        await app.send_message(chat_id, 'Disconnected from voice chat..')


@app.on_message(filters.outgoing & filters.command('join'))
async def join(_, message):
    await group_call.start(message.chat.id)


app.run()

This project consists of two main parts: tgcalls, pytgcalls. The first is a C++ Python extension. The second uses the extension along with Pyrogram. All together, it allows you to create userbots that can record and broadcast in voice chats, make and receive private calls.

Features

Requirements

  • Python 3.6 or higher.
  • A Telegram API key.
  • x86_64 platform and Unix system (WSL for Windows).

TODO list

  • Incoming and Outgoing calls (already there and working, but not in release).
  • Private and group video calls.
  • Windows and macOS Python wheels and more...

Installing

pip3 install pytgcalls -U

tgcalls
PyPi • Sources

tgcalls

The first part of the project is C++ extensions for Python. Pybind11 was used to write it. Binding occurs to the tgcalls library by Telegram, which is used in all clients. To implement the library, the code of official clients (tdesktop and android) was studied. Changes have been made to the Telegram library. All modified code is available as a subtree in this repository. The main idea of the changes is to add the ability to play from other sources (from a file, for example) and improve the sound quality by making the minimum number of code edits for a simple update. In addition to changes in the Telegram library, a minimal change was made to the WebRTC, also available as a subtree.

How to build

Also you can investigate into manylinux builds.

Documentation

Temporarily, instead of documentation, you can use an example along with MTProto.


pytgcalls
Documentation • PyPi • Sources

pytgcalls

This project is implementation of using tgcalls Python binding together with MTProto. A Pyrogram was chosen as a library for working with Telegram Mobile Protocol. You can write your own implementation to work with Telethon or other libraries.

Learning by example

Visit this page to discover the official examples.

Documentation

pytgcalls's documentation lives at tgcalls.org.

Audio file formats

RAW files are now used. You will have to convert to this format yourself using ffmpeg. This procedure may become easier in the future.

From mp3 to raw (to play in voice chat):

ffmpeg -i input.mp3 -f s16le -ac 2 -ar 48000 -acodec pcm_s16le input.raw

From raw to mp3 (files with recordings):

ffmpeg -f s16le -ac 2 -ar 48000 -acodec pcm_s16le -i output.raw clear_output.mp3

For playout live stream you can use this one:

ffmpeg -y -i http://stream2.cnmns.net/hope-mp3 -f s16le -ac 2 -ar 48000 -acodec pcm_s16le input.raw

For YouTube videos and live streams you can use youtube-dl:

ffmpeg -i "$(youtube-dl -x -g "https://youtu.be/xhXq9BNndhw")" -f s16le -ac 2 -ar 48000 -acodec pcm_s16le input.raw

And set input.raw as input filename.


Getting help

You can get help in several ways:

Contributing

Contributions of all sizes are welcome.

Special thanks to

License

You may copy, distribute and modify the software provided that modifications are described and licensed for free under LGPL-3. Derivatives works (including modifications or anything statically linked to the library) can only be redistributed under LGPL-3, but applications that use the library don't have to be.

Metadata

Release files for tgcalls 0.0.12

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

Built distributions (wheels)

Table of built distributions (wheels) for tgcalls 0.0.12
File Actions
tgcalls-0.0.12-cp39-cp39-manylinux2014_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64 Details for tgcalls-0.0.12-cp39-cp39-manylinux2014_x86_64.whl
tgcalls-0.0.12-cp39-cp39-manylinux2014_aarch64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ ARM64 Details for tgcalls-0.0.12-cp39-cp39-manylinux2014_aarch64.whl
tgcalls-0.0.12-cp39-cp39-macosx_11_0_arm64.whl CPython 3.9 CPython 3.9 macOS 11.0+ ARM64 Details for tgcalls-0.0.12-cp39-cp39-macosx_11_0_arm64.whl
tgcalls-0.0.12-cp39-cp39-macosx_10_12_x86_64.whl CPython 3.9 CPython 3.9 macOS 10.12+ x86-64 Details for tgcalls-0.0.12-cp39-cp39-macosx_10_12_x86_64.whl
tgcalls-0.0.12-cp38-cp38-manylinux2014_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.17+ x86-64 Details for tgcalls-0.0.12-cp38-cp38-manylinux2014_x86_64.whl
tgcalls-0.0.12-cp38-cp38-manylinux2014_aarch64.whl CPython 3.8 CPython 3.8 Linux glibc 2.17+ ARM64 Details for tgcalls-0.0.12-cp38-cp38-manylinux2014_aarch64.whl
tgcalls-0.0.12-cp38-cp38-macosx_10_12_x86_64.whl CPython 3.8 CPython 3.8 macOS 10.12+ x86-64 Details for tgcalls-0.0.12-cp38-cp38-macosx_10_12_x86_64.whl
tgcalls-0.0.12-cp37-cp37m-manylinux2014_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64 Details for tgcalls-0.0.12-cp37-cp37m-manylinux2014_x86_64.whl
tgcalls-0.0.12-cp37-cp37m-manylinux2014_aarch64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ ARM64 Details for tgcalls-0.0.12-cp37-cp37m-manylinux2014_aarch64.whl
tgcalls-0.0.12-cp37-cp37m-macosx_10_12_x86_64.whl CPython 3.7 CPython 3.7 pymalloc macOS 10.12+ x86-64 Details for tgcalls-0.0.12-cp37-cp37m-macosx_10_12_x86_64.whl
tgcalls-0.0.12-cp36-cp36m-manylinux2014_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.17+ x86-64 Details for tgcalls-0.0.12-cp36-cp36m-manylinux2014_x86_64.whl
tgcalls-0.0.12-cp36-cp36m-manylinux2014_aarch64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.17+ ARM64 Details for tgcalls-0.0.12-cp36-cp36m-manylinux2014_aarch64.whl
tgcalls-0.0.12-cp36-cp36m-macosx_10_12_x86_64.whl CPython 3.6 CPython 3.6 pymalloc macOS 10.12+ x86-64 Details for tgcalls-0.0.12-cp36-cp36m-macosx_10_12_x86_64.whl

Total release size: 103.5 MB

Release files / tgcalls-0.0.12-cp39-cp39-manylinux2014_x86_64.whl

Download URL tgcalls-0.0.12-cp39-cp39-manylinux2014_x86_64.whl
Size 8.2 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
0960da6c48e5462b424805750ca975fd0d332b7a184e11c993ca98e5f8476829
BLAKE2b-256 checksum
How to use checksums
91b2294512716090894b897d5e1fad00ddec7b6356752c60add02836545fd117
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.10

Release files / tgcalls-0.0.12-cp39-cp39-manylinux2014_aarch64.whl

Download URL tgcalls-0.0.12-cp39-cp39-manylinux2014_aarch64.whl
Size 7.6 MB
Tags CPython 3.9 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
12775fa38a1690849c2f3d079324bb07efa50d032f1772cfc52cf706b1503fb6
BLAKE2b-256 checksum
How to use checksums
50045bf4051de96ca027c9f88477bd51d11f7ed3943a5b83fb6bc19384184379
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.10

Release files / tgcalls-0.0.12-cp39-cp39-macosx_11_0_arm64.whl

Download URL tgcalls-0.0.12-cp39-cp39-macosx_11_0_arm64.whl
Size 7.1 MB
Tags CPython 3.9 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
10e5e5582010369db7d71e3e5ddcedf947a3bb2cef8890c64afbeb1028cca7cf
BLAKE2b-256 checksum
How to use checksums
06a70c019823a7a9d2d46becacba1fb4598c9b16a0c354e56f603f2ad491768a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2

Release files / tgcalls-0.0.12-cp39-cp39-macosx_10_12_x86_64.whl

Download URL tgcalls-0.0.12-cp39-cp39-macosx_10_12_x86_64.whl
Size 8.2 MB
Tags CPython 3.9 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
cf9bd62b45dda8e62531c645f04986908f1556adb3f4820b1a06637357821032
BLAKE2b-256 checksum
How to use checksums
e96b9fefdc786d0c1d7ffba961cc9526b8c5a5dbd82a93b465f08689e834b534
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.10

Release files / tgcalls-0.0.12-cp38-cp38-manylinux2014_x86_64.whl

Download URL tgcalls-0.0.12-cp38-cp38-manylinux2014_x86_64.whl
Size 8.2 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
1dd86305d8f205be1ef193dde9cd529db832ea7fc50fb7d2aab1df378c385618
BLAKE2b-256 checksum
How to use checksums
a68f1adaaf3d39eeb2046833869e3f753502e5a2d72c2a5b0f8fb54dba7b1e2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.10

Release files / tgcalls-0.0.12-cp38-cp38-manylinux2014_aarch64.whl

Download URL tgcalls-0.0.12-cp38-cp38-manylinux2014_aarch64.whl
Size 7.6 MB
Tags CPython 3.8 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
6c1dd4f68ab1e7733fdf11c34c42d4d0c034e5d0137ab0b0397ef1bffc61da1d
BLAKE2b-256 checksum
How to use checksums
242fdfe6ec301658644261d2d43e3499d229c00f12976625fa697ebd53aea0c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.10

Release files / tgcalls-0.0.12-cp38-cp38-macosx_10_12_x86_64.whl

Download URL tgcalls-0.0.12-cp38-cp38-macosx_10_12_x86_64.whl
Size 8.2 MB
Tags CPython 3.8 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
d3780499deee29241030271e1f386710bb5e842356bb0b0b594342a7b5ba14f1
BLAKE2b-256 checksum
How to use checksums
27587ac90182fd649b3dbd8a7ff8033a58f9fc4a539a39fe393599c5afb08cd7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.10

Release files / tgcalls-0.0.12-cp37-cp37m-manylinux2014_x86_64.whl

Download URL tgcalls-0.0.12-cp37-cp37m-manylinux2014_x86_64.whl
Size 8.2 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
588c18df3a2bf91c8e9f5520bcc5000b107ef7813b6971e9ab42685e2162c6ff
BLAKE2b-256 checksum
How to use checksums
ab96421a7222c7d82762964f31974d428726c692777dc5b312f04bc5a54b11e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.10

Release files / tgcalls-0.0.12-cp37-cp37m-manylinux2014_aarch64.whl

Download URL tgcalls-0.0.12-cp37-cp37m-manylinux2014_aarch64.whl
Size 7.6 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
b91bea7f311d299704285925d9677ed966bced6982d0f502316475318d254dc7
BLAKE2b-256 checksum
How to use checksums
d93b55ac27a29f3e63b1e47fc2ce14a961ab20f8dfe8de9ebe3c4539e4f956f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.10

Release files / tgcalls-0.0.12-cp37-cp37m-macosx_10_12_x86_64.whl

Download URL tgcalls-0.0.12-cp37-cp37m-macosx_10_12_x86_64.whl
Size 8.2 MB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
42192c845c4765d986110448174f220f14682124be1287453528df9db30092fa
BLAKE2b-256 checksum
How to use checksums
d0fd8e16bbdad516ae9adbe3a6b367f00a07f74c9d803a626729910731472def
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.10

Release files / tgcalls-0.0.12-cp36-cp36m-manylinux2014_x86_64.whl

Download URL tgcalls-0.0.12-cp36-cp36m-manylinux2014_x86_64.whl
Size 8.2 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
2a599eb9768f130c7bfd217edacff48efc1c85fcb0621bdcbbe25d2a65963e5c
BLAKE2b-256 checksum
How to use checksums
3503742337e031420b2b0dd7643af5d91213cc37a6ddce560ddeeffca0302aaa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.10

Release files / tgcalls-0.0.12-cp36-cp36m-manylinux2014_aarch64.whl

Download URL tgcalls-0.0.12-cp36-cp36m-manylinux2014_aarch64.whl
Size 7.6 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
aeb9a3e84733213210cf22a298837428ab005a3172373c69a007832426cf4695
BLAKE2b-256 checksum
How to use checksums
e05a5f2b2c02a42e0844eba4d73bca3244d78054e80f128dfcf9dc52f149353b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.10

Release files / tgcalls-0.0.12-cp36-cp36m-macosx_10_12_x86_64.whl

Download URL tgcalls-0.0.12-cp36-cp36m-macosx_10_12_x86_64.whl
Size 8.2 MB
Tags CPython 3.6 CPython 3.6 pymalloc macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
e3cc964654124255d76bc0d4fa08a0687483e151a347ef2739f17b53269de21d
BLAKE2b-256 checksum
How to use checksums
aa298f010274aea4817eee7b03bccd6eaec86eb0208948f8459d1800b96f985c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.10

Security for tgcalls 0.0.12

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.0.12 This release

13 release files No 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