Setting up a Gateway on the @siptg_bot side

Through Telegram- the gateway in the PBX is possible to receive and make simultaneous parallel calls through a single Telegram-company account (up to 100 simultaneous lines).

The connection takes place in the form of a standard SIP trunk (VoIP) to any office or cloud SIP PBX, from where, according to the required logic, calls are distributed among employees or PBX users.

An ideal solution for sales and support departments of companies that communicate with customers via Telegram.

Step 1: Select Telegram-account to connect

Setting Telegram-account for connecting a gateway for calls to SIP-PBX
  • Decide on Telegram-an account that needs to be configured to forward incoming calls from it to your SIP-PBX and/or make outgoing calls to Telegram (You can connect the Gateway directly from the account on which it should work, or from the administrator account)
  • Contact the bot from your administrator account @siptg_bot. If the bot is not yet activated, launch it with the command /start
  • To configure the Gateway function, enter the command /gateway or select it from the bot menu.

Step 2: Connect the virtual device

Setting up session storage Telegram-accounts for connecting a gateway for calls to SIP-PBX
Let me @siptg_bot create and connect a virtual device linked to the desired one Telegram-account for forwarding calls from it. This procedure is started by clicking on the “Connect” button and occurs in 3 steps:

  • Specify the telephone number of the Telegram account for calls (to which the Gateway is connected)
  • Select the Session Storage used for the connected device (by default, the secure cloud storage SIP.TG is used, the fastest and easiest option)
  • Provide the bot with the code from your official account Telegram to link the device (the code will be sent to the account to which the Gateway is connected)
Use Cases for Session Storage
If you use cloud Session Storage from SIP.TG, you will not need to take any action; this option is selected by default at the corresponding step of connecting the virtual device.

The connected device is used solely for call redirection (unless the corresponding bot message processing mode is explicitly enabled, for example, for the text Auto Answer function).

Once connected, all virtual device sessions for client accounts are stored on our secure servers.

If there are special requirements for the confidentiality of stored account sessions, you can install your own Session Storage, configure the appropriate module, and then select it when creating a virtual device session. You can test connecting your Session Storage using both paid and free plans.

Learn more about installing your own Session Store
Note regarding 2FA (two factor authentication)
With two-step authentication enabled, a new session Telegram for a virtual device, SIP.TG can only be created if a backup email was specified as the second confirmation method, then a confirmation code will be sent to it.

For security reasons, we do not require a password for 2FA from Telegram- the account to which the Gateway is connected, but are forced to change it after connecting the device, a new password for 2FA will be generated for the Gateway account automatically and shown by the bot, and also sent to the specified email.

When using other 2FA methods, two-step authentication must be disabled at the time of creating the session, and after creating the session it can be enabled again.

Step 3: Setting up registration with SIP-PBX (creating a VoIP SIP-Trunk)

Setting up VoIP Trunk between Telegram and SIP-PBX
The SIP node for establishing communication with your PBX is one of our Worker servers; it is with them that the VoIP SIP-Trunk is created.

Worker servers convert and transmit the voice stream between Telegram and your SIP-PBX.

There are 3 possible registration methods between the SIP.TG Worker servers and your SIP PBX:
PBX->SIP.TG (PBX is registered on Worker, the most common method)

In this case, you need to obtain the SIP account details from the bot, which you then need to indicate to the PBX for registration when connecting the trunk.
Setting up VoIP Trunk between Telegram and SIP-PBX
SIP.TG->PBX (Worker registers on the PBX)

  • In this case, the bot needs to specify the SIP account details on the PBX side.
  • The current list of IP addresses of our servers is located via this link, they must be added to the firewall white list for the PBX.
  • After saving the PBX details, to activate registration, you need to press the power button.
Setting up VoIP Trunk between Telegram and SIP-PBX with registration
IP-IP (communication between Worker and PBX without registration)

  • In this case, with the PBX you need to initiate a call to the IP address and port received from the bot to confirm the IP address of the PBX.
  • After saving the PBX details, to activate registration, you need to press the power button.
  • To identify several SIP accounts of this type located on the same IP address, additional identification is provided based on a custom field and its value in the SIP message.
  • Be sure to specify the field PBX number to receive incoming calls on the PBX side.
Setting up VoIP Trunk between Telegram and SIP-PBX without registration
Important note about choosing a Worker server
  • If you use SIP.TG cloud servers, you should choose a Worker server in your own country.
  • If there is no Worker server in your country, and registration with the server you have chosen does not work, try changing it and trying to register again.
  • You can use your own Worker server; after installation and configuration, the account administrator will be able to select it (Learn more about installing your modules).
Installing your own set of codecs and DTMF transmission method
By default, the following set of codecs is installed for communication with SIP.TG servers: opus,g722/16000,alaw,mulaw,g729.

The default transmission method for DTMF signals is RFC2833 but methods are also supported inband и INFO.

Both values ​​can be changed if necessary.

Learn more about setting up codecs
Learn more about DTMF transmission methods
Firewall settings on the PBX side
If you use Firewall to protect your PBX, make sure that the current addresses of our Worker servers from which you connect to the PBX are included in the white list.

All IP addresses of our servers are listed in the file:
https://files.sip.tg/fw.txt

