Request-URI for SIP BYE method is WRONG!


#1

There is something seriously wrong with SIP implementation in Asterisk. It seems not to be in compliance with RFC 3261 !!!

When issuing a BYE request, Asterisk sets a WRONG Request-URI after the BYE keyword, when multiple Via: headers are present.

I am enclosing 2 SIP debug listing below to illustrate this problem.

The 1st debug listing comes from Asterisk v1.2.1 answering an incoming SIP call and hanging up,
The 2nd debug listing comes from the X-Pro Softphone doing the same thing.
Compare the Request-URI of the last BYE request.

Also, the same problem with the Request-URI after the REFER method breaks the transfer() functionality, and probably causes multitude of other problems…

Regards,
Daniel Leeds

###########################################################

Asterisk v1.2.1 SIP Debug Listing (answer and hang up)

###########################################################

<-- SIP read rom sphone.vopr.vonage.net:5061:
INVITE sip:pstin_7748712 at asterisk.aa.eu:5060;suppress-features=- SIP/2.0
Via: SIP/2.0/UDP sphone.vopr.vonage.net:5061
Via: SIP/2.0/UDP inbound4.vonage.net:5060
Via: SIP/2.0/UDP transit.vonage.net:5060;branch=z9hG4bK15FF
Record-Route: <sip:pstin_7748712 at sphone.vopr.vonage.net:5061>
Record-Route: <sip:pstin_7748712 at inbound4.vonage.net:5060>
From: “pstn_1234567”sip:transit.vonage.net;tag=428326453
To: <sip:pstin_7748712 at inbound4.vonage.net>
Call-ID: 4F93F317-836F11DA-B684B29D-2266172B at transit.vonage.net
CSeq: 101 INVITE
Contact: sip:transit.vonage.net:5060;rtpupdated=-
Max-Forwards: 13
Content-Type: application/sdp
Content-Length: 355

v=0
o=CiscoSystemsSIP-GW-UserAgent 3846 5784 IN IP4 transit.vonage.net
s=SIP Call
c=IN IP4 transit.vonage.net
t=0 0
m=audio 19064 RTP/AVP 0 18 2 100 101
c=IN IP4 transit.vonage.net
a=rtpmap:0 PCMU/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:2 G726-32/8000
a=rtpmap:100 X-NSE/8000
a=fmtp:100 192-194
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16

Transmitting (no NAT) to sphone.vopr.vonage.net:5061:
SIP/2.0 100 Trying
Via: SIP/2.0/UDP sphone.vopr.vonage.net:5061;received=sphone.vopr.vonage.net
Via: SIP/2.0/UDP inbound4.vonage.net:5060
Via: SIP/2.0/UDP transit.vonage.net:5060;branch=z9hG4bK15FF
From: “pstn_1234567”sip:transit.vonage.net;tag=428326453
To: <sip:pstin_7748712 at inbound4.vonage.net>
Call-ID: 4F93F317-836F11DA-B684B29D-2266172B at transit.vonage.net
CSeq: 101 INVITE
User-Agent: Asterisk v1.2.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Max-Forwards: 70
Contact: <sip:pstin_7748712 at asterisk.aa.eu>
Content-Length: 0

Reliably Transmitting (no NAT) to sphone.vopr.vonage.net:5061:
SIP/2.0 200 OK
Via: SIP/2.0/UDP sphone.vopr.vonage.net:5061;received=sphone.vopr.vonage.net
Via: SIP/2.0/UDP inbound4.vonage.net:5060
Via: SIP/2.0/UDP transit.vonage.net:5060;branch=z9hG4bK15FF
Record-Route: <sip:pstin_7748712 at sphone.vopr.vonage.net:5061>
Record-Route: <sip:pstin_7748712 at inbound4.vonage.net:5060>
From: “pstn_1234567”sip:transit.vonage.net;tag=428326453
To: <sip:pstin_7748712 at inbound4.vonage.net>;tag=as108211ae
Call-ID: 4F93F317-836F11DA-B684B29D-2266172B at transit.vonage.net
CSeq: 101 INVITE
User-Agent: Asterisk v1.2.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Max-Forwards: 70
Contact: <sip:pstin_7748712 at asterisk.aa.eu>
Content-Type: application/sdp
Content-Length: 486

