Connection dropped by sip gateway

Hi List!

I have a problem with a sip provider, sending sip MESSAGE messages without a good reason. I don’t know how I could handle them in a way that the provider is happy with it. The problem is that when asterisk sends him the 415 error he just sends me a BYE next.

I am calling an ISDN number through the provider and the messages in question seems to be charge information. I tried to turn it off on the providers side, but there is no way to suppress it.

Here is the way it goes. First I get an OPTIONS request from the other side, asking for the options for the extension the provider issued to me, but at my host. I added myself to my extensions.conf this way:

[options]
exten => PROVIDER_NUMBER,1,NoOp()

Now the proxy get’s some OPTIONS for this pair, but definitly not indicating MESSAGE capabilties.

<-- SIP read from 212.144.24.38:5060:
OPTIONS sip:PROVIDER_NUMBER@MY_HOST_IP SIP/2.0
Via: SIP/2.0/UDP 212.144.24.38:5060;branch=z9hG4bKlct5k81080u1uocqe 341sh00000l1.1
To: “MY_NAME” sip:PROVIDER_NUMBER@VORWAHL.sip.arcor.de;tag=as58e5 b2dd
From: sip:CALLED_NUMBER@VORWAHL.sip.arcor.de;ta g=SD6trua99-0d80bc15
Call-ID: 0b551c9a39a78edd7c9efc0953a9b143@VORWAHL.sip.arcor .de
CSeq: 106 OPTIONS
Max-Forwards: 69
Content-Length: 0

Looking for PROVIDER_NUMBER in default (domain MY_HOST_IP)
Transmitting (no NAT) to 212.144.24.38:5060:
SIP/2.0 200 OK
Via: SIP/2.0/UDP 212.144.24.38:5060;branch=z9hG4bKlct5k81080u1uocqe 341sh00000l1.1;received=212.144.24.38
From: sip:CALLED_NUMBER@VORWAHL.sip.arcor.de;ta g=SD6trua99-0d80bc15
To: “MY_NAME” sip:PROVIDER_NUMBER@VORWAHL.sip.arcor.de;tag=as58e5 b2dd
Call-ID: 0b551c9a39a78edd7c9efc0953a9b143@VORWAHL.sip.arcor .de
CSeq: 106 OPTIONS
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Contact: sip:PROVIDER_NUMBER@MY_HOST_IP
Accept: application/sdp
Content-Length: 0

Anyway, the other side sends us this a few moments later.

<-- SIP read from 212.144.24.38:5060:
MESSAGE sip:PROVIDER_NUMBER@MY_HOST_IP SIP/2.0
Via: SIP/2.0/UDP 212.144.24.38:5060;branch=z9hG4bKlct5k81080u1uocqe 341sn0000gl1.1
To: “MY_NAME” sip:PROVIDER_NUMBER@VORWAHL.sip.arcor.de;tag=as58e5 b2dd
From: sip:CALLED_NUMBER@VORWAHL.sip.arcor.de;ta g=SD6trua99-0d80bc15
Call-ID: 0b551c9a39a78edd7c9efc0953a9b143@VORWAHL.sip.arcor .de
CSeq: 107 MESSAGE
Max-Forwards: 69
P-AoC: Info, type=AOC-D
Content-Type: ASN1/aoc
Content-Length: 20

Transmitting (no NAT) to 212.144.24.38:5060:
SIP/2.0 415 Unsupported Media Type
Via: SIP/2.0/UDP 212.144.24.38:5060;branch=z9hG4bKlct5k81080u1uocqe 341sn0000gl1.1;received=212.144.24.38
From: sip:CALLED_NUMBER@VORWAHL.sip.arcor.de;ta g=SD6trua99-0d80bc15
To: “MY_NAME” sip:PROVIDER_NUMBER@VORWAHL.sip.arcor.de;tag=as58e5 b2dd
Call-ID: 0b551c9a39a78edd7c9efc0953a9b143@VORWAHL.sip.arcor .de
CSeq: 107 MESSAGE
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Content-Length: 0
X-Asterisk-HangupCause: Normal Clearing

Afterwards I just get a bye from the other side.

Is asterisk causing this hangup, or is it by the the proxy? Is there a way to make asterisk answer 200 OK and redirect the MESSAGE to /dev/null or somewhere?

Is it an error on the proxy side to send the MESSAGE after receiving the correct OPTIONS - or is there an error in the communication that I can’t spot and that makes it impossible for the proxy to get it right?

Any ideas?

The pbx is running on Debian Etch with version 1.2.13.

Cheers,

Hein

Isn’t the current SIP-implementation in Asterisk a mess? I read something about it a while ago. And asterisk.org/node/117 talks about fixing this.

I know my pstn-provider run the Sip Express Router (SER) iptel.org/ser/

Maybe you can run this localy, and use your Asterisk to connect to SER.

I havn’t done this myself fortunatly my provider could offer me IAX.

Greetings

Hi,

I have experienced the same problems as HeinMueck. The hangup is caused by chan_sip because it is only accepting text/plain as message content type.

channels/chan_sip.c (search for “415”, somewhere around line 7521)

        if (strcmp(content_type, "text/plain")) { /* No text/plain attachment */
                transmit_response(p, "415 Unsupported Media Type", req); /* Good enough, or? */
                ast_set_flag(p, SIP_NEEDDESTROY);
                return;
        }

No, not good enough! :-/

Here is my hack: It sends “202 Accepted” to Arcor and ignores the message.
Patch:
http://www.icip.de/download/asterisk-arcor.diff

Warning: This is in no way standard-compliant and might break other things.

Greetings,
Rainer

Thanks a lot RaptorBlue :smile: This patch also works for Alice.

It seems Alice and Arcor are sending these OPTIONS to check whether the other end is still alive. They expect a “200 OK” or “202 Accepted” and otherwise hang up.

Alice is expecting their customers to use their crappy little white hardware-box and thus does not offer any support at all. So I guess this is only an issue to a rather small group of people. Still, is there any chance to get this patch into the mainstream version of asterisk?