A bit confused about differences between SIP types


I’m a bit confused as to what are the differences between the three SIP types peer, friend and user.
I read this: asteriskdocs.org/en/3rd_Edit … g_id291081 but it didn’t help.

Can someone explain me in more details please?


Unfortunately the developers think these are obvious, so reject requests for better documentation, even though they are much misused.

peer matches invites by address. user matches them by from: (or possibly contact:). friend tries to be a user then a peer.

As peer will match register requests by name, it is rarely necessary to use anything else, and it is generally more secure and less confusing, to just use peer.

Thanks for your answer, but I’m still confused.

What does it mean matches by address or by from: ?

I am not very familiar with SIP/VoIP, sorry if my questions are obvious.

If you have exhausted asteriskdocs.org/, Google for “SIP RFC” and read it, probably several times. This is not the place for tutorials on the SIP protocol.

peer: the call is authenticated by the ip address, it can make and receive calls. Used for sip trunks.
user: the call is authenticated by the username, that is the reason because you can use host=dynamic. It can just make calls. I don´t know were to use it.
friend: a mix between peer and user, it uses username and the ip that the user was registered, it can make and receive calls. Used for sip extensions.

I have red it years ago from sip.conf, I suggest you to read it

You can and should use peer with host=dynamic. (REGISTER matches on name, at which point the IP address is captured and used for subsequent matches.)

There was a major rework of the peer/user/friend logic for SIP about three years ago. As “years ago” could imply more, you may be using out of date information.

Also, as noted up-thread, the developers haven’t felt the need to clarify the distinctions since then, resulting in lots of people using friend when peer would be be safer.