Configuring the Gateway on the @siptg_bot side

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

Connection is made as a standard SIP-trunk (VoIP) to any office or cloud SIP-PBX, from where calls are distributed among employees or users PBX.

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

Step 1: Choose a Telegram account to connect to

Setting up a Telegram account to connect a gateway for SIP callsPBX
  • Determine which Telegram account you need to configure to forward incoming calls from it to your SIPPBX and/or make outgoing calls to Telegram (you can connect the Gateway either directly from the account it is supposed to work on or from an administrator account)
  • Access the bot @siptg_bot from your admin account. If the bot is not activated yet, start it with the command /start
  • To configure the Gateway function, type the command /gateway or select it from the bot menu.

Step 2: Connecting the virtual device

Setting up a repository of Telegram account sessions to connect the gateway for calls to SIP-PBX
Allow @siptg_bot Create and connect a virtual device linked to the desired Telegram account to forward calls from it. This procedure is performed by pressing the "Connect" button and is performed in 3 steps:

  • Specify the phone number of the Telegram account to call (to which the Gateway is connected)
  • Select the session store used for the device to be connected (by default the secure SIP.TG cloud store is used, the fastest and easiest option)
  • Give the bot a code from the official Telegram account to bind the device (the code will come to the account to which the Gateway is connected)
Options for using the Session Store

If you use the Cloud Session Store from SIP.TG, no action is required from you, this option is selected by default at the appropriate virtual device connection step.

The connected device is used only for call forwarding (unless you explicitly enable the appropriate mode for bot message processing, for example, for the text Auto Answer function).

Once connected, all virtual device sessions for customer accounts are stored on our secure servers. xml-ph-0002@deepl.i You can test the connection of your own Session Store on both paid and free plans.

Read more about installing your own Session Store
Note regarding 2FA (two-factor authentication)
When two-step authentication is connected, a new Telegram session for the SIP.TG virtual device 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 don't ask for 2FA password from the Telegram account the Gateway is connected to, but we have to change it after the device is connected, a new password for 2FA will be generated for the gateway account automatically and shown to the bot, and sent to the specified email.

When using other 2FA methods, two-step authentication should be disabled for the session creation, and after the session creation it can be enabled again.

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

Configuring VoIP Trunk between Telegram and SIPPBX
The SIP-node to establish a connection 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 ways to register between SIP.TG Worker-servers and your SIP-PBX:
PBX->SIP.TG (PBX is registered to Worker, the most common method)

In this case, you need to get the SIP account details from the bot, which must then be specified at PBX to register when connecting the trunk.
Configuring VoIP Trunk between Telegram and SIPPBX
SIP.TG->PBX (Worker registers at PBX)

  • In this case, the bot needs to specify the details of the SIP-account on the PBX side.
  • The current list of IP addresses of our servers can be found at this link, they must be added to the firewall white list for PBX.
  • After saving the details PBX to activate registration, you must click the enable button.
Configuring VoIP Trunk between Telegram and SIP-PBX with registration
IP-IP (Worker and PBX connection without registration)

  • In this case, from PBX you must initiate a call to the IP address and port received from the bot to confirm the IP address PBX.
  • After saving the details PBX to activate registration, you must click the enable button.
  • To identify multiple SIP-accounts of this type, hosted on the same IP-address, provides additional identification based on a random field and its value in the SIP-message.
  • Be sure to include the Number field on PBX to receive incoming calls on the PBX side .
Configuring VoIP Trunk between Telegram and SIP-PBX without registration
Important note about selecting a Worker server
  • If you use SIP.TG cloud servers, you should choose the Worker server in your country.
  • If there is no Worker-server in your country, and registration with the server you selected does not work, try changing it and trying to register again.
  • You can use your Worker-server, once installed and configured the account administrator can choose it(more about installing your modules).
Set your own set of codecs and DTMF transmission method
By default the following set of codecs is set for communication with SIP.TG servers - opus,g722/16000,alaw,mulaw,g729.

RFC2833 is used as default DTMF signal transmission method, but inband and INFO methods are also supported.

Both values can be changed if necessary.

