[Home]

Summary:ASTERISK-19302: Messagesend
Reporter:benasse (benasse)Labels:
Date Opened:2012-02-06 09:14:00.000-0600Date Closed:2012-02-06 12:18:52.000-0600
Priority:MinorRegression?
Status:Closed/CompleteComponents:Channels/chan_sip/General
Versions:10.1.0 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:SIP messaging

Try to chat with sip messaging but on the answer the messages are send to asterisk not at the user.

sip.conf :
[100]
type=friend
callerid="bebe" <100>
username=100
host=dynamic
secret=toto
dtmfmode=rfc2833
qualify=yes
context=default
disallow=all
allow=alaw
allow=h263
allow=h263p
allow=h264

[101]
type=friend
callerid="titi" <101>
username=101
host=dynamic
secret=toto
dtmfmode=rfc2833
qualify=yes
context=default
disallow=all
allow=alaw
allow=h263
allow=h263p
allow=h264




extension.conf :
[messages]
exten => _[a-z0-9].,1,NoOp(Send message)
exten => _[a-z0-9].,n,Set(MESSAGE(from)=${MESSAGE(from)})
exten => _[a-z0-9].,n,NoOp(${MESSAGE(to)})
exten => _[a-z0-9].,n,MessageSend(${MESSAGE(to):0:-14})







Am I using it good ?




sip debug :

SIP Debugging enabled
*CLI>
<--- SIP read from UDP:10.128.19.201:45024 --->
MESSAGE sip:101@10.128.15.201 SIP/2.0
Via: SIP/2.0/UDP 10.128.19.201:45024;branch=z9hG4bK-d8754z-56b65d195534b2fd-1---d8754z-;rport
Max-Forwards: 70
To: "101"<sip:101@10.128.15.201>
From: "100"<sip:100@10.128.15.201>;tag=84f8fcf5
Call-ID: MGIyM2ZkOTVlYzhiNzJmYzY2Yzk3YWNjMzk2ZjMxZDM.
CSeq: 15 MESSAGE
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
Content-Type: application/im-iscomposing+xml
User-Agent: X-Lite 4 release 4.1 stamp 63214
Authorization: Digest username="100",realm="asterisk",nonce="0ec22756",uri="sip:101@10.128.15.201",response="51fee875756120228a8ba4f57cf0bbd9",algorithm=MD5
Content-Length: 312

<?xml version='1.0' encoding='UTF-8'?>
<isComposing xmlns='urn:ietf:params:xml:ns:im-iscomposing' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'> <state>active</state> <lastactive>2012-02-06T15:08:35Z</lastactive> <contenttype>text/html</contenttype> <refresh>60</refresh>
</isComposing>
<------------->
--- (12 headers 3 lines) ---
Receiving message!

<--- Transmitting (NAT) to 10.128.19.201:45024 --->
SIP/2.0 415 Unsupported Media Type
Via: SIP/2.0/UDP 10.128.19.201:45024;branch=z9hG4bK-d8754z-56b65d195534b2fd-1---d8754z-;received=10.128.19.201;rport=45024
From: "100"<sip:100@10.128.15.201>;tag=84f8fcf5
To: "101"<sip:101@10.128.15.201>;tag=as73a45a25
Call-ID: MGIyM2ZkOTVlYzhiNzJmYzY2Yzk3YWNjMzk2ZjMxZDM.
CSeq: 15 MESSAGE
Server: Asterisk PBX 10.1.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Length: 0


<------------>
Scheduling destruction of SIP dialog 'MGIyM2ZkOTVlYzhiNzJmYzY2Yzk3YWNjMzk2ZjMxZDM.' in 32000 ms (Method: MESSAGE)

<--- SIP read from UDP:10.128.17.123:5060 --->
jaK
<------------->

<--- SIP read from UDP:10.128.19.201:45024 --->
MESSAGE sip:101@10.128.15.201 SIP/2.0
Via: SIP/2.0/UDP 10.128.19.201:45024;branch=z9hG4bK-d8754z-9bf927330b3b7ccf-1---d8754z-;rport
Max-Forwards: 70
To: "101"<sip:101@10.128.15.201>
From: "100"<sip:100@10.128.15.201>;tag=84f8fcf5
Call-ID: MGIyM2ZkOTVlYzhiNzJmYzY2Yzk3YWNjMzk2ZjMxZDM.
CSeq: 16 MESSAGE
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
Content-Type: text/plain
User-Agent: X-Lite 4 release 4.1 stamp 63214
Authorization: Digest username="100",realm="asterisk",nonce="0ec22756",uri="sip:101@10.128.15.201",response="51fee875756120228a8ba4f57cf0bbd9",algorithm=MD5
Content-Length: 4

toto
<------------->
--- (12 headers 1 lines) ---
Receiving message!
Looking for 101 in messages (domain 10.128.15.201)

<--- Transmitting (NAT) to 10.128.19.201:45024 --->
SIP/2.0 202 Accepted
Via: SIP/2.0/UDP 10.128.19.201:45024;branch=z9hG4bK-d8754z-9bf927330b3b7ccf-1---d8754z-;received=10.128.19.201;rport=45024
From: "100"<sip:100@10.128.15.201>;tag=84f8fcf5
To: "101"<sip:101@10.128.15.201>;tag=as06ec8b7e
Call-ID: MGIyM2ZkOTVlYzhiNzJmYzY2Yzk3YWNjMzk2ZjMxZDM.
CSeq: 16 MESSAGE
Server: Asterisk PBX 10.1.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Length: 0


