[Home]

Summary:ASTERISK-24370: res_pjsip/pjsip_options: OPTIONS request sent to Asterisk with no user in request is always 404'd
Reporter:Matt Jordan (mjordan)Labels:
Date Opened:2014-09-29 15:20:00Date Closed:2014-10-05 20:01:41
Priority:MinorRegression?
Status:Closed/CompleteComponents:Resources/res_pjsip
Versions:12.6.0 13.0.0-beta2 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) ASTERISK-24370-13.diff
Description:Some endpoints like to send an OPTIONS request directly to Asterisk, and not to a particular user@asterisk. This ostensibly makes some sense: they just want to know if the server is around.

{noformat}

Index: res/res_pjsip/pjsip_options.c
===================================================================
--- res/res_pjsip/pjsip_options.c (revision 424093)
+++ res/res_pjsip/pjsip_options.c (working copy)
@@ -641,7 +641,7 @@

if (ast_shutting_down()) {
send_options_response(rdata, 503);
- } else if (!ast_exists_extension(NULL, endpoint->context, exten, 1, NULL)) {
+ } else if (!ast_strlen_zero(exten) && !ast_exists_extension(NULL, endpoint->context, exten, 1, NULL)) {
send_options_response(rdata, 404);
} else {
send_options_response(rdata, 200);



digium-test-03*CLI> pjsip set logger on
PJSIP Logging enabled
<--- Received SIP request (635 bytes) from TLS:::ffff:132.177.252.58:60134 --->
OPTIONS sip:digium-test-03.digium.sipit.net SIP/2.0
Call-ID: 80fac3df618cfe9e143185d01ac39cf2@0:0:0:0:0:0:0:0
CSeq: 113 OPTIONS
From: "2001" <sip:2001@digium-test-03.digium.sipit.net>;tag=94623d72
To: "2001" <sip:2001@digium-test-03.digium.sipit.net>
Via: SIP/2.0/TLS 132.177.252.58:60134;branch=z9hG4bK-353937-62f29dce0a8a340a99416b0f42d91dcd
Max-Forwards: 70
Contact: "2001" <sip:2001@132.177.252.58:60134;transport=tls;registering_acc=digium-test-03_digium_sipit_net>
User-Agent: Jitsi2.4.4997Linux
Allow: INFO,OPTIONS,MESSAGE,BYE,REFER,SUBSCRIBE,ACK,CANCEL,PUBLISH,NOTIFY,INVITE
Allow-Events: refer
Content-Length: 0


[Sep 29 09:06:15] NOTICE[9144]: res_pjsip/pjsip_options.c:642 options_on_rx_request: Looking for  in sipit
<--- Transmitting SIP response (918 bytes) to TLS:::ffff:132.177.252.58:60134 --->
SIP/2.0 404 Not Found
Via: SIP/2.0/TLS 132.177.252.58:60134;rport;received=::ffff:132.177.252.58;branch=z9hG4bK-353937-62f29dce0a8a340a99416b0f42d91dcd
Call-ID: 80fac3df618cfe9e143185d01ac39cf2@0:0:0:0:0:0:0:0
From: "2001" <sip:2001@digium-test-03.digium.sipit.net>;tag=94623d72
To: "2001" <sip:2001@digium-test-03.digium.sipit.net>;tag=z9hG4bK-353937-62f29dce0a8a340a99416b0f42d91dcd
CSeq: 113 OPTIONS
Accept: application/sdp, application/dialog-info+xml, application/simple-message-summary, application/simple-message-summary, application/pidf+xml, application/pidf+xml, application/dialog-info+xml, application/xpidf+xml, application/cpim-pidf+xml, message/sipfrag;version=2.0
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REFER, MESSAGE, REGISTER
Supported: 100rel, timer, replaces, norefersub
Accept-Encoding: text/plain
Accept-Language: en
Content-Length:  0

{noformat}

This is always 404'd due to the dialplan lookup failing (see NOTICE message in the above log snippet).

If a user portion is not provided, we should probably just send a 200 ok.
Comments: