Asterisk
# vi /etc/asterisk/extensions_custom.conf
[hgw-custom]
exten => s,1,Set(DESTNUM=${SIP_HEADER(To)})
exten => s,n,NoOp(${DESTNUM})
exten => s,n,Set(DESTNUM=${DESTNUM:1:10})
exten => s,n,Goto(from-trunk,${DESTNUM},1)
[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,Hangup()
exten => _.,1,Set(CALLERID(name)=${CALLERID(num)})
exten => _.,n,Goto(from-trunk,${EXTEN},1)
[hgw-custom]
exten => s,1,Set(DESTNUM=${SIP_HEADER(To)})
exten => s,n,NoOp(${DESTNUM})
exten => s,n,Set(DESTNUM=${DESTNUM:1:10})
exten => s,n,Goto(from-trunk,${DESTNUM},1)
[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,Hangup()
exten => _.,1,Set(CALLERID(name)=${CALLERID(num)})
exten => _.,n,Goto(from-trunk,${EXTEN},1)
コメント