public static function mainUnansweredChatWorkflow()
{
$output = '';
if (erLhcoreClassModelChatConfig::fetch('run_unaswered_chat_workflow')->current_value > 0) {
$output .= "Starting unaswered chats workflow\n";
$delay = time() - erLhcoreClassModelChatConfig::fetch('run_unaswered_chat_workflow')->current_valu * 60;
foreach (erLhcoreClassChat::getList(array('limit' => 500, 'filterlt' => array('time' => $delay), 'filter' => array('status' => erLhcoreClassModelChat::STATUS_PENDING_CHAT, 'na_cb_executed' => 0))) as $chat) {
erLhcoreClassChatWorkflow::unansweredChatWorkflow($chat);
$output .= "executing unanswered callback for chat - " . $chat->id . "\n";
}
$output .= "Ended unaswered chats workflow\n";
}
return $output;
}