There are two tables
cdr is a local table on the FEDERATED engine, that is, it receives data from a remote server from a similar table in structure. It stores a lot of information about calls to the PBX, but you need to pull out certain numbers and put them in a separate table.
In MySQL Workbench, in the table editing section, I add a trigger.
CREATE DEFINER=`root`@`localhost` TRIGGER dials_insert AFTER INSERT ON calllist.cdr FOR EACH ROW BEGIN INSERT INTO calllist.dials (dials.CID, dials.calldate) SELECT src, calldate FROM calllist.cdr WHERE calldate = (SELECT MAX(calldate) FROM calllist.cdr); END
After making a call, a record appears in the cdr, the record is not added to dials, however, if the script body is executed in the Workbench environment as a script, the dials record will be recorded, the code will be working.
Server 5.7.11