Call Forwarding for Specific Inbound Routes

Hi All -

Been looking and although I am finding pieces of information, I cant find all the information on the forums.

I want to be able to call forward certain/specific DID/Incoming Routes at will.

I have 10 DIDs and I was looking to set up the 11th DID to go to a custom destination. The parameters are:

  • look at the calling party caller ID to make sure this person should have access to it.
  • enter a pin code for authentication
  • it will prompt for the DID to forward.
  • confirms if the DID to forward is under the calling party’s caller ID group of acceptable DIDs to forward
  • prompt for destination
  • press 1 to accept.

The part I cannot figure out is how to change the routing.

Is it done in the flat file /etc/asterisk/extensions_additional.conf or is it in the DB somewhere?.

I tried updating the destination in the mysql table incoming but it didnt take affect.

I can create a system command to sed the .conf file and reload the system but was wondering if there was a more elegant solution.

I would assume once the solution is figured out, it would be the same for the misc destination ring to updates where I modify the flat file or DB.


You can do most of what you want without writing code.

Basic structure: Each of the 10 DIDs has an Inbound Route pointing to a corresponding Virtual Extension. Each Virtual Extension has Call Forwarding Unconditional set, pointing to the desired destination.

The feature code Call Forward All Prompting Activate (default *93) allows you to specify the extension to forward and the corresponding destination.

You could set up a Custom Destination that executes *93 and set the Inbound Route for the 11th DID (and proper CID) to point there.

With a loopback trunk and PIN Sets, you could add authentication. I don’t see a code-free way to allow specific caller IDs to modify only some of the destinations, though the Virtual Extension numbers could be ‘secret’ and told to only those authorized.

If you do need to write custom dial plan code, put it in extensions_custom.conf and point your Custom Destination there. You can use the code for *93 as a guide for what is required.

extensions_additional.conf should not be modified, as it is rewritten by FreePBX whenever an Apply Config is done.

You can do most of this with the dynamic routes module. Use it to check Cid, challenge for a pin, get forwarding dest and then set an astdb value. Use a custom dest to send callers to the astdb value.

1 Like

going to have to look more into dynamic routes. Found your old wiki page too. I’ll step through it and see how far I can get into it.

However, I still think I may run into the issue of not know which db values to update to change the routing of the inbound call

Might take a hybrid approach with Stewart’s and dialplan building unless I can find more examples and explanations in the forums for dynamic routes

My thinking was to just create one and use that in a custom destination.

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