Got it…
FreePBX runs my home voip-gsm gateway on Raspberry Pi. I wanted to add two functions that would answer all my needs. They are:
- being able to dial a sip-uri set as Misc Destination from any extension.
- Resend received sms via chan_dongle.
The first may be a lot complicated so I’ll start with the second.
This dial plan (borrowd from: http://www.raspberry-asterisk.org/calling-on-gsm3g-networks/#comment-4792)receives sms from my two usb dongles and saves them to a file sms.txt:
[from-trunk-dongle]
exten => sms,1,Verbose(Incoming SMS from ${CALLERID(num)} ${BASE64_DECODE(${SMS_BASE64})})
exten => sms,n,System(echo ‘${STRFTIME(${EPOCH},%Y-%m-%d %H:%M:%S)} – ${DONGLENAME} – ${CALLERID(num)}: ${BASE64_DECODE(${SMS_BASE64})}’ >> /var/log/asterisk/sms.txt)
exten => sms,n,Hangup()
exten => _.,1,Set(CALLERID(name)=${CALLERID(num)})
exten => _.,n,Goto(from-trunk,${EXTEN},1)
Since I want to send received sms to my mobile phone, I added this on line 2 of the above:
exten => sms,n,System(asterisk -rx “dongle sms dongle0 +XXXXXXXXXXXX From:${CALLERID(num)} Msg:${BASE64_DECODE(${SMS_BASE64})})”
So from another mobile, I send a message saying “testing 123” to the dongle’s number.
Pertinent log seems to be:
[2013-06-14 13:07:56] VERBOSE[32235][C-00000042] pbx.c: – Executing [sms@from-trunk-dongle:2] System(“Local/sms@from-trunk-dongle-00000004;1”, "asterisk -rx “dongle sms dongle0 +XXXXXXXXX5477 From:+XXXXXXXXX4477 Msg:testing 123”) in new stack
But I do not receive the sms.
However when I try:
CLI>dongle sms dongle0 +XXXXXXXXX5477 From:+XXXXXXXXX4477 Msg:testing 123
log says:
[2013-06-14 13:12:02] VERBOSE[30438] at_response.c: – [dongle0] Successfully sent SMS message 0xb2a47148
[2013-06-14 13:12:02] NOTICE[30438] at_response.c: [dongle0] Successfully sent SMS message 0xb2a47148
Can you please help?
Thanks very much.