Interaction with Telegram
For the Gateway mode to work, you need to connect a regular Telegram account through which calls will pass. Two roles are involved in this process: the session and the administrator.
Session and Administrator Account Roles
- Session account — a Telegram account that will be used as a source and receiver of calls. Connected as a virtual device to SIP.TG.
- Administrator account — a Telegram account that interacts with @siptg_bot and manages the session: connects the session, can change settings, connect SIP-PBX, and receive error notifications.
The same Telegram account can be used in both roles. However, in a corporate environment, it is recommended to separate them.
Step-by-Step Session Connection
Choosing a Telegram Account
Choose a Telegram account that will be used as a gateway. Make sure it is not used for personal calls or correspondence.
Connecting to @siptg_bot
Go to @siptg_bot and execute the /gateway
command. Click the “Connect” button.
Choosing Session Storage
Specify where the session will be stored:
- SIP.TG Cloud Storage — simple, fast, and secure.
- Own storage — for companies with increased privacy requirements. For more details, see Telegram Session Storage.
Entering the phone number and confirmation
Enter the phone number of the selected Telegram account. A code will be sent to it from the official Telegram account, which needs to be entered into the bot for authorization.
If two-factor authentication (2FA) is enabled on the account, a secure recovery process will be initiated: Telegram will send an email to the linked email for password reset. This is done to avoid transmitting your password in plain text.
Applying Telegram Settings to the Account
Immediately after connecting the session, the bot will offer to apply recommended settings. They enhance the reliability and convenience of receiving calls:
- Disable calls on other devices — eliminates conflicts when a call arrives simultaneously in multiple places. Allows using the Telegram session as a channel only for calls, and other devices — for correspondence.
- Allow calls from all users — important, as by default calls from unknown numbers are blocked by Telegram settings and will not reach the PBX.
- Allow P2P calls from everyone — if supported, allows Telegram to transmit audio directly, without forwarding through servers, improving call quality and reducing delays.
- Forbid adding to groups — reduces the risk of receiving unnecessary notifications unrelated to call tasks.
Some Telegram parameters can only be changed 24 hours after connecting the account. If you get an error — try again later.
SIP.TG Session Settings
Screenshot with Telegram session settings
DTMF in and DTMF out
DTMF in and DTMF out
These parameters enable or disable the use of the DTMF keypad in different call directions:
- DTMF in — used for incoming Telegram calls (Telegram → SIP direction);
- DTMF out — used for outgoing calls to Telegram from your PBX (SIP → Telegram direction).
The DTMF keypad allows:
- interacting with the PBX voice menu (IVR);
- entering internal numbers;
- displaying information about the calling employee when calling a Telegram user.
The keypad is activated by swiping up during a conversation. Supported transmission modes (RFC2833, inband, SIP INFO) are changed in the SIP connection settings and should be coordinated with the PBX settings.
Redial and line selection
Redial and line selection
Enables or disables the “Redial” and “Lines” buttons for Telegram users who interact with the gateway account. The buttons appear in the chat after the call ends.
Clicking the “Redial” button initiates a call to the internal number in the PBX that was used during the previous conversation, allowing to connect the user with a specific employee or department.
The “Lines” button works approximately the same with the only difference that before initiating the call, it displays the connected lines through which a call can be made.
Message processing
Message processing
Enables or disables the ability to react to text messages coming to the session’s Telegram account. When enabled, additional functions open up:
-
Callback — after sending any message to the chat, the user will receive an incoming call from the gateway with subsequent connection to the number sent in the message (or the default number; behavior is configured in the SIP line settings).
-
Inline-bot — if a suitable SIP account for calling is not found for the message, it can be processed through an external inline-bot.
-
Auto-reply — a predefined template is sent for each message, for example:
This account is for calls only. For correspondence, use @support_bot.
These functions can be enabled separately and the behavior can be configured depending on the situation.
Inline-bot
Inline-bot
You can connect your own inline-bot that will be used to process incoming messages. This is especially useful in cases where the message cannot be matched with a phone number or a call is not required. The inline-bot can:
- respond with a template;
- collect requests;
- integrate with external systems such as Helpdesk, CRM, etc.
Additionally, you can set the format of the inline-request that will be passed to the bot. This allows structuring the user’s request for more accurate processing.
Advanced actions
Advanced actions
- Unbind / Transfer — allows removing administrator rights from the current account or transferring them to another Telegram user (see Session and Administrator Account Roles).
- Share subscription — extend the administrator’s subscription to this session (see Session and Administrator Account Roles and Additional Telegram Accounts).
- Disconnect — completely remove the virtual device, reset the session, and optionally clear SIP connection parameters.