Where is the best place to perform dynamic number substitution?


I have a piece of PHP that will lookup an alternative number for the dialed number when the number begins 0870 (charged at a special rate). The PHP hits a website with the 0870 number dialed and may or may not return an alternative number.

The problem I have is where should I call this code? Right now, I have a route setup for 0870 numbers to go over my fixed line:

exten => _087.,1,Macro(dialout-trunk,7,${EXTEN},)

I originally put the code in fixlocalprefix as this seemed the least intrusive but the same trunk is retained - basically I want the whole number to be re-evaluated as if I had dialed it from an extension.

Hope this makes some sense and TIA.


why not try a custom trunk, in the dialstring you would put something like: “Local/[email protected]” and then you design my-0870-context to do what ever it needs to do with your number transformation which can then result in either a new number being generated and sent back down the normal outbound routes or it could handle the call directly, which ever makes sense.

Philippe Lindheimer - FreePBX Project Lead
http//freepbx.org - IRC #freepbx

I have much to learn :slight_smile: - thanks Philippe.