Hi,
I take a look at several post on this forum and I googled a day. The procedure to add messaging support seems fair simple but in my asterisk server (13.8.1) it does not work.
Here my sip.conf:
[general]
accept_outofcall_message = yes
outofcall_message_context = messages
auth_message_requests = no
– Executing [6011@messages:1] MessageSend(“Message/ast_msg_queue”, “sip:6011,”““6007” sip:mario@192.168.0.3”) in new stack
[Apr 28 17:01:38] WARNING[10735][C-00000000]: chan_sip.c:6225 create_addr: Purely numeric hostname (6011), and not a peer–rejecting!
– Auto fallthrough, channel ‘Message/ast_msg_queue’ status is ‘UNKNOWN’
I think the problem regarding the purely numeric hostname means I should have something like sip:6011@192.168.0.3
which is the localhost. I don’t understand why and how have I to configure the messages context.
Moreover the syntax of the MessageSend command seems to have a quotation mark (") which should not be there.
Hi astbox, thank you for the reply.
I am developing a sip phone with some I/O. The idea is to send a message from a softphone (linphone or csipsimple), according to the message content I want to to set the outputs and send back a message with the state of the inputs.
The message will be send from the softphone to asterisk, retrieve some data and output that data to the softphone?
Or do you want to send the message to another user, then the user inputs the data and sends back the message?
Yes, I tested tons of examples, also with the above command I get “Purely numeric hostname” error:
[Apr 29 04:37:50] NOTICE[14203]: chan_sip.c:24403 handle_response_peerpoke: Peer ‘mario’ is now Reachable. (29ms / 2000ms)
– Executing [6011@messages:1] Set(“Message/ast_msg_queue”, “MESSAGE(body)=“My message””) in new stack
– Executing [6011@messages:2] MessageSend(“Message/ast_msg_queue”, “sip:6011,sip:”) in new stack
[Apr 29 04:38:20] WARNING[14153][C-00000000]: chan_sip.c:6225 create_addr: Purely numeric hostname (6011), and not a peer–rejecting!
There is something wrong I my conf. I am unable to find the problem.
Just for testing purposes hardcode the from option because there is nothing filled using the CALLERID variable. Run the following command in the asterisk cli and post here the output
ubuntuserver*CLI> sip show peers
Name/username Host Dyn Forcerport Comedia ACL Port Status Description
mario/mario 192.168.0.210 D No No 5060 OK (273 ms)
pc1/pc1 192.168.0.21 D No No 5060 OK (19 ms)
scheda1 (Unspecified) D No No 0 UNKNOWN
3 sip peers [Monitored: 2 online, 1 offline Unmonitored: 0 online, 0 offline]
– Executing [6007@messages:1] NoOp(“Message/ast_msg_queue”, “SMS receiving dialplan invoked”) in new stack
– Executing [6007@messages:2] NoOp(“Message/ast_msg_queue”, “To sip:6007@192.168.0.3”) in new stack
– Executing [6007@messages:3] NoOp(“Message/ast_msg_queue”, “From sip:pc1@192.168.0.3”) in new stack
– Executing [6007@messages:4] NoOp(“Message/ast_msg_queue”, “Body ciao”) in new stack
– Executing [6007@messages:5] MessageSend(“Message/ast_msg_queue”, “sip:6007,”“sip:pc1@192.168.0.3”) in new stack
[Apr 29 15:37:53] WARNING[3187][C-00000000]: chan_sip.c:6225 create_addr: Purely numeric hostname (6007), and not a peer–rejecting!
– Executing [6007@messages:6] Hangup(“Message/ast_msg_queue”, “”) in new stack
== Spawn extension (messages, 6007, 6) exited non-zero on ‘Message/ast_msg_queue’
I can send a message from sip:pc1 to sip:mario. But why I can’t set a general rule using sip:${EXTEN}?
– Executing [6007@messages:1] NoOp(“Message/ast_msg_queue”, “SMS receiving dialplan invoked”) in new stack
– Executing [6007@messages:2] NoOp(“Message/ast_msg_queue”, “To sip:6007@192.168.0.3”) in new stack
– Executing [6007@messages:3] NoOp(“Message/ast_msg_queue”, “From sip:pc1@192.168.0.3”) in new stack
– Executing [6007@messages:4] NoOp(“Message/ast_msg_queue”, “Body ciao”) in new stack
– Executing [6007@messages:5] MessageSend(“Message/ast_msg_queue”, “sip:mario,”“sip:pc1@192.168.0.3”) in new stack
– Executing [6007@messages:6] Hangup(“Message/ast_msg_queue”, “”) in new stack
== Spawn extension (messages, 6007, 6) exited non-zero on ‘Message/ast_msg_queue’
I think I have to traslate the “TO” field from the extension sip:6007 to the peer sip:mario…
But why all the examples I found use the sip:${EXTEN} to define the message receiver?
The following work, but have I to replicate this for all the extensions. In particular the SendMessage statement in which I associate manually the extension to the peer.
; = SIP MESSAGE only works if in sip.conf "accept_outofcall_message=yes" is set! =
exten => 6007,1,GotoIf($[${LEN(${MESSAGE(from)})} < 1]?nomessage)
exten => 6007,n,NoOp(Message from: ${MESSAGE(from)})
exten => 6007,n,NoOp(Message to: ${MESSAGE(to)})
exten => 6007,n,NoOp(Message body: ${MESSAGE(body)})
;
exten => 6007,n,MessageSend(sip:mario,"${CALLERID(name)}"${MESSAGE(from)})
;
exten => 6007,n,NoOp(Message send status: ${MESSAGE_SEND_STATUS})
exten => 6007,n,HangUp
exten => 6007,n(nomessage),Dial(SIP/mypeername,30)
exten => 6007,n,HangUp
What you put between the [] at the first line is what asterisk understands as a sip extension. Normally you put a number there and then you use the callerid option to give a more user friendly name to the extension.
sip.conf contains device names. Although it is bad security practice and won’t work in multi-homed environments, most people make the device name the same as the principle extension number for that device.
@peregrinus
From the tests that you have made for messaging to work you need to dial the actual sip extension and not what you map as a shortcode to this extension.
There are two ways doing this 1) you change the sip extension from a name to the number that you want to use 2) to keep consistency with the example that you used to configure your server, you keep using strings as the sip extensions and change your dialplan accordicly to send the message to this extenion.
Thank you astbox,
the solution 2, you provide works!!
but I suspect that if I use the solution 1, which david551 describes as a bad practice, I can avoid a lot of troubles.