[Asterisk-Dev] externhost code in CVS
Tilghman Lesher
tilghman at mail.jeffandtilghman.com
Tue Mar 8 16:21:29 MST 2005
On Tuesday 08 March 2005 16:47, Harald Milz wrote:
> Hi to everybody, I'm new to the list, and still new to Asterisk. So
> if my question was discussed before, a link would be appreciated.
>
> As very many people in Germany, my yet-to-be Asterisk server sits
> behind a NATting DSL router. I checked out the CVS code a couple of
> minutes ago and had a look at the externhost code. I was just about
> to add something similar to asterisk-1.0.6 ;-) Question: why don't we
> simply
> gethostbyname_r(external host name) each time ast_sip_ouraddrfor() is
> invoked?
Because ouraddrfor() is invoked on every single packet sent and
gethostbyname() does a DNS lookup. Given that your IP address is
unlikely to change between packets (or if it does, you'll have trouble
keeping a phone call up), it's redundant, wasteful, and takes up time
that you would rather use keeping the packets flowing (this is realtime
data, after all).
--
Tilghman
More information about the asterisk-dev
mailing list