How to transfer pjsip simple sip message

I used chan_dongle to recvice sms message. How to transfer this to pjsip message. Please

I can only receive SIM card messages into CLR, or send “simlple sip” messages between extensions
vi /etc/asterisk/extensions_custom.conf
[from-SIM]
exten => s,n,goto(from-trunk,${DONGLEIMEI},1)
exten => sms,1,Verbose(Incoming SMS from ${CALLERID(num)} ${SMS})
exten => sms,n,System(echo ‘${STRFTIME(${EPOCH},%Y-%m-%d %H:%M:%S)} - ${DONGLENAME} - ${CALLERID(num)}: ${SMS}’ >> /var/log/asterisk/sms.log)
exten => sms,n,Hangup()
exten => ussd,1,Verbose(Incoming USSD: ${USSD})
exten => ussd,n,System(echo ‘${STRFTIME(${EPOCH},%Y-%m-%d %H:%M:%S)} - ${DONGLENAME} : ${USSD}’ >> /var/log/asterisk/ussd.log)
exten => ussd,n,Hangup()

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

I misunderstood what you meant by ACTUALTO in the original example.

This is an Asterisk forum, and Asterisk does not use the term “extension” in the same way as FreePBX. By extension 1, I assume you really meant endpoint PJSIP/1.

It is difficult to read the logs as they have not been marked up as pre-formatted text, so the forum is interpreting parts of them as invalid markup and removing it. However, the From line appears to be malformed and the To line contains an undefined scheme, “pjsip”.

Also, for some reason, you have removed the parameters from the dialplan, which also make it difficult to understand what is being done.

If you actually want it to go to PSIP/1, you must either hard code the destination of MessageSend to be pjsip:1 (assuming that exists), or you must examine the metadata or data of the message and set the destination based on that. Currently you seem to be taking the, malformed, URI in the To metadata and using the bogus scheme and suer part to directly form the destination. As it starts pjsip:2@ … that means you send the message to endpoint PJSIP/2., which the log say was done successfully, in spite of the malformed From and To information.

Please note that any advice, from this forum, is likely to assume you have complete control of the dialplan, which is not generally the case for FreePBX.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.