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:
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.
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.
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.
[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})
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?