Allow user and peers from the same IP

Hi,

I am using the PJSIP wizard. I want to allow all calls from my home IP. I have in pjsip_wizard.conf

[TeleNoPing]
type = wizard
sends_auth = no
sends_registrations = no
remote_hosts = 10.174.175.254,90.90.90.90
endpoint/context = from-external
endpoint/rtp_symmetric = yes
endpoint/allow = ulaw,alaw,g722

I want to then create a specific user say dovid and allow him to register and be able to make calls from a different context. I tried all sorts of tricks such as setting a specific endpoint/from_domain for the specific user but it did not work. My latest attempt was

[dovid]
type = wizard
accepts_auth = yes
accepts_registrations = yes
transport = transport-udp-5060
endpoint/context = dovid_main
endpoint/allow = ulaw
endpoint/rtp_symmetric = yes
endpoint/force_rport = yes
endpoint/direct_media = no
endpoint/ice_support = yes
endpoint/rewrite_contact = yes
endpoint/bind_rtp_to_media_address = yes
aor/max_contacts = 2
aor/qualify_frequency = 30
inbound_auth/username = dovid
inbound_auth/password = PASSWORD
endpoint/from_domain = sip.dovid.local

But asterisk kept giving a 404 and seeing the user as TeleNoPing. Is there any way to allow all calls under one peer but allow this specific user to register and make calls with a different peer?

The matching order is configured in pjsip.conf[1] with IP based matching being preferred above user. You would need to alter the order to have username before ip.

[1] asterisk/configs/samples/pjsip.conf.sample at master · asterisk/asterisk · GitHub

I tried setting under global endpoint_identifier_order=username,ip,anonymous but when the phone would try to register it would try it via the IP endpoint. In Asterisk I get find_registrar_aor: AOR '' not found for endpoint 'TeleNoPing'

Please provide a SIP trace, as well as the output of “pjsip show settings”.