Trigger PHP from incoming call - how?

I would like to be able to trigger a custom php script when an incoming call comes in. I would need to pass the call number and the number the call was coming from into the php script. Then, based on what was sent in, we will need to do some custom processing.

Is there any information on how to do this or does anyone have experience with doing so? I think what would be easiest is to have one php file that is triggered by all incoming calls. Then, the processing would handle what gets done based on which call number was sent and which was requested.

I looked at some Asterisk AGI php information. But, it looks way more complicated than what I need. Also, I was wondering if there is a way to set it up using FreePBX.

If anyone has any ideas on how to proceed, I would really appreciate it.


If you know PHP the easiest way is probably with a superfecta source (assuming you are not trying to affect call routing)

some simple examples

Sends Caller ID to Yo

Sends an email

Those look very promising! I don’t know much about the superfecta module. Is that something I need to add to FreePBX? Also, is there a way to install a .module file and have it fired each time a call is made/comes into the server?


Superfecta is an inbound thing that processes the received callerid. You can copy either of the above and change it to call whatever then drop it in to the sources folder. Superfecta is installed by default but any source not contributed back will be lost on update so that is something to keep in mind.

If you want to hook in to the dialplan and get fancy like processing calls inbound and outbound you will want to use AGI probably and make a proper FreePBX module.

There is also the Send_to_URL module for superfecta.

Does anything/everything in the Superfecta source folder get launched when a call comes in or do I need to explicitly do something to have it recognized and used? Also, where should I look for the Superfecta folder that contains the source folder?

No. You must configure Superfecta with schemes and select which sources you want to run.


Ok. I understand a little better.

I created a new scheme, enabled the Send to URL module, entered the url that we need the CLID and number to go to, and made sure it is “on” with the little icon.

However it isn’t yet sending to the new url. When doing a Debug/Test Run Scheme, it also doesn’t send to the new url.

I’m definitely still missing something. When I created a new scheme and enabled Send_to_URL, it is not triggered when a call is made and it is not triggered when clicking Debug/Test Run Scheme. I enabled Send_To _URL on the already existing “Default” scheme and it is indeed triggered when clicking Debug/Test Run Scheme, but it is not triggered when a real call is made.

Is there a way to make an incoming route that allows all calls to continue to their original destination but also trigger a specific superfecta scheme to run? It appears that a route’s “Set Destination” does not allow for something like “original destination”.

I’m thinking that this is the way to get a scheme to fire upon all incoming calls.

Hi ,

I have exactly the same problem with “send to url” .
I would like to trigger a php-page with superfecta. I configured send to url module to trigger it but it doesn t hit the url even with the debug / test run button.

Do you figure out this problem ?
Anyone has got an idea ?


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