Anybody has an idea, how to sync “sip show peers” with a table in MYSQL.
I already have a script made to write from result of “sip show peers” to MYSQL table (peer, IP address…).
But how can I know if an admin deletes peer from FreePBX. How can I get this information to update the MySQL table, that the peer is deleted?
Right now I use “Truncate table…” (delete the table) before I make an “insert into…”. But it is not a good solution. Instead of “Truncate” I would like to check if there is any changes in peers …
Monitoring system. Right now it will be made as an external app, but when all is done it will be FreePBX module.
I check all SIP users on the system (extension number, IP, port which is registered on, useragent, registration status) via parsing of “sip show peers” and “sip show peer XXX”. And check their availability every 2 minutes (or some other time frame) via ping and via checking if the registration port is open (I did a similar system for Aastra SIP phones).
The main core of the app is made (colecting the data and writing it to Mysql table), now I’m stuck at syncing the SIP users - if a SIP user is deleted from FreePBX, how can I delete it from my Mysql table?
One solution would be, that when i check my extension (one by one) from my MySQL table, and the compare them to “sip show peers”, or “sip show peer XXX” and delete the one which is not there. But I don’t think this is a good solution for a system with a lot of extensions (too many queries…). It has to be more optimal way to do it.
I have a table, which is populated with Asterisk peers (I use command sip show peers, and extract the peers to put it in the table). This script is run every 10 minutes.
The problem I have -> when I delete an extension in FreePBX, I don’t know how to check it - to see if it was deleted. Therefore I have the deleted extension still in my table.
Is it possible to compare the array which I get from “sip show peers” to the table, and see if there is any differences?
I probably shouldn’t put this question here - it would be more appropriate to ask this question to some PHP forum…