Most concise way to determine endpoint's address

Using PJSIP, given and endpoint name, what is the most concise way to determine it’s real IP address? I have been using asterisk -r -x 'database show registrar' and parsing out the via_addr, but it seems that clients can lie about that and use an address that Asterisk will not see it’s socket connected to.

There is of course asterisk -r -x "pjsip show aor <endpoint>" but that’s not a very nice format to have to parse, if there is something more concise.

It’s important to note that I am doing this query externally (hence the use of asterisk -r -x and not in the context of an ongoing call,

The CLI is not meant for machine consumption, it’s made for human consumption. The AMI provides actions for querying AORs.