[Asterisk-Users] Re: Media Path Optimization & NAT

Rich Adamson radamson at routers.com
Tue Jan 18 02:05:34 MST 2005


> >>>>Now, I would very much like to remove the "canreinvite=no" from the 
> >>>>provider's definition on sip.conf, but doing so causes Asterisk to send 
> >>>>a re-invite to the provider pointing to a private IP. I thought that 
> >>>>correct localnet entries would solve this...
> >>>>
> >>>By changing to canreinvite=yes, are you expecting the asterisk box to
> >>>act as a router, passing rtp traffic from your sip provider through
> >>>the box to a sip phone with a private address (without passing
> >>>asterisk code in the middle of the rtp session)?
> >>
> >>No, sorry. I'm looking for Asterisk to not issue the re-invites if the 
> >>two devices can't see each other. Think of mobile users who are often 
> >>behind the corporate firewall but also travel. I'm trying to avoid 
> >>having the media path be "user->corporate lan->pstn provider". I want it 
> >>to be "user->pstn provider".
> >>
> >>If not to accomplish this, what are the localnet configuration entries for?
> 
> > When a user is in the office, his phone registers with asterisk, and he
> > places calls through asterisk to the sip provider. But, when he's
> > out of the office, he takes his phone with him, and you are wanting
> > him to make use of the canreinvite=yes to allow his phone to connect
> > directly to the sip provider avoiding asterisk (from an rtp perspective). 
> > Is that right?
> 
> Yes. A softphone on a laptop makes for a more believable example though.
> 
> So, is this possible? And, if not, what do the "localnet" entries provide?

I don't believe what you want is possible. The issue is in how sip
handles reinvites and nating (or lack thereof). What will further
complicate this is the laptop, when out of the office, is likely to
be behind yet a different nat box and the addressing used behind
that box may be completely different from your office nat.

For example, your office lan uses 192.168.1.0/24 internal addressing.
The laptop moves to another location where the internal lan uses
172.16.1.0/24 addressing. The laptop can successfully register with
asterisk, however when the laptop places a pstn call via your sip
provider, the sip provider's equipment will not have a clue the
laptop is using a 172.16.1.x address behind a different registered
IP address. There is nothing in the sip protocol that I know of that
can be used to inform the sip provider of those two addresses from
an asterisk reinvite perspective. (That's what the static values in 
externip and localnet are doing.)

In effect, what you want is for those variables to become dynamic
and become populated based on whatever the laptop is telling * during
registration.

I'm not a SER user and have very little knowledge of that app, but
it sort of sounds like you might want to take a look at it to 
frontend *.

Even if you got the above to work with * or SER, your sip provider 
is not likely to support reinvites in this manner as it would
create an accountability issue for them.





More information about the asterisk-users mailing list