Re: [asterisk-users] Re: NAT: RTP Path Optimization

2007-01-31 Thread Conrad Wood

  PC When I set for Extern1/2 canreinvite=yes it works, but
  PC Intern-2-Extern doesn't work because Asteisk gives out the
  PC private IP-Adresses of Int1/2
  
  Asterisk can't give out a public IP-address for Int1/2. Where
  would it get one from?
  
  
  Correct that it doesn't.   But some kind sould could indeed code a
  variety of techniques to get it, such as:
  
  Again: My Problem is not Intern-to-Extern (NAT,Stun). My Problem is 
  Extern-to-Extern, that the external phones are not talking RTP 
  *directly* to each other. This is bad, when Asterisk is in Europe and 
  the Phones are in Asia.
  ___

Just an idea, it's completely unverified and if I missed the point
somewhat, please excuse me ;) - but maybe this approach leads to the OPs
desired result if thought through further.

I wonder wether some clever dialplan constructs couldn't help.
I'm thinking along the lines of:
[globals]
ALLOWDIRECT=
REMAININPATH=tTwW

[internalphones] - registration context of internal phones
exten = extern1,1,Dial(SIP/${EXTEN},30,${REMAINPATH})
exten = extern2,1,Dial(SIP/${EXTEN},30,${REMAINPATH})
exten = intern1,1,Dial(SIP/${EXTEN},30,${ALLOWDIRECT})
exten = intern2,1,Dial(SIP/${EXTEN},30,${ALLOWDIRECT})

[externalphones] - registration context of internal phones
exten = intern1,1,Dial(SIP/${EXTEN},30,${REMAINPATH})
exten = intern2,1,Dial(SIP/${EXTEN},30,${REMAINPATH})
exten = extern1,1,Dial(SIP/${EXTEN},30,${ALLOWDIRECT})
exten = extern2,1,Dial(SIP/${EXTEN},30,${ALLOWDIRECT})


This assumes all sip phones are set to reinvite=yes.
I expect (one of) the options to dial (tTw or W) to force asterisk to
remain in the media path. This way *only* if it's int-int or ext-ext
will it send sip reinvite, right?

I have another idea just now, but that's even weirder ... ;)

Conrad

___
--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


Re: [asterisk-users] Re: NAT: RTP Path Optimization

2007-01-31 Thread Andrew Kohlsmith
On Wednesday 31 January 2007 8:28 am, Conrad Wood wrote:
 This assumes all sip phones are set to reinvite=yes.
 I expect (one of) the options to dial (tTw or W) to force asterisk to
 remain in the media path. This way *only* if it's int-int or ext-ext
 will it send sip reinvite, right?

Yes, but now you have to be careful of unintended consequences when people are 
trying to use IVRs.

What's wrong with having two peers, one with canreinvite=no, and Dial() using 
the appropriate one?  (I haven't been following the thread, so this may have 
already been discussed, and discounted.)

-A.
___
--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


Re: [asterisk-users] Re: NAT: RTP Path Optimization

2007-01-31 Thread Conrad Wood
On Wed, 2007-01-31 at 08:42 -0500, Andrew Kohlsmith wrote:
 On Wednesday 31 January 2007 8:28 am, Conrad Wood wrote:
  This assumes all sip phones are set to reinvite=yes.
  I expect (one of) the options to dial (tTw or W) to force asterisk to
  remain in the media path. This way *only* if it's int-int or ext-ext
  will it send sip reinvite, right?
 
 Yes, but now you have to be careful of unintended consequences when people 
 are 
 trying to use IVRs.

I wouldn't take it live as is without further testing, but I guess the
idea was worth adding to the thread.

 
 What's wrong with having two peers, one with canreinvite=no, and Dial() using 
 the appropriate one?  (I haven't been following the thread, so this may have 
 already been discussed, and discounted.)
 

That was the other idea I had - but think different Dial parameters are 
less problematic. For 2 peers per phone, the phones either need to have
a static public IP or need to be able to register with 2 credentials
(e.g. snom/cisco).


Conrad

___
--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


Re: [asterisk-users] Re: NAT: RTP Path Optimization

2007-01-31 Thread Olle E Johansson
Thanks for this discussion! I've gotten a few ideas for better NAT  
handling in chan_sip3.
The current way is implemented in so many installations, so it would  
be hard to turn it

around, but in pineapple I can freely break backwards compatibility.

Let me think about it for a few days, then I'll try to summarize.

What's Pineapple and chan_sip3? Check http://www.codename-pineapple.org

Major update coming soon, hopefully.

/O
___
--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


Re: [asterisk-users] Re: NAT: RTP Path Optimization

