public static function sendChatMessage($fromjid, $tojid, $message, $container) { try { if (is_array($tojid)) { $tojid = implode(",", $tojid); } $ec = new \Justsy\OpenAPIBundle\Controller\ApiController(); $ec->setContainer($container); $s = $ec->sendChat($fromjid, $tojid, $message); $jo = json_decode($s); if ($jo && $jo->{'returncode'} == "0000") { return true; } else { return false; } } catch (\Exception $e) { $container->get('logger')->err($e); return false; } }