All Projects → MarshalX → tgcalls

MarshalX / tgcalls

Licence: LGPL-3.0 license
Voice chats, private incoming and outgoing calls in Telegram for Developers

Programming Languages

python
139335 projects - #7 most used programming language
C++
36643 projects - #6 most used programming language
Dockerfile
14818 projects
CMake
9771 projects

Projects that are alternatives of or similar to tgcalls

vcplayerbot
Play songs directly in telegram voice chats.
Stars: ✭ 48 (-88.24%)
Mutual labels:  voice-chat, video-call, pyrogram, pytgcalls, tgcalls
quickstart-calls-directcall-ios
iOS sample for Direct Call of Sendbird Calls, guiding you to build a real-time voice and video calls quickly and easily.
Stars: ✭ 13 (-96.81%)
Mutual labels:  voip, video-call, calls
MwK-Musics
A Telegram Bot to Play Audio in Voice Chats With Youtube and Deezer support. Supports Live streaming from youtube Supports Mega Radio Fm Streamings
Stars: ✭ 38 (-90.69%)
Mutual labels:  voice-chat, pyrogram, pytgcalls
GroupMusicPlayerBot
Advanced telegram group music play bot!
Stars: ✭ 32 (-92.16%)
Mutual labels:  voice-chat, pyrogram, pytgcalls
Madelineproto
Async PHP client/server API for the telegram MTProto protocol
Stars: ✭ 1,776 (+335.29%)
Mutual labels:  mtproto, voip, calls
somleng
Open Source Implementation of Twilio's REST API
Stars: ✭ 33 (-91.91%)
Mutual labels:  voice, voip
univoice
Voice chat/VoIP solution for unity. P2P implementation included.
Stars: ✭ 192 (-52.94%)
Mutual labels:  voice, voip
Gophergameserver
🏆 Feature packed, easy-to-use game server API for Go back-ends and Javascript clients. Tutorials and examples included!
Stars: ✭ 61 (-85.05%)
Mutual labels:  voice, voip
Unityrtc
基于webrtc的unity多人游戏实时语音(A Unity Demo for Impl Real-time Game Voice Among Mutiplayers Based On WEBRTC)
Stars: ✭ 74 (-81.86%)
Mutual labels:  realtime, voice
tvoip
Terminal-based P2P VoIP application (TeamSpeak-/Skype-like voice chatting over LAN or Internet)
Stars: ✭ 34 (-91.67%)
Mutual labels:  voice, voip
Univoice
P2P VoIP in Unity
Stars: ✭ 128 (-68.63%)
Mutual labels:  voice, voip
Anjani
🤖 Telegram group management bot with spam protection
Stars: ✭ 45 (-88.97%)
Mutual labels:  asynchronous, pyrogram
figaro
Real-time voice-changer for voice-chat, etc. Will support many different voice-filters and features in the future. 🎵
Stars: ✭ 362 (-11.27%)
Mutual labels:  voice, voice-chat
twilio-client.js
Twilio’s Programmable Voice JavaScript SDK
Stars: ✭ 63 (-84.56%)
Mutual labels:  voice, voip
vasisualy
Vasisualy it's a simple Russian voice assistant written on Python for GNU/Linux, Windows and Android.
Stars: ✭ 33 (-91.91%)
Mutual labels:  voice, voice-chat
voice
Implementation of the Discord Voice API for discord.js and other JS/TS libraries
Stars: ✭ 310 (-24.02%)
Mutual labels:  voice, voip
accelerator-core-ios
Syntax sugar of OpenTok iOS SDK with Audio/Video communication including screen sharing
Stars: ✭ 30 (-92.65%)
Mutual labels:  realtime, video-call
SilentServer
Silent is very lightweight, high quality - low latency voice chat for gaming. The server runs on Windows and Linux.
Stars: ✭ 52 (-87.25%)
Mutual labels:  voice, voip
Clearly
Clearly see and debug your celery cluster in real time!
Stars: ✭ 287 (-29.66%)
Mutual labels:  asynchronous, realtime
DevelopersUserbot
Telegram Userbot Made for Developers by Developers
Stars: ✭ 25 (-93.87%)
Mutual labels:  telethon, pyrogram

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

Telegram WebRTC (VoIP) Mentioned in Awesome Telegram Calls

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

Pyrogram's snippet

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

from pytgcalls import GroupCallFactory

app = Client('pytgcalls')
group_call = GroupCallFactory(app).get_file_group_call('input.raw')


@group_call.on_network_status_changed
async def on_network_changed(context, is_connected):
    chat_id = MAX_CHANNEL_ID - context.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_handler(_, message):
    await group_call.start(message.chat.id)


app.run()

Telethon's snippet

from telethon import TelegramClient, events

from pytgcalls import GroupCallFactory

app = TelegramClient('pytgcalls', api_id, api_hash).start()
group_call_factory = GroupCallFactory(app, GroupCallFactory.MTPROTO_CLIENT_TYPE.TELETHON)
group_call = group_call_factory.get_file_group_call('input.raw')


@app.on(events.NewMessage(outgoing=True, pattern=r'^/join$'))
async def join_handler(event):
    chat = await event.get_chat()
    await group_call.start(chat.id)

app.run_until_disconnected()

Features

  • Python solution.
  • Prebuilt wheels for macOS, Linux and Windows.
  • Supporting popular MTProto libraries: Pyrogram, Telethon.
  • Abstract class to implement own MTProto bridge.
  • Work with voice chats in channels and chats.
  • Multiply voice chats (example).
  • System of custom handlers on events.
  • Join as channels or chats.
  • Join using invite (speaker) links.
  • Speaking status with voice activity detection.
  • Mute/unmute, pause/resume, stop/play, volume control and more...

Available sources of input/output data transfers

Note: All audio data is transmitted in PCM 16 bit, 48k. Example how to convert files using FFmpeg.

Requirements

TODO list

  • Incoming and Outgoing private calls (already there and working, but not in the release version).
  • Group Video Calls and more...

Installing

For Pyrogram

pip3 install -U pytgcalls[pyrogram]

For Telethon

pip3 install -U pytgcalls[telethon]

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 official clients. To implement the binding, the code of Telegram Desktop and Telegram Android was studied. Changes have been made to the Telegram library. All modified code is available as a subtree in this repository. The main ideas of the changes is to improve the sound quality and to add ability to work with third party audio device modules. In addition, this binding implemented custom audio modules. These modules are allowing transfer audio data directly from Python via bytes, transfer and control the playback/recording of a file or a virtual system device.

How to build

Short answer for Linux:

git clone [email protected]:MarshalX/tgcalls.git --recursive
cd tgcalls

For x86_64:

docker-compose up tgcalls_x86_64

For AArch64 (ARM64):

docker-compose up tgcalls_aarch64

Python wheels will be available in dist folder in root of tgcalls.

More info:

Also, you can investigate into manylinux GitHub Actions 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. By default, this library are supports Pyrogram and Telethon clients for working with Telegram Mobile Protocol. You can write your own implementation of abstract class to work with 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. The example how to transcode files from a code is available here.

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].