voip PBX 的 sms 簡訊轉發到 discord bot 方法

 /etc/asterisk/extensions_custom.conf


[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(echo "From: abc@gmail.com\nTo: abc@gmail.com\nSubject: SMS fr ${CALLERID(num)}\n\n${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)} - ${DONGLENAME} - ${CALLERID(num)}: ${BASE64_DECODE(${SMS_BASE64})}" > /tmp/sms.txt)

exten => sms,n,System(mail -t < /tmp/sms.txt)


; sms To Discord

exten => _.,n,System(curl -X POST -F 'content= ${BASE64_DECODE(${SMS_BASE64})} \n 簡訊SMS Form ${DONGLENAME} - ${CALLERID(num)}' 'https://discord.com/api/webhooks/密網址')

exten => sms,n,Hangup()

exten => _.,1,Set(CALLERID(name)=${CALLERID(num)})

exten => _.,n,System(curl -X POST -F 'content=${URIENCODE(現在家裡有來電 Call ${CALLERID(num)} via ${DONGLENAME})}' 'https://discord.com/api/webhooks/密網址')

exten => _.,n,Goto(from-trunk,${EXTEN},1)

張貼留言 (0)
較新的 較舊