2007-01-30 Thread Brad Templeton
On Mon, Jan 29, 2007 at 12:05:28PM +0100, Benny Amorsen wrote:
 PC When I set for Extern1/2 canreinvite=yes it works, but
 PC Intern-2-Extern doesn't work because Asteisk gives out the
 PC private IP-Adresses of Int1/2
 
 Asterisk can't give out a public IP-address for Int1/2. Where
 would it get one from?
 
Correct that it doesn't.   But some kind sould could indeed code a
variety of techniques to get it, such as:

a) If the phone supports STUN or a static external IP mode, it often will
include the known external IP in its SIP headers.   Asterisk would ignore
those headers and talk directly to the internal address (equivalent to what
it does with NAT=yes, but for RTP too) when talking directly to the phone,
but when connecting the phone to outside addresses, it would pass these
addresses and SDPs.

b) In many cases, such phones sit behind a NAT which can have hard coded
port forwardings so that Asterisk could simply be told, in sip.conf, what
the external IP and port of the phone are, and it could rewrite SDPs when
needed.

c) The phone could attempt to reach Asterisk through an external address, even
though the phone is on the same natwork as the Asterisk.  This would tell
Asterisk the external IP of the phone, and it could rewrite SDPs.  However,
since many NATs don't support hairpin of audio, for those NATs asterisk must
use internal SDPs to connect devices behind the same NAT, including itself if
that is the case.

Anyway, as noted, there are many answers to your question of how asterisk 
_could_
get the info from, but at present it does not.

They are all kludges of course.   Just about all NAT penetration involves some
kludging.
___
--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


Re: [asterisk-users] Re: NAT: RTP Path Optimization

2007-01-30 Thread Patrick Cervicek

Brad Templeton schrieb:

On Mon, Jan 29, 2007 at 12:05:28PM +0100, Benny Amorsen wrote:


PC When I set for Extern1/2 canreinvite=yes it works, but
PC Intern-2-Extern doesn't work because Asteisk gives out the
PC private IP-Adresses of Int1/2

Asterisk can't give out a public IP-address for Int1/2. Where
would it get one from?



Correct that it doesn't.   But some kind sould could indeed code a
variety of techniques to get it, such as:


Again: My Problem is not Intern-to-Extern (NAT,Stun). My Problem is 
Extern-to-Extern, that the external phones are not talking RTP 
*directly* to each other. This is bad, when Asterisk is in Europe and 
the Phones are in Asia.

___
--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


Re: [asterisk-users] Re: NAT: RTP Path Optimization

2007-01-30 Thread Brad Templeton
On Tue, Jan 30, 2007 at 12:00:17PM +0100, Patrick Cervicek wrote:
 Brad Templeton schrieb:
 On Mon, Jan 29, 2007 at 12:05:28PM +0100, Benny Amorsen wrote:
 
 PC When I set for Extern1/2 canreinvite=yes it works, but
 PC Intern-2-Extern doesn't work because Asteisk gives out the
 PC private IP-Adresses of Int1/2
 
 Asterisk can't give out a public IP-address for Int1/2. Where
 would it get one from?
 
 
 Correct that it doesn't.   But some kind sould could indeed code a
 variety of techniques to get it, such as:
 
 Again: My Problem is not Intern-to-Extern (NAT,Stun). My Problem is 
 Extern-to-Extern, that the external phones are not talking RTP 
 *directly* to each other. This is bad, when Asterisk is in Europe and 
 the Phones are in Asia.
 ___


That you can usually make work with most phones today, as long as
the phone has some NAT penetration in it.The most versatile
approach is STUN -- see if you can configure STUN on your phones.

Some phones that don't have STUN do support a hard-configured external
address.  However, they often require a numeric IP, which means
that they only work if you have a static IP, and your RTP port number
never changes on the outside.

A few phones also support extracting information from rport fields etc.
However, they tend to have STUN too.

Then you must also keep a port in the NAT open, by one of the following
methods.

a) Manual hole in the NAT -- most NATs support this (port forwarding)
and it is recommended. Set your phone to a fixed SIP Port
and port forward that to your phone.  Requires phone have a fixed
internal IP usually.

b) Keep alive transmitted by phone (will be on phone's config)

c) qualify=yes in asterisk sip.conf sends keep alive from asterisk.
   Works, but if it ever fails your phone won't ring until it
   re-registers.

d) Very short registration time, like 30 seconds to 1 minute.  This
   will effectively do a keep alive from the phone.   I like this
   least.



