You have to have phones to enable people to call each other.

Why to have more then one phone

If you have multiple rooms, you may want to have multiple phones too. This is not complicated in theorie, but can be complex in pjsip.

[phone_11]
type=endpoint
transport=transport-udp
context=internalsip
disallow=all
allow=g722
allow=alaw
auth=auth-value11
aors=11

[auth-value11]
type=auth
auth_type=userpass
password=11
username=11
realm=${YOUR_HOSTNAME}

[11]
type=aor
max_contacts=1
remove_existing=true

[11]
type=identify
endpoint=phone_11
match=${YOUR_NETWORK_WITH_MASK}

After having this up and running the rest is clear. You simply have to copy this section multiple times and with that you gain more phones.

NO. (No matching endpoint found, Failed to authenticate)

You and up with having one one. This is possible because this identify directive seems to be exclusive. Only the first time you specify a match based on a network, you can have a match. The 2nd and 3rd time it's never reached.

Also the aors seems to be relativly stable, so we only need one for all phones.

NO.

You need one per phone.

In the Internet you find some people having found a solution to this using identify_by in the endpoint, but this seemed to change nothing for me. So I was searching for a solution and must say to the solutions

NO.

This switch almost did nothing noticable.

Obvious solution: Match only ips and never change them.

NO.

Draw back here is that your dhcp might change or you move the phones to a seperated network.

Dynamics

Instead of adding all the ips to the configuration I used the match_header to match with a regex on the Conect header in the registration. This makes it dynamic and enabled more then one phone.

[phone_endpoint_macro](!)
type=endpoint
transport=transport-udp
context=internalsip
disallow=all
allow=g722
allow=alaw
[phone_auth_macro](!)
type=auth
auth_type=userpass
realm=${YOUR_HOSTNAME}
;==========================================================
[phone_11](phone_endpoint_macro)
auth=11
aors=11
[11](phone_auth_macro)
password=11
username=11
[11]
type=identify
endpoint=phone_11
match_header=Contact:/11@/
[11_message]
type=identify
endpoint=phone_11
match_header=From:/11@/
[11]
type=aor
max_contacts=1
remove_existing=true

Updates

2019-04-16: adding 11_messages identifier for SMS handlig