diff --git a/incoming.php b/incoming.php index dcba931..cb5f793 100755 --- a/incoming.php +++ b/incoming.php @@ -45,7 +45,7 @@ if (date('N') == 7 && $sundayFestive) { $scheduledQueue = $db->getValue( 'SELECT `queue` FROM pbx.schedule WHERE `weekDay` = WEEKDAY(CURDATE()) - AND CURTIME() BETWEEN timeStart AND timeEnd + AND util.VN_CURTIME() BETWEEN timeStart AND timeEnd LIMIT 1' ); @@ -55,19 +55,19 @@ if ($scheduledQueue) { exit; } -// Gets the customer from the phone number +// Gets the client from the phone number -$customer = $db->getValue('SELECT clientFromPhone(#)', [$callerId]); +$client = $db->getValue('SELECT clientFromPhone(#)', [$callerId]); -if ($customer) { - // Gets the customer salesperson extension +if ($client) { + // Gets the client salesperson extension $extension = $db->getValue( - 'SELECT s.extension - FROM sip s - JOIN vn2008.Trabajadores t ON t.user_id = s.user_id - WHERE t.id_trabajador = vn2008.Averiguar_ComercialCliente_Id(#, CURDATE())' - ,[$customer] + 'SELECT d.pbxQueue + FROM vn.worker w + JOIN vn.business b ON b.id = w.businessFk + JOIN vn.department d ON d.id = b.departmentFk + WHERE w.id = #',[$client] ); if ($extension) {