There are multiple entities involved here, each with their own name space, but often with degeneracy between the name spaces. The Asterisk documentation doesn’t clearly define when the AOR and when the endpoint name space is being used. Whilst Asterisk is clear that extensions are a third name space, FreePBX confuses that distinction, as well, so most times people write about extension, they are talking about an endpoint and/or AOR.
Because the documentation is not clear to me, I’m not completely clear how the degeneracy is broken when you have multiple AORs for an endpoint, or multiple endpoints for an AOR. To really match the SIP RFC concepts, I think the section name given in PJSIP dialstrings should be that of an AOR, but I think it is actually always an endpoint. I’m not so sure about PJSIP_DIAL_CONTACTS; that may well address the AOR.
Logically, in terms of the SIP RFC, the granularity of the addressing should be the AOR, not the contact, as the point of AORs is that they represent the public name of the user agent.
Having described the confusing issues here, if we simplify and also ignore the point that the AOR is the only public name for the destination, if you know enough about the structure of the contact URIs to be able to distinguish them, custom dial plan can read PJSIP_DIAL_CONTACTS, parse it into individual addresses, and you can then dial that using PJSIP/xxxxxx/contact-uri, where xxxxxxx is the degenerate endpoint/AOR name, but I’m not 100% certain which it represents, if you break the degeneracy, although I think it is endpoint.
If you know the full contact URI, you can use it without requesting the registered value.
(One of the divergences from the RFC is that Asterisk seems to assume that the registrant is the same as the registree.)
PJSIP_DIAL_CONTACTS takes both an endpoint and an optional aor, so the way of doing this which better matches the spirit of the SIP RFC, would be for the phone to register under two AORs, one of them unique to it, and one that was the roamable number.
Getting the phone to do this might be fun.
Because Asterisk defaults to dialling the endpoint, rather than the AOR, you could take advantage of its confused data model, by having a different AOR for each phone, and using PJSIP_DIAL_CONTACTS with an AOR parameter, to call them individually and without, to call all of them. I find this particularly messy, as it is admitting that the AOR entity doesn’t really represent an AOR.
Give the phones separate extension numbers.
Set up a Ring Group that rings both phones.
Set CID Num Alias for both extensions to the ring group number.
Publish the ring group number as the ‘normal’ number to reach the user.
You can then call one of the extension numbers to ring a specific phone.