[Asterisk-Dev] Multiple IP's For sip.

Tilghman Lesher tilghman at mail.jeffandtilghman.com
Wed Jul 14 08:45:26 MST 2004

On Tuesday 13 July 2004 14:07, Alberto Fernandez wrote:
> On Mon, 2004-07-12 at 14:22, Tilghman Lesher wrote:
> > On Monday 12 July 2004 11:17, Alberto Fernandez wrote:
> > > 	When bound to more than one ip address sip doesn't work correctly, If
> > > the phone is not behind Nat, I'm not a developer but somehow i figured
> > > out why. I opened ethereal on the clients (X-Lite) Ethernet, since i
> > > saw that the sip debug in asterisk showed that it was receiving the
> > > invite, and attempting to answer to it. Now what i discovered was this.
> > > Lets say the asterisk box has 2 Ethernet and that they have 2 ips.
> > > Ethernet 1 has ip 1 and Ethernet 2 has ip 2 (I'm Not TOO creative :-P)
> > > If i tell a phone to connect to ip 2, asterisk receives the invite and
> > > replay's using Ethernet 1. Now the phone receives the answer trough IP
> > > 1. and it doesn't register. Is there a way to tell asterisk to answer
> > > the requests trough the ip it received them, i think this would fix
> > > this problem. I saw a bug about something similar to this long time ago
> > > but no1 did anything about it. Or it was for IAX, not sure.
> >
> > The IP that Asterisk responds with is dependent upon the route, if you
> > have the bindaddr in sip.conf set to  Otherwise, Asterisk will
> > use the IP address as set by bindaddr.
> >
> > Please note that the routines currently are based upon the old 2.0
> > routing table.  We do not have code to deal with the new (default in 2.2
> > and later) complex routing tables, if you use the complex features (like
> > routing out the same IP a packet came in on).  However, we're always open
> > to contributions.
> >
> > See acl.c:ast_ouraddrfor() for the route lookup code (which specifies
> > which IP address we should use for sending a particular packet).
> Correct In sip.conf i bind the ip to and it still doesnt let the
> phones register. Im not folowing what you are trying to tell me. Please
> elaborate.

I suspect I have already been too elaborate, and you actually want a more
simplistic explanation:  the IP that Asterisk uses for SIP is based upon your
route table.  If there is no explicit route for a destination, then Asterisk
will use the device associated with the default route to specify that IP.


More information about the asterisk-dev mailing list