I don’t think there is a way currently do this in Asterisk. I believe the closest you can get is to use PJSIP_MEDIA_OFFER. However, as you’ve probably surmised that will only return the intersection of the offer, and what you have configured on your endpoint in the “allow” setting. I guess if you configured your endpoint to “allow=all” then PJSIP_MEDIA_OFFER should return all offered codecs.
Perhaps if you describe why you need to retrieve the full list of offered codecs, or what you are trying to accomplish someone will know of a better/another way to do it and achieve the same expected result.