|Summary:||ASTERISK-17192: get_header doesn't pick the right header when compact form is mixed with non-compact form|
|Reporter:||Alex Hermann (alexh)||Labels:|
|Date Opened:||2010-12-30 11:44:53.000-0600||Date Closed:||2012-02-09 14:50:19.000-0600|
|Description:||The current implementation of get_header only takes the compact form only into consideration when no no-compact form headers are present.|
If get_header(..."Via"..) is used on the following SIP fragment, the second header is returned instead of the first.
REGISTER sip:mydomain SIP/2.0
v: SIP/2.0/UDP 172.16.1.40:5060;branch=z9hG4bK-123;rport
Via: SIP/2.0/UDP 172.16.1.55:5060;branch=z9hG4bK-456;rport;maddr=22.214.171.124
Compact form should be checked inside the loop over the headers, not in a separate loop over the headers as is the current implementation.
****** ADDITIONAL INFORMATION ******
This is not yet a bug, as i have no scenario in which this will currently fail, so no debug log available.
But, if https://reviewboard.asterisk.org/r/1059/ is committed, it will find the wrong Via header and asterisk will route the reply to the wrong address if the second, or later, Via contains an maddr parameter and the first Via header is in compact form (see example).
It was suggested that this would classify as a "separate bug" while i was just trying to prevent a regression to be introduced by said patch. Hence this bugreport.
So, when that regression is committed to the repository, please fix this bug :)