<------------>
Scheduling destruction of SIP dialog 'MGIyM2ZkOTVlYzhiNzJmYzY2Yzk3YWNjMzk2ZjMxZDM.' in 32000 ms (Method: MESSAGE)
   -- Executing [101@messages:1] NoOp("Message/ast_msg_queue", "Send message") in new stack
   -- Executing [101@messages:2] Set("Message/ast_msg_queue", "MESSAGE(from)=sip:100@10.128.15.201") in new stack
   -- Executing [101@messages:3] NoOp("Message/ast_msg_queue", "sip:101@10.128.15.201") in new stack
   -- Executing [101@messages:4] MessageSend("Message/ast_msg_queue", "sip:101") in new stack
Reliably Transmitting (NAT) to 10.128.17.123:5060:
MESSAGE sip:101@10.128.17.123;line=ee515fb4035ac82 SIP/2.0
Via: SIP/2.0/UDP 10.128.15.201:5060;branch=z9hG4bK5d72134c;rport
Max-Forwards: 70
From: "asterisk" <sip:asterisk@10.128.15.201>;tag=as209f3717
To: <sip:101@10.128.17.123;line=ee515fb4035ac82>
Contact: <sip:asterisk@10.128.15.201:5060>
Call-ID: 3103338d0232e9a352f8acbb5fe30749@127.0.1.1:0
CSeq: 102 MESSAGE
User-Agent: Asterisk PBX 10.1.0
Content-Type: text/plain;charset=UTF-8
Content-Length: 4

toto
---
Scheduling destruction of SIP dialog '3103338d0232e9a352f8acbb5fe30749@127.0.1.1:0' in 6400 ms (Method: MESSAGE)
   -- Auto fallthrough, channel 'Message/ast_msg_queue' status is 'UNKNOWN'

<--- SIP read from UDP:10.128.17.123:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.128.15.201:5060;branch=z9hG4bK5d72134c;rport=5060
From: "asterisk" <sip:asterisk@10.128.15.201>;tag=as209f3717
To: <sip:101@10.128.17.123;line=ee515fb4035ac82>;tag=1454076274
Call-ID: 3103338d0232e9a352f8acbb5fe30749@127.0.1.1:0
CSeq: 102 MESSAGE
User-Agent: Linphone/3.5.0 (eXosip2/3.3.0)
Content-Length: 0

<------------->
--- (8 headers 0 lines) ---
Really destroying SIP dialog '3103338d0232e9a352f8acbb5fe30749@127.0.1.1:0' Method: MESSAGE

<--- SIP read from UDP:10.128.17.123:5060 --->
MESSAGE sip:asterisk@10.128.15.201 SIP/2.0
Via: SIP/2.0/UDP 10.128.17.123:5060;rport;branch=z9hG4bK1860991468
From: <sip:101@10.128.15.201>;tag=8878175
To: "asterisk" <sip:asterisk@10.128.15.201>
Call-ID: 112815453
CSeq: 20 MESSAGE
Content-Type: text/plain
Max-Forwards: 70
User-Agent: Linphone/3.5.0 (eXosip2/3.3.0)
Content-Length: 3

fgf
<------------->
--- (10 headers 1 lines) ---
Receiving message!
Looking for asterisk in messages (domain 10.128.15.201)
   -- Executing [asterisk@messages:1] NoOp("Message/ast_msg_queue", "Send message") in new stack

<--- Transmitting (NAT) to 10.128.17.123:5060 --->
SIP/2.0 202 Accepted
Via: SIP/2.0/UDP 10.128.17.123:5060;branch=z9hG4bK1860991468;received=10.128.17.123;rport=5060
From: <sip:101@10.128.15.201>;tag=8878175
To: "asterisk" <sip:asterisk@10.128.15.201>;tag=as21ad434a
Call-ID: 112815453
CSeq: 20 MESSAGE
Server: Asterisk PBX 10.1.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Length: 0


<------------>
   -- Executing [asterisk@messages:2] Set("Message/ast_msg_queue", "MESSAGE(from)=sip:101@10.128.15.201") in new stack
Scheduling destruction of SIP dialog '112815453' in 32000 ms (Method: MESSAGE)
   -- Executing [asterisk@messages:3] NoOp("Message/ast_msg_queue", "sip:asterisk@10.128.15.201") in new stack
   -- Executing [asterisk@messages:4] MessageSend("Message/ast_msg_queue", "sip:asterisk") in new stack
[Feb  6 16:09:13] ERROR[23615]: netsock2.c:263 ast_sockaddr_resolve: getaddrinfo("asterisk", "(null)", ...): Temporary failure in name resolution
[Feb  6 16:09:13] WARNING[23615]: chan_sip.c:5469 create_addr: No such host: asterisk
Really destroying SIP dialog '12d15cbf1fdd69e17de47526728c4026@127.0.1.1:0' Method: MESSAGE
   -- Auto fallthrough, channel 'Message/ast_msg_queue' status is 'UNKNOWN'





To make the answer working i do this in the extension.conf
exten => _[a-z0-9].,1,NoOp(Send message)
exten => _[a-z0-9].,n,NoOp(${SIPFROMUSER})
exten => _[a-z0-9].,n,Set(SIPFROMUSER=${MESSAGE(from):4:-14})
exten => _[a-z0-9].,n,MessageSend(${MESSAGE(to):0:-14},${SIPFROMUSER})
Comments:By: Richard Mudgett (rmudgett) 2012-02-06 12:18:31.445-0600

What you are showing is duplicated by ASTERISK-18992 and ASTERISK-18917.  Those fixes will be in Asterisk v10.2.0.

How to use questions are best discussed on the asterisk-users mailing list or IRC #asterisk.

The MessageSend(from) parameter accepts the following:
known peer name or
"display-name" <uri>

Currently Asterisk only accepts incoming MESSAGE's of Content-Type text/plain.