Infactum / tg2sip

Telegram <-> SIP voice gateway
GNU General Public License v2.0
273 stars 104 forks source link

How to get CallerId from Telegram #27

Closed aizukanne closed 4 years ago

aizukanne commented 4 years ago

Hello,

This is a wonderful solution. Is it able to forward caller info to Asterisk? I want to be able to pass User Firstname and Surname to the PBX.

Thank you

Infactum commented 4 years ago

Extra information about caller Telegram account is stored into X-TG-* SIP fields.

hectorvent commented 4 years ago

Here the header list:

X-TG-ID: Telegram User Id X-TG-FistName: Optional, User first name X-TG-LastName: Optional, User last name X-TG-Username: Optional, User username X-TG-Phone: Optional, User phone number

mariarti commented 4 years ago
[from-tg]
exten => tg,1,Set(CALLERID(num)=tg+${SIP_HEADER(read,X-TG-Phone)})
same => n,ExecIf($ ["${CALLERID(num)}"="tg +"]?Set(CALLERID(num)=tg${SIP_HEADER(read,X-TG-ID)}))
same => n,Set(CALLERID(name)=tg-${SIP_HEADER(read,X-TG-FirstName)})
same => n,Dial(SIP/200,60)