SIP Simple in FreePBX 16.x still doesn't work

Running Freepbx 16.20.x

Ok. I updated /etc/asterisk/pjsip.endpoint_custom.conf with
[end-point](+)
message_context = messages

and in /etc/asterisk/extensions_custom.conf I put
[from-internal-custom]
message_context = messages

I got this information from issue 53993 (freepbx-14-04-5-how-to-enable-sip-simple-message/53993)

However, now, instead of text messages triggering a call, I get text messages reporting “Error not found (404)”

Can someone please tell me what I’m doing wrong in following these instructions?

Revert all the changes you’ve done. Locate the file pjsip.endpoint_custom_post.conf and add the lines:

[6009](+type=endpoint)
message_context = messages

Do a reload. The part in the squre brackets must match exactly the corresponding context in pjsip.endpoint.conf. You can see the changes before and after from the bash prompt with:

# asterisk -x " pjsip show endpoint 6009"  | grep message_context
 message_context                    : 
# fwconsole reload
# asterisk -x " pjsip show endpoint 6009"  |grep message_context
 message_context                    : messages

Did all the steps. Still not working. Still getting a 404. If you need me to show you a log, feel free to tell me which and where to find it.

Removed the extensions_custom.conf text. Emptied pjsip.endpoint_custom_post.conf (where I added the text before).

grep \[ /etc/asterisk/pjsip.endpoint.conf | while read LINE; do echo -n $LINE; echo ‘(+type=endpoint)’; echo “message_context = messages” ; done >> /etc/asterisk/pjsip.endpoint_custom_post.conf

fwconsole reload

asterisk -rx " pjsip show endpoint 42" | grep message_context

Shows:

message_context : messages

The messages_context parameter is exposed in the GUI. You don’t need to edit custom conf files for this.

PJSIP extension - Advanced tab - find it after Outbound Proxy.

This part is incorrect. You would need to define a context called [messages] not put this parameter in [from-internal-custom].

Your context might look like this if you just want to relay SIP messages among users internally:

[messages]
; Deliver to local 4-digit extension
exten => _XXXX,1,Set(FROMUSER=${CUT(MESSAGE(from),<,2)})
same => n,Set(FROMUSER=${CUT(FROMUSER,@,1)})
same => n,Set(FROMUSER=${CUT(FROMUSER,:,2)})
same => n,Set(DIALSTRING=${DB(DEVICE/${EXTEN}/dial)})
same => n,Set(TODEVICE=${TOLOWER(${STRREPLACE(DIALSTRING,"/",":")})})
same => n,MessageSend(${TODEVICE},${FROMUSER})

the DB lookup and string manipulation allows this to work across different channel drivers that support MessageSend.

1 Like

Ok - the GUI item you gave me and the pjsip.endpoints_custom_post.conf seem to have made the same change in the 2 files. That’s great. I can do it in the GUI. I’ve switched over.

What if i want ALL numbers to relay internally? Or all numbers up to a certain number of characters? What is the exten command syntax? And what file should I be putting this [mesages] context into?

I mean - do I have to list each extension separately? They should all have the same behavior. Again, if there is a syntax page for the dialplan that explains this in more detail, I would be happy to read it. Not sure I’ll understand it. LOL.

Oh - and before I forget - I’m only using PJSIP and only relaying inside my PBX.

Thanks.

You can just put the block I gave you at the end of extensions_custom.conf. How long are your extension numbers? If they’re four digits long, you can use it as is. Otherwise just change the _XXXX to the right length.

Set the messages context for every extension that you want to participate in SIP messaging.

https://wiki.asterisk.org/wiki/display/AST/Pattern+Matching

I have some that are 2 characters, some that are 4 characters and some that are 5 characters.

Will I need a separate exten section for each? Is there a way to have them all be in the one?

I used this:

[messages]
; Deliver to local 4-digit extension
exten => _XX!,1,Set(FROMUSER=${CUT(MESSAGE(from),<,2)})
same => n,Set(FROMUSER=${CUT(FROMUSER,@,1)})
same => n,Set(FROMUSER=${CUT(FROMUSER,:,2)})
same => n,Set(DIALSTRING=${DB(DEVICE/${EXTEN}/dial)})
same => n,Set(TODEVICE=${TOLOWER(${STRREPLACE(DIALSTRING,"/",":")})})
same => n,MessageSend(${TODEVICE},${FROMUSER})

I take it back. I’m still getting the error. Just not right away. Now the error is Request timeout 408.

You can run sngrep from the Linux root shell to watch SIP activity and see what is happening.

If you are getting a 408 then something is blocking or ignoring you.

The topic you mentioned isn’t a link so I don’t know what you followed to get to this point. What phones are you using? Why do you say “still doesn’t work”–did you try this setup before and not succeed?

I’m too new to post links, but the issue number is from this forum. So is the link.

https : / / community .freepbx.org / t / freepbx-14-04-5-how-to-enable-sip-simple-message/53993 (remove spaces for link)

So I put the block in like you said - I have exactly nothing else in extensions_custom.conf

I’m using ZOIPER to send the text message from one phone to the other. Samsung Galaxy S series. Zoiper to zoiper.

I used the _XX! combination and it seemed to work.

Do you know how/where I can find the traceback for the SIP messages so that I can understand what it is that you were doing with the cut statements?

My VOIP SMS is working now. It just resolved itself. No idea why. I left the house. When I came back the phones started working.

Thanks.

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