Run external program after dialing special extension?

Using FreePBX here and I was wondering if I could run an arbitrary shell script when I press a certain extension. I had a vanilla version of asterisk years ago where I did this but I’m not sure how I’d do it with FreePBX.

Thanks!

If you are familiar with vanilla Asterisk, you can do pretty much the same with FreePBX by editing the file /etc/asterisk/extensions_custom.conf with your own context, then in the GUI, go to Admin, Custom Destination so you can reference your custom dialplan from the GUI.

Thanks! That second part was what I didn’t know about.

1 Like

I found this tutorial that had another step and it almost works. I do see in asterisk when I dial the special extension that it tries to run the program:

Executing [s@run-program:1] System("SIP/503-00000005", "/home/asterisk/test.sh") in new stack

It fails to run and there are no errors I can see. The program test.sh simply makes an empty file and it works on the command line just fine. It’s executable, asterisk is the owner and group and has permissions to run it. Any idea why it wont run?

Turns out it was working but I have to always give full directories so the command

touch testing123

should have been

touch /home/asterisk/testing123