Summary:ASTERISK-11075: Initial OPTIONS not sent to "peer" context (IP matching) but to the general one
Reporter:Iñaki Baz Castillo (ibc)Labels:
Date Opened:2007-12-18 10:19:22.000-0600Date Closed:2008-01-22 09:18:03.000-0600
Versions:Frequency of
Description:Hi, I configure a peer:


and in sip.conf I define:


I receive periodical OPTIONS from the provider with empty username in the RURI (so "s" is matched), but Asterisk doesn't send the request to "from-sip-provider" context, but to "none" (the context defined in [general] section).

Of course the OPTIONS comes from IP (defined as "host" in peer configuration as you can see above), so IMHO the request should be sent to "from-sip-provider" context (source IP matches) where the "s" extension exists just to reply a "200 OK" (this makes happy the provider XD).

This is the debug:

<--- SIP read from --->
OPTIONS sip: SIP/2.0
From: <sip:>;tag=-13c4-4767f048-4a46ee13-b9b39a7
To: <sip:>
Call-ID: 787c73e8-90000e3e-13c4-4767f048-4a46ee13-11c7aac1@
CSeq: 2052108902 OPTIONS
Via: SIP/2.0/UDP;maddr=;branch=z9hG4bK-4767f048-4a46ee13-3ad29e54
User-agent: CS2000_NGSS/8.0
Max-Forwards: 70
Accept: application/isup, application/sdp, application/dtmf-relay, audio/telephone-event
Supported: 100rel
Content-Length: 0

--- (12 headers 0 lines) ---
Looking for s in none (domain

<--- Transmitting (no NAT) to --->
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP;maddr=;branch=z9hG4bK-4767f048-4a46ee13-3ad29e54;received=
From: <sip:>;tag=-13c4-4767f048-4a46ee13-b9b39a7
To: <sip:>;tag=as6dbbab89
Call-ID: 787c73e8-90000e3e-13c4-4767f048-4a46ee13-11c7aac1@
CSeq: 2052108902 OPTIONS
User-Agent: Asterisk PBX
Supported: replaces
Accept: application/sdp
Content-Length: 0

As you see: "Looking for s in none".
IMHO it's a bug, isn't it?

PD: I've generated an usual debug but the info provided is less than in CLI (the only place where I read "Looking for s in none").
Comments:By: Olle Johansson (oej) 2007-12-19 01:03:33.000-0600

This is a known issue, there's already a note of it in the source. However, it requires a lot of changes to the code and will take more processing power of the server, especially since in some cases it will require proper authentication to match the peer.

Is it really worth it?

By: Iñaki Baz Castillo (ibc) 2007-12-19 02:18:36.000-0600

Thanks for the info.
I'll try today if replying 200 OK to those initial OPTIONS is a need for the SIP provider, maybe it just use them as a ping without the need of receiving 200 OK.

By: Iñaki Baz Castillo (ibc) 2007-12-19 05:04:24.000-0600

Ops, unfortunatelly my SIP provider requires my Asterisk reply a 200 OK for that OPTIONS.
So I have to do a dirty trick:

** sip.conf:

 context = dirty-trick-context


** extensions.conf:

 ; Initial OPTIONS not sent to "peer" context (IP matching)
 ; but to the general one
 ; http://bugs.digium.com/view.php?id=11591
 exten => s,1,NoOp(Incoming OPTIONS probably from sip-provider)

so sip-provider receives a 200 OK when sending OPTIONS. Dirty trick...  :(

By: Olle Johansson (oej) 2007-12-19 07:51:15.000-0600

Sorry for not giving you the workaround earlier, but I still see this as a problem. The solution is not beautiful, so I'm kind of in pains trying to make a decision here.

By: Iñaki Baz Castillo (ibc) 2007-12-19 07:56:16.000-0600

Ok, don't worry for me, I can live with it ;)

By: Olle Johansson (oej) 2008-01-22 09:17:46.000-0600

Ok, I've made a note about it in the source code for future problem solving. Thanks for your patience.