SIP instant messages

Hello

Does asterisk support SIP text messages? Do I need to enable something?
I have ekiga client but messages don’t work.

Regards

Marek

Here is sip debug from asterisk:

<— SIP read from 10.9.9.10:5065 —>
MESSAGE sip:50@loris SIP/2.0
CSeq: 22 MESSAGE
Via: SIP/2.0/UDP 10.9.9.10:5065;branch=z9hG4bK6c2a066a-088f-dd11-9c2c-004048b26f14;rport
From: “M Z” sip:marek@loris;tag=ec0e066a-088f-dd11-9c2c-004048b26f14
Call-ID: cac7056a-088f-dd11-9c2c-004048b26f14@dl-master
To: “50@” sip:50@loris
Allow: INVITE,ACK,OPTIONS,BYE,CANCEL,NOTIFY,REFER,MESSAGE
Content-Type: text/plain;charset=UTF-8
Content-Length: 4
Max-Forwards: 70

Test
<------------->
— (10 headers 1 lines) —
Receiving message!

<— Transmitting (no NAT) to 10.9.9.10:5065 —>
SIP/2.0 415 Unsupported Media Type
Via: SIP/2.0/UDP 10.9.9.10:5065;branch=z9hG4bK6c2a066a-088f-dd11-9c2c-004048b26f14;received=10.9.9.10;rport=5065
From: “M Z” sip:marek@loris;tag=ec0e066a-088f-dd11-9c2c-004048b26f14
To: “50@” sip:50@loris;tag=as1844019c
Call-ID: cac7056a-088f-dd11-9c2c-004048b26f14@dl-master
CSeq: 22 MESSAGE
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Content-Length: 0

<------------>
Scheduling destruction of SIP dialog ‘cac7056a-088f-dd11-9c2c-004048b26f14@dl-master’ in 32000 ms (Method: MESSAGE)

Subject to this caveat, yes:

9819 /*! \brief Receive SIP MESSAGE method messages
9820 \note We only handle messages within current calls currently
9821 Reference: RFC 3428 */

However, violating that would trip this error:

9854 } else { /* Message outside of a call, we do not support that /
9855 ast_log(LOG_WARNING,“Received message to %s from %s, dropped it…\n Content-Type:%s\n Message: %s\n”, get_header(req,“To”), get_header(req,“From”), content_type, buf);
9856 transmit_response(p, “405 Method Not Allowed”, req); /
Good enough, or? */

When you’ve actually tripped this one:

9828 if (strncmp(content_type, “text/plain”, strlen(“text/plain”))) { /* No text/plain attachment /
9829 transmit_response(p, “415 Unsupported Media Type”, req); /
Good enough, or? */

Which exact version are you using. This was taken form the 1.4 SVN head version as of now. It may have been broken at some time in the past.

I have Asterisk 1.4.17 from debian stable.

So, asterisk doesn’t support messages outside the call? It is a little bit sad. Do you plan to support that one time?

Anyway, messages within the call can be sill very helpful. If I understood, problem is charset=UTF-8 in my message. Can I do something with that? Specifying charset is not supported? I think asterisk shouldn’t care about content type at all as long as it does no transcoding.

I did the test.

I edited the binary of libopal used by ekiga and I put there \0 instead of ; in content type. (There was no other way to cut off ;charset=UTF-8.)

I made a call and during that call I sent the message. It didn’t work. The error message iis different but I don’t understand what is wrong now?

<— SIP read from 10.9.9.10:5065 —>
MESSAGE sip:50@loris SIP/2.0
CSeq: 6 MESSAGE
Via: SIP/2.0/UDP 10.9.9.10:5065;branch=z9hG4bKf6bb20bd-e78f-dd11-97e1-004048b26f14;rport
From: “M Z” sip:marek@loris;tag=44a020bd-e78f-dd11-97e1-004048b26f14
Call-ID: 6a3920bd-e78f-dd11-97e1-004048b26f14@dl-master
To: “50@” sip:50@loris
Allow: INVITE,ACK,OPTIONS,BYE,CANCEL,NOTIFY,REFER,MESSAGE
Content-Type: text/plain
Content-Length: 5
Max-Forwards: 70

pokus
<------------->
— (10 headers 1 lines) —
Receiving message!
[Oct 3 20:35:36] WARNING[10646]: chan_sip.c:9623 receive_message: Received message to “50@” sip:50@loris from “M Z” sip:marek@loris;tag=44a020bd-e78f-dd11-97e1-004048b26f14, dropped it…
Content-Type:text/plain
Message: pokus

<— Transmitting (no NAT) to 10.9.9.10:5065 —>
SIP/2.0 405 Method Not Allowed
Via: SIP/2.0/UDP 10.9.9.10:5065;branch=z9hG4bKf6bb20bd-e78f-dd11-97e1-004048b26f14;received=10.9.9.10;rport=5065
From: “M Z” sip:marek@loris;tag=44a020bd-e78f-dd11-97e1-004048b26f14
To: “50@” sip:50@loris;tag=as15dd86a2
Call-ID: 6a3920bd-e78f-dd11-97e1-004048b26f14@dl-master
CSeq: 6 MESSAGE
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Content-Length: 0

<------------>

Remember that this is a peer support forum, so many of the answers don’t come from Asterisk developers. Whether features get added, to a large extent, depends on whether anyone volunteers to write the code for them.

With the SVN head version of 1.4, it appeared to me that the ;charset would make no difference. I was speculating that earlier versions were confused by it, which is why I asked for the exact version.

Terminating the string may well cause all following headers to be ignored.