[asterisk-users] Using SIP with NAT (technical code question)

Bob Chiodini bchiodini at gmail.com
Tue Dec 12 05:09:54 MST 2006


You might want to pass that one by the asterisk-dev list.

Bob...

On Mon, 2006-12-11 at 15:18 -0800, jezzzz . wrote:
> My mistake, I misread it. So if a hostname is provided
> (e.g. user at domain.com) instead of an IP (e.g.
> 123.123.123.123) and the recipient of the INVITE is
> not using NAT then ast_gethostbyname will be run - is
> that correct? In this case, why the distinction
> between a NATted and non_NATted implementation?
> 
> --- Bob Chiodini <bchiodini at gmail.com> wrote:
> 
> > It looks to me that if the test clause is false then
> > 
> > ast_gethostbyname is called.  Presumably not needed
> > when NAT is enabled.
> > 
> > Bob...
> > 
> > jezzzz . wrote:
> > > In chan_sip.c, line 5876 (Asterisk-1.2.13), the
> > > function parse_ok_contact returns whether the host
> > > that requested an invite is a valid or invalid
> > host.
> > >
> > > In line 5925 the following clause is tested:
> > >
> > > if (!(ast_test_flag(pvt, SIP_NAT) &
> > SIP_NAT_ROUTE))
> > >     hp = ast_gethostbyname(n, &ahp);
> > >
> > > If this clause is true then Asterisk will attempt
> > to
> > > retrieve the IP address by using the hostname
> > provided
> > > in the invite.
> > >
> > > My question is, is this test always going to be
> > true
> > > if a user (who receives the invite) uses NAT?
> > (this is
> > > set up in sip.conf as nat=yes) Is there a reason
> > why
> > > this was set up only for NAT? 
> > >
> > > Thanks,
> > >
> > > Jez
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Tired of spam?  Yahoo! Mail has the best spam
> > protection around 
> > > http://mail.yahoo.com 
> > > _______________________________________________
> > > --Bandwidth and Colocation provided by
> > Easynews.com --
> > >
> > > asterisk-users mailing list
> > > To UNSUBSCRIBE or update options visit:
> > >   
> >
> http://lists.digium.com/mailman/listinfo/asterisk-users
> > >   
> > _______________________________________________
> > --Bandwidth and Colocation provided by Easynews.com
> > --
> > 
> > asterisk-users mailing list
> > To UNSUBSCRIBE or update options visit:
> >   
> >
> http://lists.digium.com/mailman/listinfo/asterisk-users
> > 
> 
> 
> 
>  
> ____________________________________________________________________________________
> Do you Yahoo!?
> Everyone is raving about the all-new Yahoo! Mail beta.
> http://new.mail.yahoo.com
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com --
> 
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users


More information about the asterisk-users mailing list