步驟一
    安裝 Exim4     https://wiki.debian.org/Exim4Gmail



步驟二
    nano /etc/asterisk/extensions_custom.conf

[from-trunk-dongle]
; 收簡訊
exten => sms,1,Verbose(Incoming SMS from ${CALLERID(num)} ${BASE64_DECODE(${SMS_BASE64})})
; 收簡訊放在 /var/log/asterisk/sms.txt 檔案中
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 "To: 收信人@david888.com\nSubject: Incoming SMS from ${CALLERID(num)}\n\n${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)} - ${DONGLENAME} - ${CALLERID(num)}: \n ${BASE64_DECODE(${SMS_BASE64})}" > /tmp/sms.txt)
exten => sms,n,System(sendmail -t < /tmp/sms.txt)
exten => sms,n,Hangup()
exten => _.,1,Set(CALLERID(name)=${CALLERID(num)})
exten => _.,n,Goto(from-trunk,${EXTEN},1)


0 意見:

張貼留言

LinkWithin

Related Posts with Thumbnails
top