Features of Gateway mode

About Telegram's restrictions on outgoing calls

Calling a user by internal Telegram-ID is possible only if there has been direct or indirect interaction with the user before: messaging, incoming calls from this account (this is a technical limitation of Telegram).

It is possible to make outgoing calls using the user's phone number or username also without prior dialog with the user, but a temporary ban on calls from Telegram may occur if the intensity of calls is too high (lasting about 24 hours).

If the gateway's Telegram account is in the caller's contact list, there will be no automatic ban.

Be especially careful when calling unfamiliar users. Any user may complain about spam if your call is unexpected. If a significant number of complaints are received, the gateway account may be restricted or blocked by the Telegram team.

Delayed calls through the Telegram gateway

You may experience delays when calling an offline user. This is due to a feature of Telegram described below.

Cellular operators have no trouble determining whether the user is online or not. Telegram works harder. The user gets the status "Online" if three conditions are met: the application is running, is active, and the phone itself is unlocked. Otherwise, the user is considered offline.

Push technology helps force the user to come online. He receives a notification of an incoming Telegram call and appears online at that moment, even if he's not logged into the app. This approach helps the app conserve battery power significantly.

The time between a call and receiving a Push notification is not regulated. If the phone is not online, the user may not receive a notification at all. Therefore, the timeout definition depends on the gateway usage tasks and has to be configured on the side of your virtual PBX.

The current timeout value is 15 seconds.

About protecting Telegram from flood calls

When there is a heavy load on Telegram's servers, flood protection can be triggered. This is done by artificially restricting the use of all or some Telegram API calls.

If the delay is limited to 5 seconds, this API request is repeated automatically. Otherwise, the request terminates with an error, which is transmitted to SIP as code 503 Service Unavailable.

In accordance with RFC 3261 a Retry-After header will also be transmitted containing a value in seconds after which the request can be resent.


See also


How to set up Gateway mode to receive and make calls through the company's single Telegram account

How to receive calls from Telegram at PBX via SIP.TG , as well as make outgoing calls on behalf of a single Telegram account of the company

What users see when calling a single Telegram account via SIP.TG, the set of functions available to them (DTMF, Autoanswer, Line selection, Call back button, specifying the internal number and calling via Callback)

Features of SIP.TG Gateway integration for Telegram-calls with CRM systems, receiving incoming and making outgoing calls to Telegram users via PBX

Payment options for the SIP.TG gateway for transferring calls between Telegram and SIP telephony

Purpose, benefits, installation and configuration of own Worker servers for SIP.TG

Purpose, benefits, installation and configuration of your own Telegram Session Store for SIP.TG

The crux of the problem with the tg2sip library (libtgvoip) with Telegram clients on Android and the proposed solution from SIP.TG