Is there a place to add a macro to freepbx

I have a macro that requires an argument, is there anyway I can call this using a feature in freepbx?

I tried using the dial command from a custom device, but it expects a technology and device, and I am trying to use a centrex transfer macro that looks like this:

exten => s,1,Playback(transfer)
exten => s,2,Flash
exten => s,3,SendDTMF(9w${ARG1})
exten => s,4,Hangup

so I was hoping I could build extensions in the freepbx gui that will call the macro with an argument (the number to transfer to), like so:

exten => s,1,Macro(cent_trnsfr,${17143984325})

This way anyone managing the system can build custom transfers in freepbx, without getting into the config files - is this possible?


I can’t directly answer everything but here is what I can.

You add dial plan additions to the extensions_custom.conf file.

I’m no expert on macros but have you googled for help on asterisk macros to get a understanding of them. There is also a book that will help you understand asterisk and how it works:
Asterisk: The Future of Telephony 2nd Edition (ISBN 0-596-51048-9)
Order yours at
Free downloadable PDF

yes - i know about the file structure, so my macro is in extensions_custom.conf, but there are many numbers that will reference that macro, all one liners, and they will change from time to time.

I dont want to be responsible for maintaining this, but I dont want the client digging around in the conf files - how can i reference this macro from freepbx?

Could I do some sort of goto, or other custom dial that could be referenced from a custom extension or custom device?

Won’t the custom destinations do exactly what you are looking for?

If the code applies to incoming calls you change the context to your custom code in the trunk or Zap channel. Conversely you could also have internal calls originate in your context by changing the extensions context.

Hey Scott- that is what I have been using, except it still requires interaction in the config files by building the custom extension code - which is what i want to avoid.

Custom destinations does not build any code, it only makes a reference in freepbx to code that you have built.

I need to actually create a line of code that does this:
exten => s,1,Macro(cent_trnsfr,${17143984325})

So at this point it would seem I cannot create that from the gui, i can only reference it from the gui (as long as it exists in my custom conf file).

I also tried a module called “Dial Plan Injection”, it would sound like what I want, but it seems to just do the same as the custom extensions modules.

Why is it an issue to edit the file? Maybe that data will help us understand what you are trying to accomplish.

  1. I dont want end users editing config files
  2. I dont want to be responsible for ongoing maintenance of that code

The code may change every 2-3 weeks as centrex transfer numbers are added to the system, I and the customer dont want to wait for me to add the code in to the config files, if it was possible in the gui, I would feel safer giving them some simple instructions to add said code in the gui. I guess Config Edit will need to suffice for the moment, until someone writes a true custom code module.

I understand what you are trying to do. I can’t think of a way to do this within FreePBX.

You could include another file in extensions_custom.conf and put together a simple module to append the extension to the end of the file.

You could also write a bit of dialplan code that would allow an administrator to dial an extension and enter the Centrex number. The extension would then append to your config file.

thats kind of what I have done, I just made another file and set an include in extensions_custom.conf that way hopefully they wont mess with anything else.