Not entirely…
Your translation rules need to happen on your outbound routes, once the call passes an outbound route VitalPBX considers the call ready to be sent to the trunk.
However, VitalPBX allows you to specify additional manipulation rules on the Trunk level, this is useful if you utilize the Trunk for emergency numbers, where you can strip a leading 9 from 9911 etc.
So to understand this, each VitalPBX trunk would have a rule like this:
[trk-1]
exten => _[+*#0-9].,1,Set(_NTD=${EXTEN})
same => n,Gosub(trk-1-dial,${NTD},1(${ARG1}))
...
This will allow any call past the outbound route to dial the Trunk.
Now, say we want to strip the leading 9 from 9911
Then VitalPBX will generate the following:
[trk-1]
exten => _9911,1,Set(_NTD=${EXTEN:1})
same => n,Gosub(trk-1-dial,${NTD},1(${ARG1}))
...
exten => _[+*#0-9].,1,Set(_NTD=${EXTEN})
same => n,Gosub(trk-1-dial,${NTD},1(${ARG1}))
...
Now you have two rules/patterns that would allow that 9911 call, right? How does Asterisk know to use the 9911 rule? The order doesn’t matter here.
The answer is that the best match is simply the most specific pattern.
So because we have a rule that says 9911, Asterisk will chose that one as the best match. You can see the best match when calling the dialplan show
command
root@pbx2:~# asterisk -x"dialplan show 9911@trk-1"
[ Context 'trk-1' created by 'pbx_config' ]
'_9911' => 1. Set(_NTD=${EXTEN:1}) [extensions__50-1-dialplan.conf:27601]
2. Gosub(trk-1-dial,${NTD},1(${ARG1})) [extensions__50-1-dialplan.conf:27602]
...
'_[+*#0-9].' => 1. Set(_NTD=${EXTEN}) [extensions__50-1-dialplan.conf:27625]
2. Gosub(trk-1-dial,${NTD},1(${ARG1})) [extensions__50-1-dialplan.conf:27626]
...
So the same applies to your issue.
root@pbx2:~# asterisk -x"dialplan show 12128885555@trk-1"
[ Context 'trk-1' created by 'pbx_config' ]
'_[+*#0-9].' => 1. Set(_NTD=${EXTEN}) [extensions__50-1-dialplan.conf:27631]
2. Gosub(trk-1-dial,${NTD},1(${ARG1})) [extensions__50-1-dialplan.conf:27632]
...
'_.' => 1. Set(_NTD=11579657*${EXTEN:0}) [extensions__50-1-dialplan.conf:27625]
2. Gosub(trk-1-dial,${NTD},1(${ARG1})) [extensions__50-1-dialplan.conf:27626]
...
So in order for that to work your pattern would have to be something better than [+*#0-9].
Also, if you ever watched the log, Asterisk is always warning when using a .
as the “pattern”
The use of ‘_.’ for an extension is strongly discouraged and can have unexpected behavior
See Asterisk pattern matching documentation:
https://docs.asterisk.org/Configuration/Dialplan/Pattern-Matching/