Asterisk difference between peer and friend

Here is how type=peer is different from type=friend in Asterisk, with some examples:

 

— TYPE=PEER —
If host=dynamic THEN requires REGISTER

If host= is NOT dynamic:
CHECK “host=x.x.x.x”  => IF NO “secret=” OR “insecure=invite” => allow (without checking [user]/secret)

 

 

— TYPE=FRIEND —

Calls can be made without REGISTRATION if the following conditions are met even if “host=dynamic” :
IF NO “secret=” OR “insecure=invite” => match “host=x.x.x.x” (without checking [user]/secret) => allow

IF NO “secret=” OR “insecure=invite” => match [user] (without checking “secret=” or “host=”) => allow

IF match [user] AND “secret=” (without checking “host=”) => allow

 

 

 

Example:

[dad]
secret=su12su9213
type=friend
insecure=invite
host=dynamic

“dad” could make a call using “dad” as username without needing to know the password from any host

 

 

[dad]
;;;;secret=somepass
type=friend
insecure=no
host=dynamic

“dad” could make a call using “dad” as username without needing to know the password from any host

 

 

[dad]
secret=su12su9213
type=friend
insecure=invite
host=1.1.1.1

“dad” could make a call using any user/secret if connecting from 1.1.1.1

 

 

[dad]
;;;;secret=somepass
type=friend
insecure=no
host=1.1.1.1

“dad” could make a call using any user/secret if connecting from 1.1.1.1

 

[dad]
secret=su8123su
type=peer
insecure=invite
host=1.1.1.1

“dad” could make a call using any user/secret if connecting from 1.1.1.1

 

[dad]
;;;;secret=su8123su
type=peer
insecure=no
host=1.1.1.1

“dad” could make a call using any user/secret if connecting from 1.1.1.1