繼承 這篇舊文 Asterisk Freepbx 的 SMS to EMAIL 設定 extensions_custom.conf
網路上找到這個
Asterisk SMS轉發/來電通知到Telegram
之前一直使用Raspi4配合RasPBX(http://www.raspberry-asterisk.org/)接收簡訊和電話,最近因為某些原因換掉了這套方案,但應該有不少人有這個需求,所以把我寫的規則發佈出來。
將#chatid#和#botkey#替換之後塞入extensions_custom.conf即可,telegram的bot和chatid請自行想辦法獲取。
[from-trunk-dongle]
exten => sms,1,Verbose(Incoming SMS from ${CALLERID(num)} ${BASE64_DECODE(${SMS_BASE64})})
exten => sms,n,Set(FILE(/var/log/asterisk/sms.txt,,,a)=${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)} - ${DONGLENAME} - ${CALLERID(num)}: ${BASE64_DECODE(${SMS_BASE64})})
exten => sms,n,System(echo >> /var/log/asterisk/sms.txt)
exten => sms,n,System(curl -d 'chat_id=填入chat_id&text=${URIENCODE(${BASE64_DECODE(${SMS_BASE64})})}\nForm:${DONGLENAME} - ${CALLERID(num)}' 'https://api.telegram.org/bot機器人鑰匙/sendMessage')
exten => sms,n,Hangup()
exten => _X.,1,Set(CALLERID(name)=${CALLERID(num)})
exten => _X.,n,System(curl -d 'chat_id=填入chat_id&text=${URIENCODE(Incoming Call:${CALLERID(num)} via ${DONGLENAME})}' 'https://api.telegram.org/bot機器人鑰匙/sendMessa
ge')
exten => _X.,n,Goto(from-trunk,${EXTEN},1)