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

George Joseph george.joseph at fairview5.com
Wed Jul 31 15:01:40 CDT 2013


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+asterisk at 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<http://lists.digium.com/mailman/listinfo/asterisk-users>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20130731/493a4a32/attachment.htm>


More information about the asterisk-users mailing list