Otro cambios
Cambiar Trigger de queue_log para poder computar las llamadas que estan en descanso para el perfil del agente.
delimiter //
CREATE DEFINER=`ccuser`@`%` TRIGGER `ccdata`.`tg_queue_log_repo_loginfix` BEFORE INSERT ON ccdata.queue_log FOR EACH ROW
BEGIN
DECLARE LASTEVENT varchar(20);
DECLARE LASTDATE datetime;
DECLARE LOGOFFTIME INT;
DECLARE LASTEVENTPAUSE varchar(20);
select event into @LASTEVENTPAUSE from queue_log where agent = new.agent and queuename= NEW.queuename and event in ('PAUSE', 'UNPAUSE') ORDER BY id DESC LIMIT 1;
IF (@LASTEVENTPAUSE = 'PAUSE')THEN
IF(new.event = 'OUTCALL')then
SET new.data = 'BREAK';
END IF;
END IF;
IF (new.event = 'AGENTLOGIN') THEN
SET LASTEVENT = '';
SET LASTDATE = '';
SET LOGOFFTIME = '';
select event, datetime INTO @LASTEVENT,@LASTDATE from ccrepo.queue_log_repo where agent = new.agent and event in ('AGENTLOGIN','AGENTLOGOFF') and `datetime` > DATE_SUB(NOW(), INTERVAL 10 hour)order by `datetime` desc limit 1;
IF (@LASTEVENT = 'AGENTLOGIN') THEN
SET @LOGOFFTIME := TIME_TO_SEC(NOW())- TIME_TO_SEC(@LASTDATE)-1;
insert into ccrepo.queue_log_repo (`datetime`,`callid`,`queuename`, `agent`, `event`, `data`, `data1`, `data2`, `data3`, `data4`, `data5`)
values (NOW()-1,'NONE', 'NONE', new.agent,'AGENTLOGOFF','', @LOGOFFTIME, @LOGOFFTIME,'','','BYTGR');
END IF;
END IF;
END;//
Columna de Campañas Nueva
ALTER TABLE `ccdata`.`queues`
ADD COLUMN `dialstring` VARCHAR(100) NULL AFTER `quality`;
Nuevos indices
ALTER TABLE `ccrepo`.`cdr_repo`
ADD INDEX `inx_contact` (`contact` ASC),
ADD INDEX `inx_contactq` (`contact` ASC, `campaign` ASC);