Re: [asterisk-users] Multi-homed SIP in Asterisk 11?

2013-07-31 Thread George Joseph
Here's how I set up Asterisk in my SOHO installations.  For most of these,
the asterisk box is dual homed and some are also the site's
router/firewall.  The config is the same either way.

sip.conf
[general]
bindaddr = 0.0.0.0:5060
externhost = something ; for the sites with a dynamic ip.
externip = something ; for the sites with a static ip.
localnet = 192.168.0.0/24
nat = force_rport,comedia
directmedia = yes
insecure=port,invite

For the peers (both phones and itsp) in either sip.conf or users.conf...
nat = force_rport,comedia
directmedia = yes
insecure=port,invite

The only deviation from this is for phones that are behind a nat different
from the one asterisk is on.  For instance, a phone on a home network that
connects to asterisk on an office network.  For these, set directmedia=no.

With these settings, audio between the peers is always direct except for
the foreign network phones.  Transfers, parking, voicemail, etc all work
flawlessly.

Another advantage of directmedia is that codec negotiation happens between
the peers so phones that support g722 for instance will use the hd codec
between themselves but will use pcm with the itsp if that's all that's
supported.  Without directmedia, asterisk will set up the phone leg of the
call with g722 and the itsp leg of the call with pcm then transcode.  Not
optimal.




On Wed, Jul 31, 2013 at 9:31 AM, Gareth Blades <
mailinglist+aster...@dns99.co.uk> wrote:

> On 31/07/13 16:12, Tony Mountifield wrote:
>
>> Thanks. But I thought localnet= and externip= were for when the external
>> interface is going through NAT. In this case the ITSP is connected through
>> a real non-NATted public interface.
>>
>> Is it possible to specify directmedia=no just for the SIP trunk? So that
>> the phones could still do direct media between themselves, but not if
>> they were connected to the trunk?
>>
>> Cheers
>> Tony
>>
>
> The localnet= can have implications as when asterisk sees that IP address
> it knows its local. This may have knock on effects when you have other
> settings which do different things of the endpoint is known to be behind
> nat.
>
> Its not clearly documented what needs to be set when directmedia=no is
> turned on. Does it only need to be set on one endpoint, both, or just the
> destination etc... I am sure you can do it that way but you will need to
> have a play and work it out.
>
> I wonder if using directmedia=nonat will help at all. It will disable
> directmedia if one endpoint is behind nat (this is where localnet= comes
> in) but I dont know if it will then know to enable direct media if both
> endpoints are behind nat. I suspect it wont as the endpoints may not
> necessarily be behind the same nat so this would be unsafe.
>
> --
> __**__**_
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
>   http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>   
> http://lists.digium.com/**mailman/listinfo/asterisk-**users
>
--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Multi-homed SIP in Asterisk 11?

2013-07-31 Thread Gareth Blades

On 31/07/13 16:12, Tony Mountifield wrote:

Thanks. But I thought localnet= and externip= were for when the external
interface is going through NAT. In this case the ITSP is connected through
a real non-NATted public interface.

Is it possible to specify directmedia=no just for the SIP trunk? So that
the phones could still do direct media between themselves, but not if
they were connected to the trunk?

Cheers
Tony


The localnet= can have implications as when asterisk sees that IP 
address it knows its local. This may have knock on effects when you have 
other settings which do different things of the endpoint is known to be 
behind nat.


Its not clearly documented what needs to be set when directmedia=no is 
turned on. Does it only need to be set on one endpoint, both, or just 
the destination etc... I am sure you can do it that way but you will 
need to have a play and work it out.


I wonder if using directmedia=nonat will help at all. It will disable 
directmedia if one endpoint is behind nat (this is where localnet= comes 
in) but I dont know if it will then know to enable direct media if both 
endpoints are behind nat. I suspect it wont as the endpoints may not 
necessarily be behind the same nat so this would be unsafe.


--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
  http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Multi-homed SIP in Asterisk 11?

2013-07-31 Thread Tony Mountifield
In article 
<616B4ECE1290D441AD56124FEBB03D08171492B22C@mailserver2007.nyigc.globe>,
Eric Wieling  wrote:
> This is the standard way we set up our servers.   There is nothing special 
> about it.   Just make sure you disable direct media.

Thanks, that's reassuring. Appreciate the response!

Tony

