Trunk manipulation rules does not work

Hello all,

I use IP Authentication with outbound calls @ FLOWROUTE.
Therefore, I need to prepend all of my calls with my tech prefix (xxxxxx*)

By using the prepend in the Outgoing routes, everything worked.
But rather than doing this, I wanted to use the prepend manipulation rule within the trunk itself.

In the trunk Dialing Manipulation Rules, I entered under PREPEND the same code I had for the Outbound route
For the pattern, I tried both “.” and “1NXXNXXXXXX”

I then removed the prepend code in the outbound rule

At this point, I tried to make an outgoing call without success.
I tried to run asterisk -rvvvv but I dont get any logs in there.

Any help appreciated.
The goal is really to leave the outbound route alone with NO prepend, and keep the trunk prepend at the trunk level

Can you please share a screenshot of your dial patterns?

Also, if you don’t see any activity in the asterisk console, either the call isn’t hitting the PBX or your console log settings are messed up.

This is a random tech prefix for Flowroute, but this is how I have mine setup. Expecting that all outgoing calls on this trunk would have this tech prefix

My only way to get this working is to have the prefix in the outbound routes, as per this screen shot:

Regarding the logs, I see SIP INVITE when I use sngrep , but asterisk -rvvv only show logs if a call is established.

What happens if you specify the actual dial pattern under the trunk? (Instead of a period)

A detailed dial pattern like 1NXXNXXXXXX works.

I’m stuck with those empty logs from asterisk console too.

zero call here:

while the web interface shows 1 call 2 legs:

Then what is the problem of using that?

Well… It’s like creating an PHP page telling someone they have to use <? php> rather than <?=> … For simplicity, isn’t ‘.’ supposed to work as a trunk prepend pattern?

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/

Thank you for the detailed explanation.
So basically the trunk manipulation will by default let everything go through, but will change anything only if there is a better matching pattern.

Therefore, in my case, not to have to repeat the patterns, it is better to prepend the tech prefix at the outbound route, for every route.

Than you for your help with this. It made it clear.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.