This changes how matching is done globally for all endpoints, but you can also change it per endpoint.
For PJSIP trunks there is now a GUI option:
Setting this alone might actually solve the OP’s problem.
If not, identify_by=auth_username can be set for each endpoint in pjsip.endpoint_custom_post.conf
.
[extension](+)
identify_by=auth_username