OpenSIPS / opensips

OpenSIPS is a GPL implementation of a multi-functionality SIP Server that targets to deliver a high-level technical solution (performance, security and quality) to be used in professional SIP server platforms.
https://opensips.org
Other
1.28k stars 581 forks source link

[BUG] bad uri <urn:services:sos> #2093

Closed nttranbao closed 4 years ago

nttranbao commented 4 years ago

OpenSIPS version you are running

version: opensips 3.0.2 (x86_64/linux)
flags: STATS: On, DISABLE_NAGLE, USE_MCAST, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, HP_MALLOC, DBG_MALLOC, FAST_LOCK-ADAPTIVE_WAIT
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535
poll method support: poll, epoll, sigio_rt, select.
git revision: 7e8167853
main.c compiled on 09:29:48 Apr 14 2020 with gcc 8

Describe the bug

OpenSIPS rejects with 503, on INVITE with request URI of

To Reproduce

  1. Start OpenSIPS
  2. Start traffic with special R-URI:
  3. Inspect traces. Trace shows OpenSIPS rejecting with 503. Here is all found in the logs...
    Apr 28 16:27:17 ng911-psap-1 /usr/local/sbin/opensips[29508]: ERROR:core:parse_uri: bad uri, state 0 parsed: <urn:> (4) / <urn:services:sos> (16)
    Apr 28 16:27:17 ng911-psap-1 /usr/local/sbin/opensips[29508]: ERROR:core:parse_sip_msg_uri: bad uri <urn:services:sos>
    Apr 28 16:27:17 ng911-psap-1 /usr/local/sbin/opensips[29508]: ERROR:tm:new_t: uri invalid
    Apr 28 16:27:17 ng911-psap-1 /usr/local/sbin/opensips[29508]: ERROR:tm:t_newtran: new_t failed

Expected behavior

OpenSIPS will proceed with internal processing, and route the INVITE to next hop Relevant System Logs

Provided aboved OS/environment information

Thanks a bunch, Best regards, Bao

nttranbao commented 4 years ago

Sample trace:

INVITE urn:services:sos SIP/2.0
Via: SIP/2.0/UDP 10.120.27.28:5060;branch=z9hG4bK8c0ahq10e808fo334ci0.1
Max-Forwards: 20
From: "a" <sip:+14166666666@external.peer-esinet.net>;tag=0vacXUt8gje5B
To: <sip:911@emergency.domain.ca>
Call-ID: 251ddd57-0431-1239-95bf-005056a9f3f7
CSeq: 19498951 INVITE
Contact: <sip:+14166666666@10.120.27.28:5060;transport=udp>
User-Agent: FreeSWITCH-mod_sofia/1.10.2-release~64bit
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, path, replaces
Allow-Events: talk, hold, conference, presence, as-feature-event, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer
Content-Type: application/sdp
Content-Disposition: session
Content-Length: 200
X-FS-Support: update_display,send_info
Route: <sip:esrp.ng911.ca:5060;lr>
Call-Info: <urn:emergency:callid:20200428162447100251ddd5704311:bcf.ng911.ca;purpose=emergency-CallId,<urn:emergency:incidentid:202004281624471008c0ahq10e808fo334ci0:bcf.ng911.ca;purpose=emergency-IncidentId
Resource-Priority: esnet.1

v=0
o=- 17842207 1588080530 IN IP4 10.120.27.28
s=-
c=IN IP4 10.120.27.28
t=0 0
m=audio 10544 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20

----------------- OpenSIPS responds---------
SIP/2.0 500 Internal Error
Via: SIP/2.0/UDP 10.120.27.28:5060;branch=z9hG4bK8c0ahq10e808fo334ci0.1
From: "a" <sip:+14166666666@external.peer-esinet.net>;tag=0vacXUt8gje5B
To: <sip:911@emergency.domain.ca>;tag=28de.be6f1789b3f76324323c0838ff10e804
Call-ID: 251ddd57-0431-1239-95bf-005056a9f3f7
CSeq: 19498951 INVITE
Server: OpenSIPS (3.0.2 (x86_64/linux))
Content-Length: 0
nttranbao commented 4 years ago

Never mind. I was able to trace the source code, and after reading parser_uri.h, i found the typo in my INVITE.

The right urn should be "" (no 's' after service)

Thanks, Bao

#define URN_SERVICE_SCH     0x3a6e7275
#define URN_SERVICE_STR     ":service:"