[asterisk-dev] cisco-check-cfg
Kevin P. Fleming
kpfleming at digium.com
Fri Jul 29 09:40:31 CDT 2011
On 07/29/2011 10:28 AM, Simon Perreault wrote:
> Kevin P. Fleming wrote, on 07/29/2011 10:10 AM:
>>>> True... good point. OK, clarification then: Asterisk should only include [::1]
>>>> in a Contact header (or various other headers) when it knows that the UA it is
>>>> talking to is connected over the loopback interface.
>>>
>>> Any idea on how to translate that into code?
>>
>> I believe this is the purpose of ast_sip_ouraddrfor() in chan_sip.c, right?
>
> No! ast_sip_ouraddrfor() is a monumental hack. We sadly could not kill it during
> the IPv6 conversion because it would have impacted the architecture too much.
>
> (Not commenting on the rest of your email because I don't understand the issue
> well enough.)
OK, well, we need *something* that does this then. I'll try do describe
the issue.
chan_sip can only be bound to a single socket for each of UDP, TCP and
TLS communications. If the system Asterisk is running on has multiple
network interfaces (and they all do, since 'loopback' counts as one),
and the admin wants chan_sip to service all of them, then they must bind
to the wildcard address (all zeroes).
When a SIP request or response is going to be sent to a UA, Asterisk
needs to know the proper IP address to include that message so that the
other UA can respond. This can only be "guessed" based on the other UA's
address and the system's routing table. As you say, this is a hack, but
we need *something*.
Even if chan_sip had a separate socket bound to each IP address present
on the system, this would not solve the problem of having to determine
the 'response' IP address that should be included in a SIP request being
sent to a UA that didn't register with Asterisk (or hasn't otherwise
been communicating with it).
This is a fundamental problem with SIP itself; the protocol messages
contain IP addresses (they can also be domain names, but that's less
common) used to route responses, and so we must have some way to
determine which address we should include in the messages.
--
Kevin P. Fleming
Digium, Inc. | Director of Software Technologies
Jabber: kfleming at digium.com | SIP: kpfleming at digium.com | Skype: kpfleming
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at www.digium.com & www.asterisk.org
More information about the asterisk-dev
mailing list