Help with SMS/USSD context [from-trunk-dongle]

Hello Dev’s

Please check my context and help with setup for PJSIP. I’m using asterisk and freepbx with 2 x USB_DONGLE, general configuration works for long time (3 years).

After i change to PJSIP i have some problems…
Calls are working - in and out.

SMS and USSD messages have problems :rage:

SMS - can send and receive SMS only by 1st dongle0
USSD - can’t send and can’t receive

[from-trunk-dongle]
exten => sms,1,Verbose(Incoming SMS from ${CALLERID(num)} ${BASE64_DECODE(${SMS_BASE64})})
exten => sms,n,System(echo “To: [email protected]\nSubject: Incoming SMS from: ${CALLERID(num)=${FILTER(0-9,${CALLERID(NUM)})}}\n\nTEXT SMS\n${STRFTIME(${EPOCH},Date: %Y-%m-%d\nTime: %H:%M:%S)} \nModem: ${DONGLENAME}\nSMS from number: ${CALLERID(num)}\n\n” > /tmp/sms.txt)
exten => sms,n,Set(FILE(/tmp/sms.txt,a)=${BASE64_DECODE(${SMS_BASE64})})
exten => sms,n,System(sendmail -t < /tmp/sms.txt)
exten => sms,n,Set(MESSAGE(body)=${BASE64_DECODE(${SMS_BASE64})})
exten => sms,n,Set(fullcid=“${FILTER(0-9,${CALLERID(NUM)})}”(pjsip:778551148,${CALLERID(num)=${FILTER(0-9,${CALLERID(NUM)})}})
exten => sms,n,MessageSend(pjsip:778551148,${CALLERID(num)})
exten => sms,n,NoOp(Send SMS status: ${MESSAGE_SEND_STATUS})
exten => sms,n,Hangup()

exten => ussd,1,Noop(Incoming USSD: ${BASE64_DECODE(${USSD_BASE64})})
exten => ussd,n,System(echo ‘${STRFTIME(${EPOCH},%Y-%m-%d %H:%M:%S)} - ${DONGLENAME}: ${BASE64_DECODE(${USSD_BASE64})}’ >> /var/log/asterisk/ussd.txt)
exten => ussd,n,Hangup()

exten => _.,1,Set(CALLERID(name)=${CALLERID(num)})
exten => _.,n,Goto(from-trunk,${EXTEN},1)
exten => _.,n,Hangup()

;
[textmessage]
exten => 778551148,1,NoOp(SMS receiving dialplan invoked)
exten => 778551148,n,NoOp(To ${MESSAGE(to)})
exten => 778551148,n,NoOp(From ${MESSAGE(from)})
exten => 778551148,n,NoOp(Body ${MESSAGE(body)})
exten => 778551148,n,Set(ACTUALTO=${CUT(MESSAGE(to),@,1)})
exten => 778551148,n,MessageSend(${ACTUALTO},${MESSAGE(from)})
exten => 778551148,n,NoOp(Send status is ${MESSAGE_SEND_STATUS})
exten => 778551148,n,GotoIf($[“${MESSAGE_SEND_STATUS}” != “SUCCESS”]? sendfailedmsg)
exten => 778551148,n,Hangup()
;
; Handle failed messaging
exten => 778551148,n(sendfailedmsg),Set(MESSAGE(body)=“[${STRFTIME(${EPOCH}, %d%m%Y-%H:%M:%S)}] Your message to ${EXTEN} has failed. Retry later.”)
exten => 778551148,n,Set(ME_1=${CUT(MESSAGE(from),<,2)})
exten => 778551148,n,Set(ACTUALFROM=${CUT(ME_1,@,1)})
exten => 778551148,n,MessageSend(${ACTUALFROM},ServiceCenter)
exten => 778551148,n,Hangup()

exten => +778551148,1,NoOp(SMS receiving dialplan invoked)
exten => +778551148,n,NoOp(To ${MESSAGE(to)})
exten => +778551148,n,NoOp(From ${MESSAGE(from)})
exten => +778551148,n,NoOp(Body ${MESSAGE(body)})
exten => +778551148,n,Set(ACTUALTO=${CUT(MESSAGE(to),@,1)})
exten => +778551148,n,MessageSend(${ACTUALTO},${MESSAGE(from)})
exten => +778551148,n,NoOp(Send status is ${MESSAGE_SEND_STATUS})
exten => +778551148,n,GotoIf($[“${MESSAGE_SEND_STATUS}” != “SUCCESS”]? sendfailedmsg)
exten => +778551148,n,Hangup()
;
; Handle failed messaging
exten => +778551148,n(sendfailedmsg),Set(MESSAGE(body)=“[${STRFTIME(${EPOCH}, %d%m%Y-%H:%M:%S)}] Your message to ${EXTEN} has failed. Retry later.”)
exten => +778551148,n,Set(ME_1=${CUT(MESSAGE(from),<,2)})
exten => +778551148,n,Set(ACTUALFROM=${CUT(ME_1,@,1)})
exten => +778551148,n,MessageSend(${ACTUALFROM},ServiceCenter)
exten => +778551148,n,Hangup()

exten => _XXX,1,NoOp(SMS receiving dialplan invoked)
exten => _XXX,n,NoOp(To ${MESSAGE(to)})
exten => _XXX,n,NoOp(From ${MESSAGE(from)})
exten => _XXX,n,NoOp(Body ${MESSAGE(body)})
exten => _XXX,n,Set(ACTUALTO=${CUT(MESSAGE(to),@,1)})
exten => _XXX,n,MessageSend(${ACTUALTO},${MESSAGE(from)})
exten => _XXX,n,NoOp(Send status is ${MESSAGE_SEND_STATUS})
exten => _XXX,n,GotoIf($[“${MESSAGE_SEND_STATUS}” != “SUCCESS”]? sendfailedmsg)
exten => _XXX,n,Hangup()
;
; Handle failed messaging
exten => _XXX,n(sendfailedmsg),Set(MESSAGE(body)=“[${STRFTIME(${EPOCH}, %d%m%Y-%H:%M:%S)}] Your message to ${EXTEN} has failed. Retry later.”)
exten => _XXX,n,Set(ME_1=${CUT(MESSAGE(from),<,2)})
exten => _XXX,n,Set(ACTUALFROM=${CUT(ME_1,@,1)})
exten => _XXX,n,MessageSend(${ACTUALFROM},ServiceCenter)
exten => _XXX,n,Hangup()

;
exten => _[+0-9]XXX.,1,NoOp(Sending outbound SMS from mobile)
exten => _[+0-9]XXX.,n,DongleSendSMS(dongle0,${EXTEN},${MESSAGE(body)},true)
exten => _[+0-9]XXX.,n,Hangup

The ussd code doesn’t touch chan_pjsip, and neither bit of code seems to touch FreePBX. I don’t think PJSIP has anything to do with this, and I think you really need to reach out to the chan_dongle community.

Pls can You look at context?
what im missing?

Im trying to use this SETUP

Receive SMS and USSD

[dongle-incoming-sms]
exten => sms,1,Noop(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()

[dongle-incoming-ussd]
exten => ussd,1,Noop(Incoming USSD: ${BASE64_DECODE(${USSD_BASE64})})
exten => ussd,n,System(echo ‘${STRFTIME(${EPOCH},%Y-%m-%d %H:%M:%S)} - ${DONGLENAME}: ${BASE64_DECODE(${USSD_BASE64})}’ >> /var/log/asterisk/ussd.txt)
exten => ussd,n,Hangup()

[dongle-incoming]
include => dongle-incoming-sms
include => dongle-incoming-ussd

By the code, I meant your dialplan code. It’s pure Asterisk code, with no knowledge of FreePBX, and, as I said, the ussd part of it doesn’t reference PJSIP in any way, so will not be affected by moving between channel drivers.z