MessageSend help?

I’m very close to having SMS work on Asterisk. I overcame a couple hurdles but now I’m stuck and not sure what question to ask.
I followed the instructions I found here:

When I send a text to one of my voip.ms DIDs I see the text arrive on my Asterisk and the dialplan extension [sms-in] executes
but where does the message go from there? The dialplan context appears to be sending the message to Channel Message/ast_msg_queue.
What is that and where does it go from there?

– Executing [s@sms-in:1] NoOp(“Message/ast_msg_queue”, “Inbound SMS dialplan invoked by steve”) in new stack
– Executing [s@sms-in:2] NoOp(“Message/ast_msg_queue”, “To pjsip:198.144.184.240”) in new stack
– Executing [s@sms-in:3] NoOp(“Message/ast_msg_queue”, “From “3042505233” sip:[3042505233@newyork7.voip.ms](mailto:3042505233@newyork7.voip.ms)”) in new stack
– Executing [s@sms-in:4] NoOp(“Message/ast_msg_queue”, “Body Yet another text”) in new stack
– Executing [s@sms-in:5] Set(“Message/ast_msg_queue”, “ACTUAL_FROM=“3042505233” sip:[3042505233@newyork7.voip.ms](mailto:3042505233@newyork7.voip.ms)”) in new stack
– Executing [s@sms-in:6] Set(“Message/ast_msg_queue”, “HOST_TO=”) in new stack
– Executing [s@sms-in:7] Set(“Message/ast_msg_queue”, “NUMBER_TO=None”) in new stack
– Executing [s@sms-in:8] MessageSend(“Message/ast_msg_queue”, “pjsip:voipms@,“3042505233” sip:[3042505233@newyork7.voip.ms](mailto:3042505233@newyork7.voip.ms)”) in new stack
– Executing [s@sms-in:9] NoOp(“Message/ast_msg_queue”, “Send status is SUCCESS”) in new stack
– Executing [s@sms-in:10] Hangup(“Message/ast_msg_queue”, “”) in new stack
== Spawn extension (sms-in, s, 10) exited non-zero on ‘Message/ast_msg_queue’
<— Transmitting SIP request (521 bytes) to UDP:23.29.136.38:5060 —>
MESSAGE sip:183970_trunk@newyork7.voip.ms SIP/2.0
Via: SIP/2.0/UDP 198.144.184.240:5060;rport;branch=z9hG4bKPj33679b14-7f40-49e4-bb69-5d19aae94bee
From: “3042505233” sip:[3042505233@newyork7.voip.ms](mailto:3042505233@newyork7.voip.ms);tag=51eb33c0-e5b0-46f0-bfb4-9ee444cd6369
To: sip:[183970_trunk@newyork7.voip.ms](mailto:183970_trunk@newyork7.voip.ms)
Contact: sip:183970_trunk@198.144.184.240:5060
Call-ID: b3e39b1d-17b8-45e4-a547-b7e538162966
CSeq: 38952 MESSAGE
Max-Forwards: 70
User-Agent: Asterisk PBX 18.2.0
Content-Type: text/plain
Content-Length: 16

Yet another text
<— Received SIP response (527 bytes) from UDP:23.29.136.38:5060 —>
SIP/2.0 202 Accepted
Via: SIP/2.0/UDP 198.144.184.240:5060;branch=z9hG4bKPj33679b14-7f40-49e4-bb69-5d19aae94bee;received=198.144.184.240;rport=5060
From: “3042505233” sip:[3042505233@newyork7.voip.ms](mailto:3042505233@newyork7.voip.ms);tag=51eb33c0-e5b0-46f0-bfb4-9ee444cd6369
To: sip:[183970_trunk@newyork7.voip.ms](mailto:183970_trunk@newyork7.voip.ms);tag=as0487f324
Call-ID: b3e39b1d-17b8-45e4-a547-b7e538162966
CSeq: 38952 MESSAGE
Server: voip.ms
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0

This seems to be working. What is your problem?

The message actually appears to come form the pseudo channel you named, not go to it, and it goes to the specified dialplan, but it seems to be correctly reaching that, so that part of the configuration is working. Moreover, your dialplan seems to be successfully running message send, and the message seems to be being accepted by its destination.

Thanks for the reply. I see part of my confusion. I was misinterpreting the debug output. I thought it was sending my message To: messages/ast_msg_queue. No it means VIA messages/ast_msg_queue not To. Here is the thing I am still confused about. In the example here: TIPS - VoIP.ms SIP Messaging based SMS tuturial | The VoIP-info Forum he sends the text to three extensions. 701, 702, 703. That works but I was expecting some logic to route the sms to a certain extension based on what DID it was addressed to. Am I expecting too much?

The way that providers identify the original destination number is somewhat variable, so a more general example might be misleading.

On line 7 of [sms-in] context he gets the DID number the sms was sent to from the SIP message.
He just does not appear to use it. Should I create an endpoint in PJSIP.conf that matches that number?

[sms-in]
exten => _.,1,NoOp(Inbound SMS dialplan invoked)
exten => _.,n,NoOp(To ${MESSAGE(to)})
exten => _.,n,NoOp(From ${MESSAGE(from)})
exten => _.,n,NoOp(Body ${MESSAGE(body)})
exten => _.,n,Set(ACTUAL_FROM=${MESSAGE(from)})
exten => _.,n,Set(HOST_TO=${CUT(MESSAGE(to),@,2)})
exten => _.,n,Set(NUMBER_TO=${MESSAGE_DATA(X-SMS-To)})
exten => _.,n,MessageSend(pjsip:701@${HOST_TO},${ACTUAL_FROM}) ; Replace the example extension with yours.
exten => _.,n,NoOp(Send status is ${MESSAGE_SEND_STATUS})
exten => _.,n,MessageSend(pjsip:702@${HOST_TO},${ACTUAL_FROM}) ; Replace the example extension with yours.
exten => _.,n,NoOp(Send status is ${MESSAGE_SEND_STATUS})
exten => _.,n,MessageSend(pjsip:703@${HOST_TO},${ACTUAL_FROM}) ; Replace the example extension with yours.
exten => _.,n,NoOp(Send status is ${MESSAGE_SEND_STATUS})
exten => _.,n,Hangup()

You are pushing me beyond the limits of my knowledge, but PJSIP has a syntax that allows you to provide a full URI with an endpoint, with the endpoint contributing details other than the address.

I note that you are getting the value “None” in your traces.

Thanks for the reply. I think I understand it now. I fixed the “None” problem. That was just because of some change I made while troubleshooting. The example context [sms-in] in the link I posted sends the messages to 3 extensions regardless of what DID they were sent to. I think I just need to create an extension for my DID and modify the [sms-in] context to send it there. Thanks for the comments. It is starting to make sense now. -Steve

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