Need a script which will monitor db changes
When it detect changes, issues some commands from shell and parse a log file.
You will be working with 2 tables from 2 differnt db
every X times trunks_trunk.in_dial changes from 1 to 0 or 0 to 1 (X is a variable defined on top of script)
asterisk -rx "dongle ussd [[url removed, login to view]] [carrier.ussd_balance]
asterisk -rx "dongle show devices"
In result you will get name and IMSI
mark IMSI in [url removed, login to view] for matching [url removed, login to view]
for values based on db ie
if carrier.balance_string is
and you find in log
USB715: Saldo Principal [url removed, login to view];Mensajes 20;
mark trunks_trunk.balance=[url removed, login to view] where name = USB715
keep track of where u last parsed log so u dont parse that part again
log file has datetime stamped for every line