If your phone does not understand NAT properly it will forward
a useless SDP that is internal.   This is what some Cisco phones
do.  For those, you are currently screwed.   Some day Asterisk might
support rewriting SDPs that contain unreachable addresses but it
does not, at present, do this.
___
--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


[asterisk-users] Re: NAT: RTP Path Optimization

2007-01-30 Thread Benny Amorsen
 PC == Patrick Cervicek [EMAIL PROTECTED] writes:

PC But then all RTP Traffic of my internal phones will go over
PC Asterisk. I want RTP to go Peer-to-Peer. == Intern-2-Intern
PC and Extern-to-Extern should go P2P and Intern-2-Extern should
PC go over Asterisk, see picture

I understand what you want. I am telling you that you cannot get what
you want, and the best compromise you can achieve. Either your
internal-to-internal calls go direct, or your external-to-external do.
Pick one.


/Benny


___
--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


Re: [asterisk-users] Re: NAT: RTP Path Optimization

2007-01-30 Thread Brad Templeton
On Tue, Jan 30, 2007 at 10:23:09PM +0100, Benny Amorsen wrote:
  PC == Patrick Cervicek [EMAIL PROTECTED] writes:
 
 PC But then all RTP Traffic of my internal phones will go over
 PC Asterisk. I want RTP to go Peer-to-Peer. == Intern-2-Intern
 PC and Extern-to-Extern should go P2P and Intern-2-Extern should
 PC go over Asterisk, see picture
 
 I understand what you want. I am telling you that you cannot get what
 you want, and the best compromise you can achieve. Either your
 internal-to-internal calls go direct, or your external-to-external do.
 Pick one.

You can almost get it, if your NAT will hairpin, by having your
internal phones all present their external addresses.   Then
all phones will appear external, and all can talk to one another
(though there can still be port change problems on reinvite if you
don't do explicit ports)  -- but internal to internal (and all other internal
involved calls) will go through your NAT box, not your Asterisk box.

However, the NAT must hairpin audio, and a lot of them don't.

Here is Cullen's latest chart of who hairpins:

http://tools.ietf.org/wg/behave/draft-jennings-behave-test-results-03.txt

Only a few do it, and only a few make his group A category at all.

Of course, many of these boxes are not expensive so it may be worth
switching, though many of us love the WRT54G and its clones because
of the ability to use open source firmware.  However, the bastard
does not hairpin, I don't know if any of the new firmwares do.
___
--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


[asterisk-users] Re: NAT: RTP Path Optimization

2007-01-29 Thread Benny Amorsen
 PC == Patrick Cervicek [EMAIL PROTECTED] writes:

PC http://lisas.de/~patrick/temp/rtp-optimierung.png Everything is
PC working fine in my Setup, but I want Extern1 to talk to Extern2
PC directly whitout going over Asterisk as the uplink is slow.

PC When I set for Extern1/2 canreinvite=yes it works, but
PC Intern-2-Extern doesn't work because Asteisk gives out the
PC private IP-Adresses of Int1/2

Asterisk can't give out a public IP-address for Int1/2. Where
would it get one from?

PC I defined localnet=10.0.0.0/255.0.0.0 (Private LAN) but this
PC doesn't help.

PC Ideas, how to handle Extern-2-Extern (RTP bypass Asterisk)? Do I
PC have to adjust nat somwhere?

Set canreinvite to no for Int1/2.


/Benny


___
--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


Re: [asterisk-users] Re: NAT: RTP Path Optimization

2007-01-29 Thread Patrick Cervicek

Benny Amorsen schrieb:

PC == Patrick Cervicek [EMAIL PROTECTED] writes:



PC http://lisas.de/~patrick/temp/rtp-optimierung.png Everything is
PC working fine in my Setup, but I want Extern1 to talk to Extern2
PC directly whitout going over Asterisk as the uplink is slow.

PC When I set for Extern1/2 canreinvite=yes it works, but
PC Intern-2-Extern doesn't work because Asteisk gives out the
PC private IP-Adresses of Int1/2

Asterisk can't give out a public IP-address for Int1/2. Where
would it get one from?


Asterisk gives out his own public adress and stays in the Media-Path 
between internal and external Phones. This avoids NAT-Problems.



PC I defined localnet=10.0.0.0/255.0.0.0 (Private LAN) but this
PC doesn't help.

PC Ideas, how to handle Extern-2-Extern (RTP bypass Asterisk)? Do I
PC have to adjust nat somwhere?

Set canreinvite to no for Int1/2.


But then all RTP Traffic of my internal phones will go over Asterisk. I 
want RTP to go Peer-to-Peer.
== Intern-2-Intern and Extern-to-Extern should go P2P and 
Intern-2-Extern should go over Asterisk, see picture


___
--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