Problem with POTS callerid application

We currently have a POTS callerid box connected to a linux network via MYSQL.
This system displays realtime customer sales data to client applications running on users desktops.
I wrote the POTS callerid application, and now are moving towards a SIPS/ASTERISK system.

I have a PBX in a FlaSH /Asterisks system running with a single googlevoice number for a test system.
Is there a simple way to update a single mysql table/row whenever a call arrives/is answered / closed, with the originating number?

I guess what I really need is help to where to capture the incoming number, and how to open and update a mysql database using asterisk tools.

Should I abandon PBX in a FLASH and FREEPBX? I’m thinking this shouldn’t be too difficult.

Thank you,


The callerid is contained in a dialplan function: … n_CALLERID