[asterisk-dev] [Code Review] Properly route responses according to the Via headers in the request

Alex Hermann alex at speakup.nl
Thu Dec 30 10:51:07 UTC 2010

On Thursday 30 December 2010, Olle E. Johansson wrote:
> 30 dec 2010 kl. 09.56 skrev Alex Hermann:
> > 2) get_header does not automatically find the first via if the first via
> > is in compact form. If the incoming request has 2 via header, of which
> > the first is in compact form (v:) and the second in standard form
> > (Via:), get_header will return the second Via header instead of the
> > first, breaking your logic.
> get_header has a support function called find_alias it use to find compact
> versions of the headers.

But only _after_ finding the non-compact version has failed, thus not in the 
described scenario.

Consider the following SIP fragment:

REGISTER sip:mydomain SIP/2.0
v: SIP/2.0/UDP;branch=z9hG4bK-123;rport
Via: SIP/2.0/UDP;branch=z9hG4bK-456;rport;maddr=

get_header(... "via"...) will return the second via header and use its maddr 

Alex Hermann

More information about the asterisk-dev mailing list