v=0
o=root 3084 3084 IN IP4 asterisk.aa.eu
s=session
c=IN IP4 asterisk.aa.eu
t=0 0
m=audio 18628 RTP/AVP 4 18 3 0 8 2 5 10 7 110 97 101
a=rtpmap:4 G723/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:3 GSM/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:2 G726-32/8000
a=rtpmap:5 DVI4/8000
a=rtpmap:10 L16/8000
a=rtpmap:7 LPC/8000
a=rtpmap:110 speex/8000
a=rtpmap:97 iLBC/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -

<-- SIP read from sphone.vopr.vonage.net:5061:
ACK sip:pstin_7748712 at asterisk.aa.eu:5060 SIP/2.0
Via: SIP/2.0/UDP sphone.vopr.vonage.net:5061
Via: SIP/2.0/UDP inbound4.vonage.net:5060
Via: SIP/2.0/UDP transit.vonage.net:5060;branch=z9hG4bKD9C
From: “pstn_1234567”sip:transit.vonage.net;tag=428326453
To: <sip:pstin_7748712 at inbound4.vonage.net>;tag=as108211ae
Call-ID: 4F93F317-836F11DA-B684B29D-2266172B at transit.vonage.net
CSeq: 101 ACK
Max-Forwards: 13
Content-Length: 0

Reliably Transmitting (no NAT) to sphone.vopr.vonage.net:5061:
BYE sip:transit.vonage.net:5060 SIP/2.0
Via: SIP/2.0/UDP asterisk.aa.eu:5060;branch=z9hG4bK67d5a83a;rport
Route: <sip:pstin_7748712 at inbound4.vonage.net:5060>,sip:transit.vonage.net:5060
From: <sip:pstin_7748712 at inbound4.vonage.net>;tag=as108211ae
To: “pstn_1234567”sip:transit.vonage.net;tag=428326453
Contact: <sip:pstin_7748712 at asterisk.aa.eu>
Call-ID: 4F93F317-836F11DA-B684B29D-2266172B at transit.vonage.net
CSeq: 102 BYE
User-Agent: Asterisk v1.2.1
Max-Forwards: 70
Content-Length: 0

###########################################################

X-Pro Softphone SIP Debug Listing (answer and hang up)

###########################################################

RECEIVE << sphone.vopr.vonage.net:5061
INVITE sip:pstin_7748712@xpro.softphone.eu:5060;suppress-features=- SIP/2.0
Via: SIP/2.0/UDP sphone.vopr.vonage.net:5061
Via: SIP/2.0/UDP inbound4.vonage.net:5060
Via: SIP/2.0/UDP transit.vonage.net:5060;branch=z9hG4bK2C2
Record-Route: sip:pstin_7748712@sphone.vopr.vonage.net:5061
Record-Route: sip:pstin_7748712@inbound4.vonage.net:5060
From: “pstn_1234567”sip:transit.vonage.net;tag=1120767171
To: sip:pstin_7748712@inbound4.vonage.net
Call-ID: F963720C-837311DA-95C8DF96-A870513F@transit.vonage.net
CSeq: 101 INVITE
Contact: sip:transit.vonage.net:5060;rtpupdated=-
Max-Forwards: 13
Content-Type: application/sdp
Content-Length: 355

v=0
o=CiscoSystemsSIP-GW-UserAgent 3140 8306 IN IP4 63.82.77.21
s=SIP Call
c=IN IP4 63.82.77.21
t=0 0
m=audio 13862 RTP/AVP 0 18 2 100 101
c=IN IP4 63.82.77.21
a=rtpmap:0 PCMU/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:2 G726-32/8000
a=rtpmap:100 X-NSE/8000
a=fmtp:100 192-194
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16

