function _gs_send_event($data) { $command = ''; foreach ($data as $line) { if (strlen($line['parm']) > 0) { $command = $command . $line['parm'] . ': '; $command = $command . $line['value'] . "\r\n"; } } $command = $command . "\r\n"; $ami = new AMI(); $ami->ami_login('uevg', 'eSd58', '127.0.0.1', 5038); $res = $ami->ami_send_command($command); $ami->ami_logout(); }
$agent = $DB->executeGetOne('SELECT `name` FROM `ast_sipfriends` WHERE `_user_id`=' . $user['id']); $interface = 'SIP/' . $agent; $queue_ids = array_intersect($queue_ids, $queues_allowed); $rs = $DB->execute('SELECT `queue_name`, `_queue_id` FROM `ast_queue_members` WHERE `_user_id`=' . $user['id'] . ' AND `static`= 0 AND `_queue_id` IN (' . implode(",", $queue_ids) . ')'); while ($queue_map = $rs->fetchRow()) { $agent_on = $DB->executeGetOne('SELECT count(`_queue_id`) FROM `ast_queue_members` WHERE `_queue_id` =' . (int) $queue_map['_queue_id']); $min_agent = $DB->executeGetOne('SELECT `_min_agents` FROM `ast_queues` WHERE `_id`=' . (int) $queue_map['_queue_id']); if ($agent_on > $min_agent) { $DB->execute('DELETE from `ast_queue_members` WHERE `_user_id`=' . $user['id'] . ' AND `static`= 0 AND `_queue_id`=' . (int) $queue_map['_queue_id']); $ami->ami_send_command('Action: Queuelog' . "\n" . 'Queue: ' . $queue_map['queue_name'] . "\n" . 'Interface: ' . $agent . "\n" . 'Event: AGENTLOGOFF' . "\r\n\r\n"); } } } $clir = gs_clir_get($_SESSION['sudo_user']['name']); if (isGsError($clir)) { echo __('Fehler beim Abfragen.'), '<br />', $clir->getMsg(); die; } $callwaiting = gs_callwaiting_get($_SESSION['sudo_user']['name']); if (isGsError($callwaiting)) { echo __('Fehler beim Abfragen.'), '<br />', $callwaiting->getMsg(); die; } ?>