Using the Telegram Session Storage

What are storage Telegram sessions

A Telegram session storage is a server that stores keys as well as other data required to access Telegram accounts. As part of the SIP.TG platform, an unlimited number of storages are provided, each of which can also store Telegram sessions for an unlimited number of users. The storage module is implemented based on Telegram's official open-source library - . TDLib.

In addition to Telegram's official secure session storage, each user can create their own storage as part of the SIP.TG platform. Storages can only be selected when creating a new Telegram session; it is not possible to move Telegram sessions between storages.

Telegram's session storage features

The data in storage is used to connect and communicate with the Telegram infrastructure. Interaction between the SIP.TG platform and the storage takes place via TCP. The control module connects to the session storage, transmits an internal session identifier and then further communication is built by sending commands in JSON format both ways.

In addition, storage Telegram sessions provide additional features:

  • rejects the execution of unauthorised commands;
  • restricts the transmission of only the permitted event type (update);
  • has support for an unlimited number of TCP connections per Telegram session;
  • Automatically searches for a user by username and phone number;
  • caches user search results;
  • has two data storage modes: in the local SQLite database (using the TDLib library) or in the external MySQL database.

System Requirements

The runtime environment of the storage is built on a virtualization platform Docker In order to avoid runtime environment emulation we do not recommend using an OS other than Linux (Mac OS, Windows) as the primary operating system. All additional software dependencies are already contained in the distributed image, the base OS only needs Docker CE и Docker Compose.

The server must have a dedicated IP address and be accessible from an external network, or you must be able to "forward" one arbitrary TCP port to an external IP address.

Setting up your own session storage

Get certificates

Encryption certificates allow you to establish a secure connection between the SIP.TG platform and the storage server. In the settings of the @siptg_bot bot run the command /storage and click the "New" button.

The bot will send you 2 files: a private key and a certificate, required for a secure connection. Save them - you will need them later to write to the storage server.
Server preparation

The most detailed and up-to-date information on setting up a server can be found on the page project on GitHub. The procedure includes:

  • update the installed software (if necessary);
  • installation of the Docker software;
  • obtaining configuration file templates;
  • save the certificate files from the bot to the server;
  • making changes to the configuration files (if necessary);
  • running the storage on the server.
Connecting to the Session Storage

The last step in the configuration is to configure the settings for connecting to the session storage via the bot, namely specifying the connection address. Click the Address button and enter the external address and port of the server running storage sessions. Then click the Enable button to attempt to connect to the storage server. If the connection parameters are incorrect, you will receive an error message and storage will be disabled.

See also


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

Frequent problems and solutions when setting up a gateway for calls between Telegram and SIP telephony

Configuring codecs for SIP accounts when setting up a SIP.TG gateway for Telegram voice calls

Setting up and using the DTMF keypad on Telegram calls

Setting up number conversion rules for SIP accounts

Error codes and their decoding that may occur when setting up a gateway for Telegram calls

How to transfer fare administration to another user, transfer of fare administration, and transfer of ownership of tariff

SIP.TG account management request to help users whose user categories can access the function

IP telephony operators for different geographical areas, vetted by our team

Integration scenarios with products and infrastructure of telecom operators and large companies

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