SEND >> sphone.vopr.vonage.net:5061
SIP/2.0 100 Trying
Via: SIP/2.0/UDP sphone.vopr.vonage.net:5061
Via: SIP/2.0/UDP inbound4.vonage.net:5060
Via: SIP/2.0/UDP transit.vonage.net:5060;branch=z9hG4bK2C2
From: “pstn_1234567”sip:transit.vonage.net;tag=1120767171
To: sip:pstin_7748712@inbound4.vonage.net;tag=1120767171
Contact: sip:pstin_7748712@xpro.softphone.eu:5060
Record-Route: sip:pstin_7748712@sphone.vopr.vonage.net:5061,sip:pstin_7748712@inbound4.vonage.net:5060
Call-ID: F963720C-837311DA-95C8DF96-A870513F@transit.vonage.net
CSeq: 101 INVITE
User-Agent: X-PRO build 1082
Content-Length: 0

SEND >> sphone.vopr.vonage.net:5061
SIP/2.0 200 Ok
Via: SIP/2.0/UDP sphone.vopr.vonage.net:5061
Via: SIP/2.0/UDP inbound4.vonage.net:5060
Via: SIP/2.0/UDP transit.vonage.net:5060;branch=z9hG4bK2C2
From: “pstn_1234567”sip:transit.vonage.net;tag=1120767171
To: sip:pstin_7748712@inbound4.vonage.net;tag=1120767171
Contact: sip:pstin_7748712@xpro.softphone.eu:5060
Record-Route: sip:pstin_7748712@sphone.vopr.vonage.net:5061,sip:pstin_7748712@inbound4.vonage.net:5060
Call-ID: F963720C-837311DA-95C8DF96-A870513F@transit.vonage.net
CSeq: 101 INVITE
Content-Type: application/sdp
User-Agent: X-PRO build 1082
Content-Length: 203

v=0
o=pstin_7748712 80837838 80837838 IN IP4 xpro.softphone.eu
s=X-PRO
c=IN IP4 xpro.softphone.eu
t=0 0
m=audio 7784 RTP/AVP 18 101
a=rtpmap:18 G729/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15

RECEIVE << sphone.vopr.vonage.net:5061
ACK sip:pstin_7748712@xpro.softphone.eu:5060 SIP/2.0
Via: SIP/2.0/UDP sphone.vopr.vonage.net:5061
Via: SIP/2.0/UDP inbound4.vonage.net:5060
Via: SIP/2.0/UDP transit.vonage.net:5060;branch=z9hG4bK1CA1
From: “pstn_1234567”sip:transit.vonage.net;tag=1120767171
To: sip:pstin_7748712@inbound4.vonage.net;tag=1120767171
Call-ID: F963720C-837311DA-95C8DF96-A870513F@transit.vonage.net
CSeq: 101 ACK
Max-Forwards: 13
Content-Length: 0

SEND >> sphone.vopr.vonage.net:5061
BYE sip:pstin_7748712@sphone.vopr.vonage.net:5061 SIP/2.0
Via: SIP/2.0/UDP xpro.softphone.eu:5060;rport;branch=z9hG4bKEEEFC9CA18324B32ACE4C46C6479E337
From: sip:pstin_7748712@inbound4.vonage.net;tag=1120767171
To: “pstn_1234567”sip:transit.vonage.net;tag=1120767171
Contact: sip:pstin_7748712@xpro.softphone.eu:5060
Route: sip:pstin_7748712@inbound4.vonage.net:5060,sip:transit.vonage.net:5060
Call-ID: F963720C-837311DA-95C8DF96-A870513F@transit.vonage.net
CSeq: 56524 BYE
User-Agent: X-PRO build 1082
Content-Length: 0


#2

I’m using asterisk together with a SIP session border controller;
what you state explains a lot of problems I have.
C.


#3

A solution to this bug is in the works at:
http://bugs.digium.com/view.php?id=6240

Daniel


#4

Thank you,
C.