Sometimes the network of Worker servers is updated, we report about this in the news channel @siptg_news (we recommend that administrators subscribe to it).
About the Worker server infrastructure
The infrastructure of SIP.TG Worker servers is reliably protected, the servers are quickly scalable if necessary, and are located in different geographical areas.

If necessary, you can specify a specific Worker server for all linked SIP accounts, including those located on your own servers.

To use your own Worker server (or several), install and configure the appropriate module, then specify it in the connection settings (this feature is NOT provided on free tariff plans).

Learn more about installing your own Worker servers
Checking the status of Gateway accounts
The created SIP accounts for the Gateway will be saved in the section /gateway, where for each account its status is shown:

Gateway SIP account disabled
  • For PBX -> SIP.TG registrations, this status appears if the PBX has not registered on our server, an incorrect login or password has been entered, connection parameters have not been filled in correctly, there is no access to Worker servers (IP is blocked or there are network problems)
  • For SIP.TG -> PBX registrations, this status appears if an incorrect login or password is entered, connection parameters are not filled in correctly, there is no access to the PBX (IP is blocked or there are network problems), or it was disabled manually.
  • For IP <-> IP connections, this means that the SIP account on the PBX is not active (UDP is used in this mode, there is no permanent connection)

Gateway SIP account is connected
  • The gateway is configured correctly and is ready for use.
Blocking PBX IP addresses for incorrect passwords
Specify connection details to SIP.TG servers carefully. We have activated password brute force protection, so the IP address of the PBX can be blocked for an arbitrary period of time if it connects to SIP.TG servers without the registration option enabled, with an incorrect login or password, from an untrusted IP, etc.
Limit on the number of SIP accounts for one Gateway
The default Gateway mode has a limit on the number of connected SIP accounts of 10 pieces. In rare cases, this number may need to be increased to distribute a significant load; please contact support for this.

Step 4: Checking the work

Checking the operation of VoIP Trunk between Telegram and SIP-PBX
If all settings are entered correctly, the SIP account is marked with a green indicator, then the Gateway is ready for operation.

After the appropriate call routing has been configured on the PBX side, you can make test voice calls to the connected Telegram account and/or make a call Telegram- users from your PBX.

Read more about the principle of configuration on the PBX side

Step 5: Caller-ID and Caller-Name Configuration

Checking the operation of VoIP Trunk between Telegram and SIP-PBX
Specify in what form the calling subscriber's number should be transmitted to the PBX. You can set the priority of the values, as well as a prefix or suffix before the value, to distinguish calls received through Telegram from regular calls.

There are 3 values ​​available for Caller-ID:
  • userid(We recommend using it as your main, internal Telegram-user id, always available)
  • username (Latin and numbers, may not be installed for the user)
  • phone (the phone number associated with the account may be hidden by privacy settings)
You can also specify what to send to the PBX as the Caller-Name field.

You can skip this step during the initial setup.

Important! If you specify a prefix or suffix for Caller-ID, then when making outgoing calls from the PBX to Telegram, they must be saved.

Step 6: Custom Function Configuration

Checking the operation of VoIP Trunk between Telegram and SIP-PBX
Specify whether the user should be shown a DTMF keyboard for outgoing and incoming calls with a Gateway account, the Call Back button and Line selection, and whether text messages should be processed (for the Auto Answer function and calls using the Callback method).

You can skip this step during the initial setup.

Learn more about setting up custom functions

Step 7: Connecting to a paid tariff

Testing on Free and Trial tariffs
On the Free tariff (connected by default) the following restrictions will apply:
  • only 1 line (parallel calls are not possible)
  • a total of maximum 30 minutes of calls per month
  • maximum call duration 2 minutes

On the Trial tariff up to 10 lines are provided for simultaneous calls, all other restrictions are lifted, the cost is 100 rubles/week. This tariff can be activated only once, it works only for 1 week.
Cost of use on paid plans
For payment, the Gateway-Start or Gateway-Business tariff is used, the cost is calculated based on the number of lines required for parallel calls.

The Gateway-Start tariff with two lines for parallel calls can be activated independently. If necessary, the maximum number of lines for parallel calls can be increased upon request.

To connect to the Gateway-Business tariff (from 10 lines) and calculate its cost, please contact the support service. The Gateway-Business tariff provides priority technical support and consultations at the implementation stage.
Tariff payment procedure
To pay you need:

  • Go to section /tariff bot @siptg_bot
  • Select a tariff for the Gateway, go to tariff settings
  • Specify the required parameters:
Payment term in months (from 1 to 12)
Payment method
Number of required lines for parallel calls (on Business tariff)

  • Click on the “Start Payment” button and follow the instructions in the payment widget.

More about payment methods

See also


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

What do users see when calling a single Telegram-account via SIP.TG, a set of functions available for them (DTMF, Auto Answer, Line selection, Call Back button, specifying an extension number and calling via Callback)

Limitations and specifics of making voice calls in Telegram via SIP.TG Gateway

Features of integration of the SIP.TG Gateway for Telegram-звонков с CRM системами, прием входящих и совершение исходящих звонков Telegram- users via PBX

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

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

Purpose, advantages, procedure for installing and configuring your own Session Storage Telegram for SIP.TG