[Home]

Summary:ASTERISK-08288: [patch] Via: header may contain multiple values
Reporter:Samuel Tardieu (tardieu)Labels:
Date Opened:2006-12-06 06:31:33.000-0600Date Closed:2007-01-08 07:34:27.000-0600
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Channels/chan_sip/Interoperability
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) log-nopatch-sip.txt
( 1) log-patch-sip.txt
( 2) via-check-first-only
( 3) via-update-first-only
Description:Asterisk assumes that every Via: header includes only one value. In particular, if the topmost Via: header used in a request contains several values, Asterisk will add the ";received=..." to the wrong value (the rightmost one instead of the leftmost one).

****** STEPS TO REPRODUCE ******

Send a SIP request with a multi-valued topmost Via: header such as:

Via: SIP/2.0/UDP 212.27.52.5:5060;branch=z9hG4bK-R0-0001f176-7de981fd,SIP/2.0/UDP 172.17.20.241:5063;emission,SIP/2.0/UDP 172.17.20.241:5062;branch=z9hG4bK-38DD-1FFF

and the response given by Asterisk will contain:

Via: SIP/2.0/UDP 212.27.52.5:5060;branch=z9hG4bK-R0-0001f176-7de981fd,SIP/2.0/UDP 172.17.20.241:5063;emission,SIP/2.0/UDP 172.17.20.241:5062;branch=z9hG4bK-38DD-1FFF;received=212.27.52.5

The ";received=212.27.52.5" should have been added to the leftmost value, not the rightmost one.
Comments:By: Samuel Tardieu (tardieu) 2006-12-06 07:29:51.000-0600

The two patches (via-check-first-only and via-update-first-only) fix this problem. They have been tested with single-valued and multiple-valued Via: headers.

Disclaimer is already on file.

By: Serge Vecher (serge-v) 2006-12-06 10:17:53.000-0600

Tardieu: thanks for the patches! Oej still wants to see the debug logs with and without the patch to confirm that your patches are doing the "right thing." Please produce as per following:

1) Prepare test environment (reduce the amount of unrelated traffic on the server);
2) Make sure your logger.conf has the following line:
  console => notice,warning,error,debug
3) restart Asterisk with the following command:
  'asterisk -Tvvvvvdddddgc | tee /tmp/verbosedebug.txt'
4) Enable SIP transaction logging with the following CLI commands:
set debug 4
set verbose 4
sip debug
5) Trip any startup info and attach verbosedebug.txt to the issue.

By: Samuel Tardieu (tardieu) 2006-12-06 11:01:45.000-0600

Ok, two log files uploaded, representing a similar call (a Cirpack server to an Asterisk one, the Cirpack using multiple-valued Via headers).

Incidentally, the astute reader would note that this may have uncovered a bug in Cirpack's CANCEL request (see line 146 of log-patch-sip.txt), but this has nothing to do with the Asterisk problem :)

By: Samuel Tardieu (tardieu) 2006-12-16 04:44:57.000-0600

Has there been any progress on this one? This is a real and serious interoperability issue. Without those patches, some already existing commercial SIP boxes cannot talk with Asterisk because of Asterisk's bad handling of multi-valued Via header.

IMO, it would be a shame to release 1.4 with this known bug, against which no easy workaround can be found. If a SIP provider upgrades or replaces its box with one using a perfectly legal multi-valued Via header,  every Asterisk client will break instantly.

By: Serge Vecher (serge-v) 2006-12-18 09:19:09.000-0600

cloos, nic_bellamy: have you tested the patches?

By: Olle Johansson (oej) 2007-01-08 07:21:55.000-0600

I agree, this is a bug fix and needs to go in. Will handle it.

By: Olle Johansson (oej) 2007-01-08 07:33:14.000-0600

Committed to 1.4 rev 49983 and svn trunk. Thank you for your patience.