> -Original Message-
> From: asterisk-users-boun...@lists.digium.com 
> [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Tony Mountifield
> Sent: Wednesday, July 31, 2013 10:33 AM
> To: asterisk-users@lists.digium.com
> Subject: [asterisk-users] Multi-homed SIP in Asterisk 11?
> 
> Most of my experience until recently has been in Asterisk 1.2, and I am just 
> starting to make use of Asterisk 11 for new systems.
> 
> I have a question about using SIP on a multi-homed machine.
> 
> I have a customer who wants an Asterisk box with two network interfaces:
> one on the public Internet (no NAT), and one on a private LAN. The box will 
> not do any IP forwarding between interfaces. They want to connect to a SIP 
> trunk from an ITSP via the public interface, and to have SIP phones on their 
> LAN registered via the private interface.
> 
> I haven't tried such a setup before, so before creating a test system, I 
> wondered if anyone here has made such a setup, and whether there are any 
> issues with getting SDP contents and media routing correct?
> 
> Cheers
> Tony
> --
> Tony Mountifield
> Work: t...@softins.co.uk - http://www.softins.co.uk
> Play: t...@mountifield.org - http://tony.mountifield.org
> 
> --
> _
> -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to 
> Asterisk? Join us for a live introductory webinar every Thurs:
>http://www.asterisk.org/hello
> 
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>http://lists.digium.com/mailman/listinfo/asterisk-users
> 
> --
> _
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
>http://www.asterisk.org/hello
> 
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>http://lists.digium.com/mailman/listinfo/asterisk-users
> 


-- 
Tony Mountifield
Work: t...@softins.co.uk - http://www.softins.co.uk
Play: t...@mountifield.org - http://tony.mountifield.org

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Multi-homed SIP in Asterisk 11?

2013-07-31 Thread Tony Mountifield
In article <51f925f2.1040...@dns99.co.uk>,
Gareth Blades  wrote:
> On 31/07/13 15:32, Tony Mountifield wrote:
> > Most of my experience until recently has been in Asterisk 1.2, and I am
> > just starting to make use of Asterisk 11 for new systems.
> >
> > I have a question about using SIP on a multi-homed machine.
> >
> > I have a customer who wants an Asterisk box with two network interfaces:
> > one on the public Internet (no NAT), and one on a private LAN. The box
> > will not do any IP forwarding between interfaces. They want to connect
> > to a SIP trunk from an ITSP via the public interface, and to have SIP
> > phones on their LAN registered via the private interface.
> >
> > I haven't tried such a setup before, so before creating a test system,
> > I wondered if anyone here has made such a setup, and whether there are
> > any issues with getting SDP contents and media routing correct?
> >
> > Cheers
> > Tony
> I normally just ensure localnet= and externip= is set correctly. I 
> normally also have 'directmedia=no' defined in sip.conf so that asterisk 
> is performing store and forward for all the rtp traffic. That does mean 
> rtp traffic for internal calls is going via asterisk where it could be 
> direct between the phones but the amount of traffic doing this is 
> normally pretty trivial so it doesnt matter in most cases.

Thanks. But I thought localnet= and externip= were for when the external
interface is going through NAT. In this case the ITSP is connected through
a real non-NATted public interface.

Is it possible to specify directmedia=no just for the SIP trunk? So that
the phones could still do direct media between themselves, but not if
they were connected to the trunk?

Cheers
Tony
-- 
Tony Mountifield
Work: t...@softins.co.uk - http://www.softins.co.uk
Play: t...@mountifield.org - http://tony.mountifield.org

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Multi-homed SIP in Asterisk 11?

2013-07-31 Thread Gareth Blades

On 31/07/13 15:32, Tony Mountifield wrote:

Most of my experience until recently has been in Asterisk 1.2, and I am
just starting to make use of Asterisk 11 for new systems.

I have a question about using SIP on a multi-homed machine.

I have a customer who wants an Asterisk box with two network interfaces:
one on the public Internet (no NAT), and one on a private LAN. The box
will not do any IP forwarding between interfaces. They want to connect
to a SIP trunk from an ITSP via the public interface, and to have SIP
phones on their LAN registered via the private interface.

I haven't tried such a setup before, so before creating a test system,
I wondered if anyone here has made such a setup, and whether there are
any issues with getting SDP contents and media routing correct?

Cheers
Tony
I normally just ensure localnet= and externip= is set correctly. I 
normally also have 'directmedia=no' defined in sip.conf so that asterisk 
is performing store and forward for all the rtp traffic. That does mean 
rtp traffic for internal calls is going via asterisk where it could be 
direct between the phones but the amount of traffic doing this is 
normally pretty trivial so it doesnt matter in most cases.


--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
  http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Multi-homed SIP in Asterisk 11?

2013-07-31 Thread Eric Wieling
This is the standard way we set up our servers.   There is nothing special 
about it.   Just make sure you disable direct media.

-Original Message-
From: asterisk-users-boun...@lists.digium.com 
[mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Tony Mountifield
Sent: Wednesday, July 31, 2013 10:33 AM
To: asterisk-users@lists.digium.com
Subject: [asterisk-users] Multi-homed SIP in Asterisk 11?

Most of my experience until recently has been in Asterisk 1.2, and I am just 
starting to make use of Asterisk 11 for new systems.

I have a question about using SIP on a multi-homed machine.

I have a customer who wants an Asterisk box with two network interfaces:
one on the public Internet (no NAT), and one on a private LAN. The box will not 
do any IP forwarding between interfaces. They want to connect to a SIP trunk 
from an ITSP via the public interface, and to have SIP phones on their LAN 
registered via the private interface.

I haven't tried such a setup before, so before creating a test system, I 
wondered if anyone here has made such a setup, and whether there are any issues 
with getting SDP contents and media routing correct?

Cheers
Tony
--
Tony Mountifield
Work: t...@softins.co.uk - http://www.softins.co.uk
Play: t...@mountifield.org - http://tony.mountifield.org

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to 
Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Multi-homed SIP in Asterisk 11?

2013-07-31 Thread j...@millican.us

On 7/31/2013 10:32 AM, Tony Mountifield wrote:

Most of my experience until recently has been in Asterisk 1.2, and I am
just starting to make use of Asterisk 11 for new systems.

I have a question about using SIP on a multi-homed machine.

I have a customer who wants an Asterisk box with two network interfaces:
one on the public Internet (no NAT), and one on a private LAN. The box
will not do any IP forwarding between interfaces. They want to connect
to a SIP trunk from an ITSP via the public interface, and to have SIP
phones on their LAN registered via the private interface.

I haven't tried such a setup before, so before creating a test system,
I wondered if anyone here has made such a setup, and whether there are
any issues with getting SDP contents and media routing correct?

Cheers
Tony
I built a setup like this a few years back.  I believe the hurdle was 
more for the OS than asterisk.


Let say the the two networks are 192.168.10.0/24 and 192.168.11.0/24  
and the gateways are 192.168.10.1 and 192.168.11.1 respectively, and the 
asterisk box server has the two interfaces as 192.168.10.11 and 
192.168.11.11


from memory(warning: my memory is not what it used to be):

echo "1 TenNet" >> /etc/iproute2/rt_tables
echo "2 ElevenNet" >> /etc/iproute2/rt_tables

ip route add 192.168.10.0/24 dev eth0 src 192.168.10.11 table TenNet
ip route add 192.168.11.0/24 dev eth1 src 192.168.11.11 table ElevenNet

ip route add default via 192.168.10.1 dev eth0 table TenNet
ip route add default via 192.168.11.1 dev eth1 table ElevenNet

ip route show 2>&1 >> $logFile

ip rule add from 192.168.10.11/32 table TenNet
ip rule add from 192.168.11.11/32 table ElevenNet

ip rule add to 192.168.10.11/32 table TenNet
ip rule add to 192.168.11.11/32 table ElevenNet

All that the above does is ensure that traffic is routed out the correct 
interface based on where it is headed. I.E. All traffic for 
192.168.10.0/24 goes out eth0 all traffic for 192.168.11.0/24 goes out eth1


Then in asterisk I believe I add a localnet setting in sip.conf  as 
192.168.11.0, could be wrong on this though.


JohnM


--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
  http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


[asterisk-users] Multi-homed SIP in Asterisk 11?

2013-07-31 Thread Tony Mountifield
Most of my experience until recently has been in Asterisk 1.2, and I am
just starting to make use of Asterisk 11 for new systems.

I have a question about using SIP on a multi-homed machine.

I have a customer who wants an Asterisk box with two network interfaces:
one on the public Internet (no NAT), and one on a private LAN. The box
will not do any IP forwarding between interfaces. They want to connect
to a SIP trunk from an ITSP via the public interface, and to have SIP
phones on their LAN registered via the private interface.

I haven't tried such a setup before, so before creating a test system,
I wondered if anyone here has made such a setup, and whether there are
any issues with getting SDP contents and media routing correct?

Cheers
Tony
-- 
Tony Mountifield
Work: t...@softins.co.uk - http://www.softins.co.uk
Play: t...@mountifield.org - http://tony.mountifield.org

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users