Type=peer vs type=friend

Can you explain what does it mean (in modern Asterisk versions)? I have both password-protected and “trunk” peers and friends, everything works fine both for inbound and outbound calls via these peers/friends. What’s the difference?

A SIP friend will recognize its name in the from part of a SIP invite, even though the call doesn’t come from the right address… It is therefore normally a security risk, and can also cause calls to be falsely rejected if they have the same caller ID value in the From header, but come from a “trunk”.

There are some occasions when friend is useful, but I can’t recall any at the moment.

Okay, so I can use type=peer for any kind of peers and it will be fine.

And a bug, maybe related to this peer/friend thing. On * machine I have [1234567] password-protected account for test purposes and I also can dial “thru” this * machine with same CID 1234567, but from “trunk” peer from another PBX. And… call is routed by Asterisk like it came from password-protected peer, with it’s context and other settings. What’s this?

That’s the result of using friend when all you need is peer.

This might be helpful forums.digium.com/viewtopic.php?t=79338