Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Our Asterisk-based PBX (FreePBX "Tango" distro) does not require any prefix for outgoing calls. The system is able to recognise external numbers and route them appropriately.

Some of our users who are accustomed to older PBXes habitually dial a 9 'for an outside line'. This doesn't work, the system gives them an unintelligible error message and they raise a support ticket saying 'The phones are not working'.

What I would like to happen is that the users receive a recorded announcement, informing them that they need to 'hang up and redial without the prefix'. I can record the announcement, set it up as an announcement on the system, but then I run up against a brick wall. Outbound routes only let me route to trunks. How can I route misdialled numbers to my custom announcement?


  • The solution must be completely realized within the FreePBX GUI, we don;t allow direct modification of any config files.
  • A 'misdialled number' is defined as matching the dial pattern: 9[046-9]XXX.
  • The call should be routed to the selected announcement, then hang up.

Any help would be appreciated.

share|improve this question
Is there a reason not to just handle 9+whatever in your outbound routes? edit - in either your trunks or routes, you should be able to match numbers with a 9, then remove it. – lorsungcu Feb 21 '12 at 0:12
@lorsungcu - I did consider that option but without going into the details, there are a number of operational reasons why I'd prefer not to. I'm holding this in reserve as my 'plan B'. I'd rather be able to educate the user not to dial a prefix by playing an announcement. – Tim Long Feb 21 '12 at 1:18
I can't think of a reason to not just handle this for users; can you explain? – lorsungcu Feb 23 '12 at 6:14
up vote 1 down vote accepted

Alright, a different approach:

  • Create an announcement.
  • Add extension (virtual)
  • Give it a number, make it so its no answer destination is your announcement.
  • Go to trunks
  • Add custom
  • Destination: "Local/{ext}" (replace {ext} with extension number, ex: Local/1000)
  • Add an outbound route, see dial patterns below, first route (so it catches all calls), destination is the trunk you just made.
  • Dial Patterns:
  • 9xxxxxxxxxx
  • 91xxxxxxxxxx

This should provide that functionality.

Works fine on my VM PBX that I get to play with when experimenting with weird deployments like this.

You may be able to look into custom dialing the announcement directly, but I'm not sure you can do this (as far as I know, you cannot play an announcement with the dial() command).

share|improve this answer
Simpler method would be to just create an IVR, send calls matching your pattern to it. Most SIP phones allow some sort of dialplan rewrite, just rewrite it there as the extension of the IVR. You could also handle it through outbound routes, as StrangeWill suggests, and cover all your bases. – lorsungcu Feb 23 '12 at 6:13
Oh yeah, and if you're using FreePBX for configs, phone dialplan rewrites are pretty straight forward to deploy and wont nearly make people scratch their head as much as my setup probably would. – StrangeWill Feb 23 '12 at 20:45

Write a simple module that modifies the config files to replace the message played? It's all PHP so it should be fairly trivial if you have any programmers available.

share|improve this answer
Thanks for the suggestion. It's a thought, but unfortunately, I don't have programmers available. The solution needs to work with the existing FreePBX framework. If a module were available, that would be OK, but we don't have the means to make one and even if we did, it would be 'unsupported' (by FreePBX). – Tim Long Feb 21 '12 at 21:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.