Hello everyone, I’m new to the world of FreePBX and was looking for guidence. I have a fresh FreePBX 13 install on a machine, and would like to add custom scripts. I have the scripts already made. One will take the caller ID and the Call ID and use it to find data in a seperate API, then insert it all into a MySQL database. The second one will happen when a user answers the phone. It will accept the call ID and the user’s extension and update the entry in the MySQL database where Call ID is the same. My problem is that I have no idea where to start with FreePBX to actually make the rules that will run the first script when a new call comes in and make the second script run when a user picks up the phone.
Any help/guidance would help me greatly. As I’ve stated, I’m completely new to FreePBX, so I apologize for any misunderstanding.
James sent me this link:
It talks to using ARI to communicate with your Asterisk implementation. It’s going to be intimidating (this is DEEP magic) but I think you might find some interesting ideas in terms of getting your code to work.
Thank you. I’ll definitely watch through this.
So I watched that video and while it was informative, but he was talking about an application that will actively communicate with Aterisks. All I need is the caller ID, the call ID, and the ext of the user picking up. I don’t need to send anything to Asterisks, I just need to post/GET data from asterisks to my PHP scripts. Is that possible?
Yeah - that’s part of the appeal of ARI - it’s the easiest way I’ve seen to get that kind of information into a programming environment.
I wrote a system that does what you are describing a long time ago using an interface to the Asterisk CLI. That sucked. With the ARI interface, you get all of the event driven activities you could want and get them in a programming interface where you don’t have to write regular expression parsers.
If you wanted to control Asterisk, I’d have recommended the Asterisk AGI. Since you aren’t trying to interface with the dialplans (you aren’t trying to insinuate your processing into the dial structure), the ARI interface seems like a good fit.
Of course, I could be wrong - I haven’t actually done anything with the ARI interface in the couple of weeks I’ve had it on the front of my brain, but it sure seems like the right way to go.
Do you have any links to resources where I can learn more about the ARI Interface?
I googled PHPARI Module and got a couple of good hits. There is (as I recall) a good Wiki page on the Asterisk.org website that describes the interface.
That’s about the best I can do for you today. Didn’t the video have a couple of links in it?
Not that I remember, but I could have missed those. Thanks for your links.
So I think that using PHPARI is what I need to do, but I’m having trouble starting. The documentation says to modify the configuration file found in this directory, “/etc/asterisk/http.conf”, but I have no idea where that directory resides within the FreePBX system. Where can I locate it?
Try one of these:
find / -name httpd.conf
find / -name ‘http*conf’
Always remember that the documentation for some of these things remains the same even if the underlying technology changes. You might need to ‘adjust’ the specifics of the recommended change to match up with the way that FreePBX manages and installs Apache. For example, the Apache server that works with FreePBX (or the updates to FreePBX) might use newer semantics.
Where would I type that in? As I said, I’m new to FreePBX and asterisks, so this is all new and exciting territory.
Those are Unix commands. Log into the server as “root” using the terminal screen (or ssh in from another machine in your network) and type that command.
Thanks! So I found where the file is, but how do I access it to modify it? I can’t find it using Filezila, and
ls doesn’t list an “etc” folder for me to drill down into.
Yeah - filezilla is not going to get you where you want to go.
You are going to have to dig in and get familiar with Unix Command Line. You need to edit the files (probably using ‘vi’) and are going to have to be able to navigate within the directory structure. If you can’t (or won’t) get to this level of access in the system, you should probably hire someone to maintain your system for you, since this level of management and modification requires some experience.
Welcome to “Not Windows”.
Thanks, as you can obviously tell, I’m not a unix user. I’m currently trying to implement a new user portal onto the existing FreePBX and asterisk setup. I currently just have a test FreePBX server to paly with and get my feet wet. I don’t think that I’ll be using FreePBX after this project. I appreciate your help.
Looking at PHPARI, it looks like I’ll have to listen for new stasis events. Is there a list of these events that I can view so I know which ones to listen for for a new call, and for a when a tech picks up the phone and answers the call?
I thought for a long time that, since Linus cut his teeth on Minix, that he decided to call his Senior project “Linux” (Linus meets Unix). Because of that, for the first 20 years or so, I called it “Linix” (and not “LeenUx” as Linus pronounces it). I remember when it showed up on the 386BSD discussion mailing lists at the end of the '80s and all of the hullabaloo that was associated with it. We were all under cease-and-desist orders from AT&T and were looking for something to use. It was only interesting then. Fast forward almost 30 years - Linux is STILL not Unix…
What brand of phone are you using?
The Snom and Yealink phones have Action URL settings you can use.
We had it set up years ago for monitoring who was on a call or on DND.
We put a value into the Action URL in the DND On & Off fields that would send the extension number of the phone to a PHP page which would then send it to the MySQL database.
Then we had a .NET program to monitor the database and would highlight if a phone was put on DND.
Another option is do SQL queries to query the CDR table on the MySQL database built into FreePBX.
I have a simple .NET application that queries have many calls each extension has answered or made calls within a department, so the manager can monitor them. Saves giving them access to the entire CDR gui.
We’re using Aastra phones. to my knowledge, they don’t have a feature like that.
I used Aastra handsets a few years ago and they do have the ability to do this