[SR-Users] VIA header question.

M S shaheryarkh at gmail.com
Tue Aug 4 13:45:29 CEST 2015


Well, your provider is right, the top most VIA header define the sender
address where the replies are expected. Each hop in the path adds its own
VIA at top till the request reaches the final destination. At final
destination, the list of VIA headers reflects the reply path from top to
bottom (i.e. first to last VIA header, where last via is the final user who
sent the request and wants the reply from the destination). For example,

A send request to D via proxy B and C, then at D the VIA header list will
look like this,

VIA: <address of C>
VIA: <address of B>
VIA: <address of A>

Therefore D will reply to A via C and B respectively. When C receives the
reply from D, it will remove its VIA header and forward the reply to B with
this VIA list,

VIA: <address of B>
VIA: <address of A>

The B does the same, it see that top most VIA its own address, so it
deletes that and forward the reply to A with this VIA list,

VIA: <address of A>

When A receives replies it too removes topmost VIA (since it points to
itself) and see there are no more VIA left, this means that reply has
reached its final destination.

Of course there may be some other SIP routing headers/ elements which may
change this behavior, e.g. Route, Record-Route, SIP Aliases, custom headers
etc. etc.


Here is a detailed discussion on it,

https://andrewjprokop.wordpress.com/2014/03/06/understanding-the-sip-via-header/

You kamailio is configure incorrectly, it is not suppose to sent top most
via to private ip unless your provider can reach you via private ip (e.g.
through some vpn tunnel between you and your provider etc.).

So basically it seem your kamailio is miss configured. A good example and
explanation of implementing load balancing can be found here,

http://www.kamailio.org/events/2013-KamailioWorld/23-Daniel-Constantin.Mierla-Load-Balancing-Load-Balancers.pdf

Thank you.



On Tue, Aug 4, 2015 at 1:14 PM, Chad <ccolumbu at hotmail.com> wrote:

> Hi list,
> I need a little help, I am a business owner trying to get Kamailio up and
> running as a SIP load balancer.
> I hired a Kamailio consultant to help me do so, but Kamailio is not
> working and I am getting conflicting information.
>
> My Kamailio consultant and my VOIP provider are telling me 2 different
> things and I don't know which one is right.
>
> Kamailio sends SIP traffic to the VOIP provider with 2 VIA headers like
> this (in this order):
> Via: SIP/2.0/UDP
> 10.10.10.254;branch=z9hG4bK7291.6a0bbd2e8fd639a47d7d2de606779e47.0.
> Via: SIP/2.0/UDP 209.170.201.25:5060
> ;received=10.10.10.102;branch=z9hG4bK742dc03d;rport=5060.
>
> The VOIP provider says that is incorrect because they are supposed to
> reply back to the topmost VIA header so they reply to the 10.10.10.254 IP
> (which is not public) and the call ends.
> The VOIP provider says Kamailio should send the VIA headers like this
> instead:
> Via: SIP/2.0/UDP 209.170.201.25:5060
> ;received=10.10.10.102;branch=z9hG4bK742dc03d;rport=5060.
> Via: SIP/2.0/UDP
> 10.10.10.254;branch=z9hG4bK7291.6a0bbd2e8fd639a47d7d2de606779e47.0.
>
> My Kamailio consultant says the way we are sending it is right and that
> the VOIP provider is processing the call incorrectly.
>
> I read that the SIP proxy is supposed to remove the internal header from
> the 1st example above based on this RFC:
> https://tools.ietf.org/html/rfc3261#section-16.7
> Item: 3. Via
> "The proxy removes the topmost Via header field value from the response."
>
> If that applies to this situation (which I don't know if it does) then
> Kamailio should be removing the 10.10.10.254 VIA line and only sending 1
> VIA header like this:
> Via: SIP/2.0/UDP 209.170.201.25:5060
> ;received=10.10.10.102;branch=z9hG4bK742dc03d;rport=5060.
>
> Which would sort of make the VOIP provider right in that the topmost VIA
> line would then be the external IP, but how they said to fix it (reversing
> the VIA lines) is wrong.
>
> Does anyone know what the right answer is here?
> Please let me know.
>
> THANKS for your help.
>
> --
>
> ^C
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20150804/c65e0350/attachment.html>


More information about the sr-users mailing list