$chat = erLhcoreClassModelChat::fetch($Params['user_parameters']['chat_id']); if ($chat->hash == $Params['user_parameters']['hash']) { // Main unasnwered chats callback if ($chat->na_cb_executed == 0 && $chat->status == erLhcoreClassModelChat::STATUS_PENDING_CHAT && erLhcoreClassModelChatConfig::fetch('run_unaswered_chat_workflow')->current_value > 0) { $delay = time() - erLhcoreClassModelChatConfig::fetch('run_unaswered_chat_workflow')->current_value * 60; if ($chat->time < $delay) { erLhcoreClassChatWorkflow::unansweredChatWorkflow($chat); } } if ($chat->nc_cb_executed == 0 && $chat->status == erLhcoreClassModelChat::STATUS_PENDING_CHAT) { $department = $chat->department; if ($department !== false) { $options = $department->inform_options_array; $delay = time() - $department->inform_delay; if ($chat->time < $delay) { erLhcoreClassChatWorkflow::newChatInformWorkflow(array('department' => $department, 'options' => $options), $chat); } } else { $chat->nc_cb_executed = 1; $chat->updateThis(); } } $contactRedirected = false; if ($chat->status == erLhcoreClassModelChat::STATUS_PENDING_CHAT) { $department = $chat->department; if ($department !== false) { $delay = time() - $department->delay_lm; if ($department->delay_lm > 0 && $chat->time < $delay) { $baseURL = isset($Params['user_parameters_unordered']['mode']) && $Params['user_parameters_unordered']['mode'] == 'widget' ? erLhcoreClassDesign::baseurl('chat/chatwidget') : erLhcoreClassDesign::baseurl('chat/startchat'); $ru = $baseURL . '/(department)/' . $department->id . '/(offline)/true/(leaveamessage)/true/(chatprefill)/' . $chat->id . '_' . $chat->hash; $msg = new erLhcoreClassModelmsg();