[Asterisk-Users] The Evil of type=friend explained, again (was Re: [Asterisk-Users] Minor Registration Problem With Polycom Soun dpoint IP 500)

Tilghman Lesher tilghman at mail.jeffandtilghman.com
Thu Feb 5 09:51:05 MST 2004


On Thursday 05 February 2004 05:50, Jeremy McNamara wrote:
> A type=friend is simply both a type=user and type=peer using the same
> set of config directives. While a type=friend makes things almost
> trivial to get calls working in both directions, it will limit the
> flexibility of your config and even hinder some of the more advanced
> uses of Asterisk.
>
> For example: Say you want to use the same 'user' across many
> different Asterisk boxes, which of course will have different IP
> addresses. In this situation, you cannot have a host keyword in your
> Asterisk config stanza for the type=user, but the type=peer requires
> some host keyword. Thus, if you use a type=friend you will limit the
> use of that one username to whatever IP address is contained in the
> host keyword.
>
> You only need to register to Asterisk if you have a dynamic IP
> address or you need to blow thru a firewall/NAT device. To register
> you need to have a type=peer with a host=dynamic. Since in your
> type=friend config directive you had host=some.ip.address, while this
> may be this is fine to for the type=user, this same value also gets
> used for the type=peer, which makes it so you cannot register since
> the IP address is hard coded.
>
> So, either you do not need to register and things will Just Work(tm)
> or you will need to use separate type=user and type=peer config
> directives.

So, why can't you just do:

[someuser]
type=friend
host=dynamic
context=internal
secret=somesecret

In other words, you can have your user registered to the server AND be
using a type=friend definition.  This is exactly how I have some test
equipment set up and it works perfectly well.

-Tilghman




More information about the asterisk-users mailing list