|
|
|
@ -11,7 +11,7 @@ class WsInterface
|
|
|
|
|
function enviaMsg($msg) |
|
|
|
|
{ |
|
|
|
|
if (!empty($msg)) { |
|
|
|
|
$this->client = new Testess("ws://192.168.115.65:8080/ws"); |
|
|
|
|
$this->client = new Testess("ws://127.0.0.1:8080/ws"); |
|
|
|
|
$this->client->send($msg); |
|
|
|
|
$this->client->close(); |
|
|
|
|
return null; |
|
|
|
@ -40,4 +40,33 @@ class WsInterface
|
|
|
|
|
logger('monitora')->info($th->getMessage(), debug_backtrace()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
public function convertToWebsocket($content, $matricula = '', $uniqueid, $type, $name, $number, $data, $idProvedor, $mimetype, $file_name = null, $channel) |
|
|
|
|
{ |
|
|
|
|
if ($number) { |
|
|
|
|
$mensagem = []; |
|
|
|
|
$mensagem["event"] = [ |
|
|
|
|
"type" => "mensagem", |
|
|
|
|
"contact" => [ |
|
|
|
|
"name" => $name, |
|
|
|
|
"number" => $number, |
|
|
|
|
"matricula" => '' |
|
|
|
|
], |
|
|
|
|
"mensagem" => [ |
|
|
|
|
"type" => $type, |
|
|
|
|
"content" => $content, |
|
|
|
|
"id_provedor" => $idProvedor, |
|
|
|
|
"dst" => $matricula, |
|
|
|
|
"uniqueid" => $uniqueid, |
|
|
|
|
"media" => $channel, |
|
|
|
|
"file_name" => $file_name, |
|
|
|
|
"datetime" => $data, |
|
|
|
|
"status" => "sent", |
|
|
|
|
'mimetype' => $mimetype |
|
|
|
|
] |
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
return json_encode($mensagem); |
|
|
|
|
} |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
} |