Match endpoint by arbitrary value?

This is a bit of a first world problem but I wanted to clean up my pjsip.conf a bit and it bugs me that the sections have to be named by whatever the phone sends.

For example, this works:

[74123]
type=endpoint
auth=smith-auth
aors=74123
context=from-smith

[smith-auth]
username=74123
password=penfish

But I would prefer to call the endpoint and aor sections [smith] instead of [74123], something like:

[smith]
type=endpoint
identifier=74123 ; I made this up
auth=smith-auth
aors=smith-aor
context=from-smith

[smith-auth]
username=74123
password=penfish

Is that possible?

Yes, it’s just code. Do the following:

Code Contribution - Asterisk Documentation

There are various endpoint identifier options, but nothing that allows you to do this specifically for endpoints, and there is no such thing for AORs at all (and the name of an AOR has meaning within SIP). If you modified the code then you could probably do it, but it would come at a cost. The names of these act as essentially primary keys across things to provide fast lookups.