I have a user whose extension is 1000, but I’d also like the dialplan to route using his username of “michael” … Is there a way I can do both in a single rule, instead of splitting like the below? Is this the right way to do this?
exten => 1000,1,NoOp(Dial Extension)
same => n,Dial(${PJSIP_DIAL_CONTACTS(michael)},10)
same => n,VoiceMail(${EXTEN}@internal-vm,u)
same => n,Hangup()
exten => michael,1,NoOp(Dial Extension)
same => n,Dial(${PJSIP_DIAL_CONTACTS(michael)},10)
same => n,VoiceMail(${EXTEN}@internal-vm,u)
same => n,Hangup()
Having names is slightly more secure, although the official advice is something less guessable. However most people make the device name the same as the primary extension number, so that they can use ${EXTEN}, with a wildcard for the extension field.
You can’t have an OR operator in a pattern, except for character classes in a single character position, and you cannot have anything that matches more than a single character, except at the end of the pattern.
The patterns are compiled at dialplan reload time, and the internal data structure allow fast parallel lookups, but with each branch leading to a different place.