Tg2SIP is a Telegram <-> SIP voice gateway. It can be used to forward incoming telegram calls to your SIP PBX or vice versa.
Your SIP PBX should be comaptible with L16@48000 or OPUS@48000 voice codec.
api_id and api_hash tokens from this page and put them in settings.ini file.gen_db appsettings.initg2sipSIP -> Telegram calls can be done using 3 extension types:
tg#[\s\d]+ for calls by username\+[\d]+ for calls by phone number[\d]+ for calls by telegram ID. Only known IDs allowed by telegram API.All Telegram -> SIP calls will be redirected to callback_uri SIP-URI that can be set in from settings.ini file.
Extra information about Telegram account caller will be added into SIP headers:
X-TG-Context: Special header for debug purposeX-TG-ID: Telegram User IdX-TG-FistName: Optional, User first nameX-TG-LastName: Optional, User last nameX-TG-Username: Optional, User usernameX-TG-Phone: Optional, User phone numbergit clone https://github.com/hectorvent/tg2sip
cd tg2sip
./build.sh
# build directory will be create and gen_db, tg2sip and settings.ini will exist
# Install dependencies.
apt install libopus0 libssl1.1 -y
# Create directory structure
mkdir /etc/tg2sip
mkdir /var/tg2sip
cp build/{tg2sip,gen_db} /usr/local/bin
# nano/vi /etc/tg2sip/settings.ini and change necessary values.
cp settings.ini /etc/tg2sip/
# Copy systemd service
cp tg2sip.service /etc/systemd/system
systemctl daemon-reload
# create Telegram Tdlib db and fill the requested information
sudo TG2SIP_STANDARD_FOLDER=YES gen_db
# start the tg2sip gateway and enjoy it.
systemctl start tg2sip.service
Docker Tg2SIP image is based on Debian 10
cd docker
cp ../settings.ini etc
# Edit settings file
nano etc/settings.ini
# Generate Telegram db
docker run --rm -it -v `pwd`/etc:/etc/tg2sip/ -v `pwd`/data:/var/tg2sip/ hectorvent/tg2sip-gateway gen_db
# start docker services
docker-compose up -d
Tdlib to new version.Asterisk, FreeSwitch and Kamailio.As this repo is based on Infactum/tg2sip make donation to Infactum.
Content type
Image
Digest
Size
46.2 MB
Last updated
about 5 years ago
docker pull hectorvent/tg2sip-gateway