Extension Rerouting

Hi,
I was trying to make it so that if I dialed 1001 from extension 21000, it would actually dial extension 21001.

I thought that I could put it in the outbound rules under the dial plan and then match which from CallerID 21XXX on the pattern of 1XXX then I would put a 2 in the prepend field so it would actually dial 21001.

It sounded good until I realized that it doesn’t hit the outbound rules when dialing an internal extension.

Does anyone know how to do this? custom config?

One of the custom-* or misc-* modules should allow you to do this. Basically, you set up 21000 and point it at a custom dialplan that does the “math” to dial the original extension plus the prefix.

Any idea on how to do this? I can’t find anything that works.

Perhaps if you explained what exactly 1001, 21000 and 21001 currently are and what exactly you are trying to achieve?

Just trying to simplify extensions and have flexibility on scale on a single server.

Dial 1001, get extension 21001.

Basically, based on where the call is coming from, it would rewrite the actual number being called. I’m looking for the outbound rules and functionality, but with internal extensions. In outbound rules you can get where the call is coming from from CID, and you can strip/prepend digits based on the dial plan.

Create a Custom trunk with a Custom Dial String of
Local/$OUTNUM$@from-internal

Set up your Outbound Route as you had originally done, with Route Type of Intra-Company and pointing to your new custom trunk. Make sure that you don’t have a higher priority route that matches 1XXX.

I was excited to get this to work… I created the trunk as you said. I also created the outbound route with intra-company route listed. I even did a simple pattern of a static number, but the /var/log/asterisk/full never catches the pattern and runs the route… I searched for “_ROUTENAME” and it doesn’t come up.

Paste the log at https://pastebin.freepbx.org and post the link here, along with screenshots of your route setup.

I tried both “Local/@OUTNUM$@from-internal” and “Local/$OUTNUM$@from-internal” for the Custom Dial String.

I tried a very simple route match just to see if _ROUTENAME showed up, but it did not.

Please paste the log.

let me redo it just to make sure.

https://pastebin.freepbx.org/view/becc16a7

oh crap… it made the route… let me test now.

I dialed 8002, hoping it would change to 2002 from extension 2003

https://pastebin.freepbx.org/view/e8e63d3b

The Outbound Route matches on prefix + match pattern and (if it matches) calls prepend + match pattern. So for this test, the match pattern should be XXX

1 Like

oooooohhhh…ok that helps… Stewart, you are awesome. This gives me some hope for testing!

I’m a little confused. The match pattern should be XXX ??

If I had dialed 8002 or 9002, what would the pattern be? Still XXX for both, or how would I only match 9002 and not 8002?

I think I got it… ok ok … cool.

the first line matches 1XX numbers and dials 20XX numbers coming from extensions 2003-2203.

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