How to deal IP phones are either signaling to IP or hostname?

Hello,

Let say I have an Asterisk 20 instance using PJSIP. The Asterisk host is a member of several LANs.
Some IP phones would send signalling to this Asterisk instance using a private IP address in the domain part of SIP URIs.
Some other IP phones would use a domain name that can be resolved by local DNS setup.
Lastly, some other IP phones would use a domain name that CANNOT be resolved by local DNS setup.

  1. How can I configure PJSIP to serve these 3 cases ?
  2. Can I take for granted that Asterisk will reply to all phones using the same SIP URI domain part the phone has chosen to work with ?

Best regards

force_rport, rewrite_contact, and symmetric_media deal with this sort of situation, by using the IP source address, rather than the address given in the request or response. In some complex cases, this will break things, though.