[asterisk-bugs] [Asterisk 0018348]: No answer to OPTIONS packet because Asterisk not looking for 's' in default context

Asterisk Bug Tracker noreply at bugs.digium.com
Tue Mar 15 10:09:27 CDT 2011


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=18348 
====================================================================== 
Reported By:                shmaize
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   18348
Category:                   Channels/chan_sip/General
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     acknowledged
Asterisk Version:           1.8.0 
JIRA:                       SWP-2639 
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Request Review:              
====================================================================== 
Date Submitted:             2010-11-22 02:54 CST
Last Modified:              2011-03-15 10:09 CDT
====================================================================== 
Summary:                    No answer to OPTIONS packet because Asterisk not
looking for 's' in default context
Description: 
Hello,

asterisk-1.8.0 installed through yum on CentOS 5.5 32bit. 

My SIP provider is checking if I'm alive with OPTIONS. I must answer to
that request with "SIP/2.0 200 OK". The default behavior is to check if I
have a peer with that IP, then check for "s" in it's context. If not check
for "s" in the guests context (context=XX from general section of
sip.conf). Or I'm missing something?

With 1.8.0 the extension part is missing. Some debug logs:
1.1.1.1 is the SIP provider, 2.2.2.2 is my IP. 

/var/log/asterisk/full:
[Nov 18 16:38:05] DEBUG[6942] chan_sip.c: = Looking for  Call ID:
269dd7c535d89368dbb1770a86cd13df at 1.1.1.1 (Checking From) --From tag 24178
--To-tag   
[Nov 18 16:38:05] DEBUG[6942] acl.c: For destination '1.1.1.1', our source
address is '2.2.2.2'.
[Nov 18 16:38:05] DEBUG[6942] chan_sip.c: Setting SIP_TRANSPORT_UDP with
address 2.2.2.2:5060
[Nov 18 16:38:05] DEBUG[6942] chan_sip.c: Allocating new SIP dialog for
269dd7c535d89368dbb1770a86cd13df at 1.1.1.1 - OPTIONS (No RTP) 
[Nov 18 16:38:05] DEBUG[6942] chan_sip.c: **** Received OPTIONS (3) -
Command in SIP OPTIONS
[Nov 18 16:38:05] DEBUG[6942] chan_sip.c: Trying to put 'SIP/2.0 404' onto
UDP socket destined for 1.1.1.1:5080
[Nov 18 16:38:05] DEBUG[6942] chan_sip.c: SIP message could not be
handled, bad request: 269dd7c535d89368dbb1770a86cd13df at 1.1.1.1


<--- SIP read from UDP:1.1.1.1:5080 ---> 
OPTIONS sip:2.2.2.2:5060 SIP/2.0
Call-ID: 7ee61f3291443916e4d631a411c231b5 at 1.1.1.1
CSeq: 100 OPTIONS
From: "Voxbone Monitoring" <sip:voxmon at 1.1.1.1>;tag=95055
To: <sip:2.2.2.2:5060>
Max-Forwards: 30
Route: <sip:2.2.2.2:5060>
Via: SIP/2.0/UDP
1.1.1.1:5080;branch=z9hG4bKfabde850548854ad76efa0335e4bfe82
Content-Length: 0

<------------->
--- (9 headers 0 lines) ---
Looking for  in guests (domain 2.2.2.2:5060)

<--- Transmitting (no NAT) to 1.1.1.1:5080 ---> 
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP
1.1.1.1:5080;branch=z9hG4bKfabde850548854ad76efa0335e4bfe82;received=1.1.1.1
From: "Voxbone Monitoring" <sip:voxmon at 1.1.1.1>;tag=95055
To: <sip:2.2.2.2:5060>;tag=as5967e5ef
Call-ID: 7ee61f3291443916e4d631a411c231b5 at 1.1.1.1
CSeq: 100 OPTIONS
Server: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO,
PUBLISH
Supported: replaces, timer
Accept: application/sdp
Content-Length: 0


<------------>
Scheduling destruction of SIP dialog
'7ee61f3291443916e4d631a411c231b5 at 1.1.1.1' in 32000 ms (Method: OPTIONS)

In the part "Looking for  in guests" it should be "Looking for s in
guests". 

sip.conf
[general]

bindport=5060           ; Port to bind to (SIP is 5060)
srvlookup=yes
bindaddr=2.2.2.2
disallow=all                                                         
allow=alaw                                                          
dtmfmode=rfc2833
allowguest=no
canreinvite=no
context=guests ; Send unknown SIP callers to this context          
callerid=Unknown
allowoverlap=no                 ; Disable overlap dialing support.
(Default is yes)
allowtransfer=no
useragent=Asterisk PBX
externip=2.2.2.2


When testing with 1.6.2.14 (installed from yum) it's OK:
<------------->
--- (9 headers 0 lines) ---
Looking for s in guests (domain 2.2.2.2)

<--- Transmitting (no NAT) to 1.1.1.1:5080 --->
SIP/2.0 200 OK

======================================================================
Relationships       ID      Summary
----------------------------------------------------------------------
has duplicate       0018922 Asterisk is answering with 404 to OPTIO...
====================================================================== 

---------------------------------------------------------------------- 
 (0132934) ks-steven (reporter) - 2011-03-15 10:09
 https://issues.asterisk.org/view.php?id=18348#c132934 
---------------------------------------------------------------------- 
I don't see why you would want to go through the dialplan for this anyway.
I think changing channels/chan_sip.c > line 20622 from:

/* must go through authentication before getting here */
res = (get_destination(p, req, NULL) == SIP_GET_DEST_EXTEN_FOUND ? 0 :
-1);
build_contact(p);

if (ast_strlen_zero(p->context))
        ast_string_field_set(p, context, sip_cfg.default_context);

if (ast_shutting_down())
        transmit_response_with_allow(p, "503 Unavailable", req, 0);
else if (res < 0)
        transmit_response_with_allow(p, "404 Not Found", req, 0);
else
        transmit_response_with_allow(p, "200 OK", req, 0);

to:
/* must go through authentication before getting here */
build_contact(p);

if (ast_strlen_zero(p->context))
        ast_string_field_set(p, context, sip_cfg.default_context);

if (ast_shutting_down())
        transmit_response_with_allow(p, "503 Unavailable", req, 0);
else
        transmit_response_with_allow(p, "200 OK", req, 0);
 
solves the problem.
Also not going through the dialplan for SIP-OPTIONS saves unnecessary cpu
cycles :-) 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2011-03-15 10:09 ks-steven      Note Added: 0132934                          
======================================================================




More information about the asterisk-bugs mailing list