However, we had some trouble setting up Asterisk to really do it. In the message-ctx Asterisk provides the information of the current message as variables/function: MESSAGE(to), MESSAGE(from) and MESSAGE(body).
(First problem)
The first problem is that MESSAGE(to) contains the complete address, e.g. sip:PHONENUMBER@SERVERIP. If you try to use this address asterisk sends the message to itself and complains on receive that their is no routing for the incoming message. So, we need to remove the @IP part using the CUT command from the TO and the FROM. Now we can send a message from one phone to another: MESSAGESEND(CUTED_TO, CUTED_FROM).
(Second probleme)
However, we cannot reply as the recipient got as sender address something like sip:UNKNOWN@SERVERIP.
In short use MESSAGESEND(CUTED_TO, CUTED_FROM <CUTED_FROM>) or as example MESSAGESEND(sip:1, SOMEBODY <1>). The first part of the FROM is the name shown to the user and the second part the reply to phone number (without sip:).
Here is our working context for messaging of the extensions.conf:
[message]
exten => _X.,1,Set(TO=${CUT(MESSAGE(to),@,1)})
exten => _X.,n,Set(FROM=${CUT(MESSAGE(from),:,2)})
exten => _X.,n,Set(FROM_PHONE_NUMBER=${CUT(FROM,@,1)})
Thanks for your information!
ReplyDeleteAccording to that, we could use MessageSend without CUTTING anything:
MessageSend( SIP:${EXTEN} , ${MESSAGE(from)} )
:) :)
Thanks for the suggestion but i am able to send these messages in only SIPSIMPLE client not in voip mobile phones
ReplyDelete