Using Telegram Session Storage

What is Telegram Session Storage

Telegram Session Storage - this is a server on which keys are stored, as well as other data necessary to access accounts Telegram. Within the SIP.TG platform, an unlimited number of storages are provided, each of which can also store sessions Telegram unlimited number of users. The storage module is implemented based on the official library Telegram open source - TDLib.

In addition to the official secure session stores Telegram, within the SIP.TG platform, each user can create their own storage. The choice of storage is possible only at the time of creating a new session Telegram, moving sessions Telegram between storage facilities is not provided.

Telegram Session Storage capabilities

Data residing in the warehouse is used to connect and interact with the infrastructure Telegram. Interaction between the SIP.TG platform and the storage occurs via the TCP protocol. The control module connects to the session storage, transmits the internal session identifier, after which further interaction is built by sending commands in both directions in JSON format.

In addition, the session store Telegram provides additional capabilities:

  • rejects execution of unauthorized commands;
  • limits the transmission of only the allowed type of events (update);
  • supports an unlimited number of TCP connections per session Telegram;
  • automatically searches for a user by his username and phone number;
  • caches user search results;
  • has two data storage modes: in a local SQLite database (using the TDLib library) or in an external MySQL database.

System Requirements

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

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

Setting up your own Session Storage

Obtaining Certificates

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

As a result, the bot will send 2 files: a private key and a certificate, necessary for a secure connection. Save them - you will need them later to write to the storage server.
Preparing the server

The most detailed and up-to-date information on setting up the server is located On the page project on GitHub. The procedure includes:

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

The last step in the setup is to configure the parameters for connecting to the session storage through the bot, namely, specifying the connection address. Click the Address button and enter the external address and port of the server on which the session store is running. Next, 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 the storage will be disabled.

See also


Payment methods 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 the SIP.TG gateway for voice calls in Telegram

Settings and use of the DTMF keyboard when Telegram- calls

Setting up number conversion rules for SIP accounts

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

Methods for transferring tariff management to another user, transferring the right to administer the tariff, as well as transferring ownership of the tariff

Request for SIP.TG account management to help users whose categories of users have access to the function

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

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

Purpose, advantages, procedure for installing and configuring your own Worker servers for SIP.TG