More about codec setup
More about DTMF transmission methods
Firewall settings on the side PBX
If you use Firewall to protect your PBX, make sure that the actual addresses of our Worker-servers that connect to PBX are in the white list.

All IP-addresses of our servers are listed in the file:

Sometimes the Worker-server network is updated, we inform about it in the news channel @siptg_news (we recommend that administrators subscribe to it).
About the infrastructure of Worker Servers

The infrastructure of SIP.TG Worker-servers is secure, the servers can be scaled quickly if necessary, and are located in different geographic areas.

If necessary, a specific Worker-server can be specified 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 (on free plans this option is NOTavailable
Checking the status of the Gateway accounts
The SIP accounts created for the Gateway will be saved under /gatewayThe account is shown with its status for each account:

Gateway SIP account disabled
  • For PBX -> SIP.TG registrations this status appears if PBX has not registered on our server, wrong login or password was entered, connection parameters are not filled correctly, no access to Worker-servers (IP is blocked or there are network problems)
  • For SIP.TG -> PBX registrations such status appears if an incorrect login or password is entered, connection parameters are not filled correctly, there is no access to PBX (IP is blocked or there are network problems), or it has been disabled manually.
  • Для IP <-> IP подключений это означает что SIP-аккаунт на АТС не активен (в этом режиме используется UDP, постоянного соединения нет)

Gateway SIP account is connected
  • The gateway is correctly configured and ready for operation.
IP blocks PBX for wrong passwords
Specify your connection details to the SIP.TG servers carefully. We have password protection activated, so the IP address PBX can be blocked for an arbitrary period of time if it connects to the SIP.TG servers without the registration option enabled, with the wrong username or password, from an untrusted IP, and so on.
Limiting the number of SIP accounts per Gateway
The default Gateway mode has a limit of 10 SIP accounts to be connected. In rare cases this number may need to be increased to distribute a significant load, please contact support for this.

Step 4: Checking Work

Checking VoIP Trunk between Telegram and SIPPBX
If all settings are correct, SIP-account is marked with green indicator, the Gateway is ready to work.

After appropriate routing of calls is set up on PBX side, you can make test voice calls to connected Telegram account and/or make calls to Telegram-users from your PBX.

Read more about settings on the side PBX

Step 5: Configuring Caller-ID and Caller-Name

Checking VoIP Trunk between Telegram and SIPPBX
Specify the form in which the number of the caller should be transmitted to PBX . You can set the value priority, as well as a prefix or suffix before the value to distinguish calls that come via Telegram from regular calls.

There are 3 values available for Caller-ID:
  • userid(we recommend using the user'smain, internal Telegram-id, there is always)
  • username (in Latin characters and numbers, may not be set by the user)
  • phone (the phone number linked to the account can be hidden by the privacy settings)
You can also specify what to send to PBX as the Caller-Name field.

This step can be skipped during the initial setup phase.

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

Step 6: Configuring custom functions

Checking VoIP Trunk between Telegram and SIPPBX
Specify whether the DTMF keypad should be displayed for outgoing and incoming calls with the Gateway account, Call back and Line selection buttons, as well as whether text messages should be processed (for Autoanswer function and Callback calls).

This step can be skipped during initial setup.

More about customization of user functions

Step 7: Connect a paid tariff

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

On the Trial tariff Up to 10 lines are available for simultaneous calls, all other restrictions are removed, cost 1 EURO/week. This tariff can only be activated once and is valid for 1 week.
Cost of use on paid tariffs
To pay tariff Gateway-Start or Gateway-Business, the cost is calculated based on the number of necessary lines for parallel calls.

tariff Gateway-Start with two lines for parallel calls can be connected by yourself. If necessary, the maximum number of lines for concurrent calls can be increased upon request.

To connect Gateway-Business tariff (from 10 lines) and calculate the cost please contact our support team. With Gateway-Business tariff you get priority technical support and consulting during implementation.
Order of payment of the tariff
To pay, you need to:

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

  • Click on "Start payment", follow the instructions of the payment widget.

More about payment methods

See also

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)

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

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