How to run HTTP request on call to extension using FreePBX

This post is based on our previous post How to add custom action on call to custom extension in FreePBX

In FreePBX, add the following config to /etc/asterisk/extensions_custom.conf in order to add a custom extension 999 that uses System() to run curlon a fixed URL.

[from-internal-additional-custom]
exten => 999,1,Answer()
exten => 999,n,Wait(1)
exten => 999,n,System(curl http://mydomain.com/myurl)
exten => 999,n,Wait(1)
exten => 999,n,Hangup()

Don’t forget to reload Asterisk e.g. using the core reload command from the Administrator menu => Asterisk CLI in order for the changes to take effect.

For details on how [from-internal-additional-custom] works, see our previous post How to add action on call to custom extension in FreePBX