I’ve previously had an Asterisk installation running for about 3 years without problem (though it may have used Chan_SIP rather than PJSIP). It supported 2 phone numbers at the provider. Following a major failure I’ve reinstalled from scratch which ought to have been straightforward. However though I can get phone calls in and out I cannot route based on the DID. The To field being used for processing appears not to contain the dialled number, whereas the number is present in other headers.
Ask on https://community.freepbx.org/ although you might want to note chan_pjsip uses s as the default value for contact-user, although that would mean you weren’t receiving the value from the provider, but only one reflected, by the provider, from you sent it. To the extent that contact-user is just reflected back, you could set your initial extension to be s. Maybe FreePBX calls the initial extension, for incoming calls, the DID?
Thank you for the reference to the freepbx community. There are many references to DID not working though most appear to have been solved by using the from-pstn-toheader context. I’ll do some more digging and debugging to see where the correct DID gets replaced by s.