Proper usage of user's and peer's (was Re: [Asterisk-Users] IAX2
Trunking confirmation?)
Jeremy McNamara
jj at nufone.net
Thu Oct 9 12:57:39 MST 2003
WipeOut wrote:
> Jeremy, Can you elaborate on how using type=friend would restrict the
> dialplan.. Just so I am aware of the pitfalls.. :)
Mark's words to me, when I was a newbie:
[00:08] <kram> a user is to authenticate an incoming call
[00:08] <kram> a peer is someone you send a call to
[00:08] <kram> friend, of course, is both
I'll give you a real world example that has happened to more than a few
NuFone customers:
NuFone Customer A orders a toll-free number and termination from us.
Instead of following the example config we send he does:
[NuFone]
type=friend
secret=his_secret
host=switch-1.nufone.net.
context=NANPA
When NuFone sends the toll-free calls to his Asterisk box, they will
land in HIS NANPA context, which is really confusing, but he does figure
that fact out and is able to make both toll-free inbound and outbound
calls work.
Then a few weeks later he decides to pick up a regular DID from us. Now,
his (above) configuration will fail for the regular DID inbound calls,
but nothing else, because our regular DIDs do not come from
switch-1.nufone.net.
The proper way is to separate the tasks. Starting with the user:
[NuFone]
type=user
secret=his_secret
context=inbound
This way he is not restricting the hostname/IP address where the user
'NuFone' can call in from. Plus, he now has a more logical context for
all of his inbound calls.
and the peer simply has the required information:
[NuFone]
type=peer
secret=his_secret
context=NANPA
host=switch-1.nufone.net
Yes, a friend is a very easy way to get things started and it can be
made to work, but you will end up causing hair loss and/or heartburn
trying to figure out why everything doesn't work the way you expect it
to, when you go to add more complexity to your operation.
The moral of the story is: Separate those tasks now, so you can avoid
problems later.
Jeremy McNamara
More information about the asterisk-users
mailing list