[asterisk-dev] [Code Review] chan_sip: skip dns lookups when we're not using the result anyway

Olle E. Johansson oej at edvina.net
Wed Oct 10 11:13:31 CDT 2012


10 okt 2012 kl. 17:58 skrev "wdoekes" <reviewboard at asterisk.org>:

> Sometimes I get these in my logs:
> 
>   ERROR[xxx] netsock2.c: getaddrinfo("lync.somemachine.local", "5060", ...): Name or service not known
> 
> Turns out these are triggered by Contact hostname lookups when sending the end-to-end requests (like a BYE).
> 
> For whatever reason, certain people have invalid hostnames in the Contact field. But, because they're using TCP, we're not using the result of this Contact lookup at all. We always send to the open TCP socket. And everything works.
> 
> In fact, since we use nat=yes as a default, there are only few cases when we actually *do* use the Contact (or Route).
> 
> And as far as I can tell, if we don't send to the contact (or route) field, we don't need to do those lookups either.
> 
> Right? Or am I missing something crucial here?

In the case that the TCP connection fails, we need to resolve the contact to open a new connection. But we can wait with resolving until we have to, not just do it because it is fun.

This applies to the situation where NAT doesn't make it impossible to open a connection, but that's a separate case.

/O
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20121010/02130d18/attachment.htm>


More information about the asterisk-dev mailing list