QUESTION How to run script on incoming call

Joined
Jul 28, 2011
Messages
162
Reaction score
48
I want to create a web page for the family that shows sort of a daily status. One of the things I want to include is the calls that have come in for the day. In order to do this, I need to have PiaF run a script when a call comes in.

Some googling says to put something like this in extensions.conf
Code:
exten => 200,2,System(/usr/local/bin/MyScript "'${CALLERID}'")

Sounds easy enough, but when I look at extensions.conf and it's brethren, I get lost pretty quickly. The complexity brings back horrors of maintaining sendmail.cf files combined with the misery of writing FORTH code (I guess I'm dating myself here. For you young'uns - google them). Furthermore, it looks like FreePBX wants to own all of these.

Anyway, from what I get from google so far, it looks like I need to make a custom context and a custom destination. Is there any sort of a guide on doing this?

If it makes things easier, my incoming trunks go to a ring group, so I could create a new extension that triggers the script and add the extension to the ring group.

Or, would I be better off trying to hook into CallerID Superfecta? I could create a dummy caller ID web service on my web server, add it as a source, and use it to log calls.
 

rossiv

Guru
Joined
Oct 26, 2008
Messages
2,624
Reaction score
139
Hooking into Superfecta is an idea. Though don't forget that Asterisk/FreePBX already saves all call information into a database that can be pulled up through the FreePBX interface.
 
Joined
Jul 28, 2011
Messages
162
Reaction score
48
Hooking into Superfecta is an idea. Though don't forget that Asterisk/FreePBX already saves all call information into a database that can be pulled up through the FreePBX interface.


Any documentation on how to get to it?
 

rossiv

Guru
Joined
Oct 26, 2008
Messages
2,624
Reaction score
139
It's just a MySQL database. You can access it through PHP or any number of other methods. It's viewable through FreePBX > Reports > CDR Reports -or- through PHPMyAdmin at FreePBX > Other > PHPMyAdmin > asteriskcdrdb > cdr
 
Joined
Jul 28, 2011
Messages
162
Reaction score
48
If I was doing this, I would query the CDR. There is a thread here that discusses queries for various situations.


Cool! Now all I need to do is figure out how allow remote queries against mysql running on the piaf box.
 

Boolah

Guru
Joined
Nov 16, 2007
Messages
331
Reaction score
20
Another thing to consider if your web server is remote from your PBX, is to setup master-slave replication of the cdr MySQL table to a MySQL server running on your remote web server. Then you only need to allow replication between the two MySQL servers through your firewall and you will have real-time data available to your web server without additionally taxing your PBX.
 

Members online

Forum statistics

Threads
25,825
Messages
167,850
Members
19,250
Latest member
mark-curtis
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top