pytgcalls / ntgcalls

A Native Implementation of Telegram Calls in a seamless way.
https://pytgcalls.github.io
GNU Lesser General Public License v3.0
58 stars 11 forks source link

Relay Server Connection Issues with Telegram API #20

Closed Laky-64 closed 2 months ago

Laky-64 commented 7 months ago

Before of all

This document describes a known issue encountered when using the library with Telegram. It's important to note that this is not a limitation of the library itself, but rather a problem inherent to the Telegram API.

Description

Impact

Users might experience occasional API call failures due to these connection issues.

Workaround (if applicable):

Unfortunately, there is no current workaround available due to the nature of the issue residing within the Telegram API.

Additional Notes

We will continue to monitor the situation and update this document when a fix is implemented by Telegram.

oscaracena commented 7 months ago

I've got this problem very frequently (almost always) when calling a user connected by cellular data (not WiFi). I've tested different carriers with the same results.

And, what is more distressful, it seems to happen at certain hours in the day (I've no problem in the early morning, but after 10 am, no chance to connect). The Telegram client which receives the call is stalled in "Exchanging encryption keys...".

I know this is no PyTgCalls problem, I just wanted to share my experience here, in case we could trace a workaround or something... 😅

Cheers!

KyotoByte commented 7 months ago

@oscaracena Interesting 🤔

Laky-64 commented 7 months ago

State Report of 29/04/2024

After several attempts and tests, we were unable to find a solution regarding the Telegram V11 protocol together with @vkryl (For TgX & NTgCalls), as the connection to the Relay Servers randomly sometimes doesn't work, so Vkryl decided to disable the v11 protocol directly TgX side, but this led to breaking compatibility with NTgCalls which currently implements only the v11 protocol.

Have you tried implementing the V8 protocol?

Yes, but without success, we have implemented audio transmission together with WebRTC Raw calls, but without success, we have managed to establish a connection that can transmit audio, but we have not managed to develop a connection to the DataChannel to transmit crucial data, such as "The video is now available" or "The stream has been muted" etc....

What about using other protocol versions?

The reason is simple, all versions lower than 8.0.0 are to be considered neolithic, while versions like 9.0.0 and 10.0.0 are 2 versions completely not recommended and 9.0.0 is also turned off server side, so only the version 11.0.0 and 8.0.0 as possible choices

So.... Now?

Well..... We have created a special branch with the related changes made by me and Vkryl, if you want to take a look and maybe make attempts and possibly compare everything if maybe we mixed something, I'll leave you an index below of the various files.

Files Index (NTgCalls)

Custom WebRTC Calls Reflector Port Reflector Relay Port Factory Instance Networking Channel Manager OutgoingAudioChannel OutgoingVideoChannel InstanceV2Impl

Files Index (TgX)

Custom WebRTC Calls Reflector Port Reflector Relay Port Factory Instance Networking Channel Manager OutgoingAudioChannel OutgoingVideoChannel InstanceV2Impl

Laky-64 commented 2 months ago

Fixed starting from NTgCalls 1.2.2b1 by switching to protocol V8