diff --git a/flexiapi/app/Device.php b/flexiapi/app/Device.php index 6cbd158..0afec12 100644 --- a/flexiapi/app/Device.php +++ b/flexiapi/app/Device.php @@ -26,9 +26,9 @@ class Device extends Model { public function fromContact(\stdClass $contact) { - $this->uuid = \substr($contact->line_value_copy, 2, -2); - $this->expires_at = Carbon::createFromTimestamp($contact->expires_at); - $this->update_time = Carbon::createFromTimestamp($contact->update_time); - $this->user_agent = $contact->user_agent; + $this->uuid = \substr($contact->{'unique-id'}, 2, -2); + $this->expires_at = Carbon::createFromTimestamp($contact->{'expires-at'}); + $this->update_time = Carbon::createFromTimestamp($contact->{'update-time'}); + $this->user_agent = $contact->{'user-agent'}; } } diff --git a/flexiapi/app/Libraries/FlexisipConnector.php b/flexiapi/app/Libraries/FlexisipConnector.php index c5798b1..f3b1d0a 100644 --- a/flexiapi/app/Libraries/FlexisipConnector.php +++ b/flexiapi/app/Libraries/FlexisipConnector.php @@ -27,8 +27,8 @@ class FlexisipConnector public function __construct() { - $pid = file_get_contents(config('app.flexisip_proxy_pid')); - $this->socket = streamsocket_client('unix:///tmp/flexisip-proxy-'.$pid, $errno, $errstr); + $pid = \file_get_contents(config('app.flexisip_proxy_pid')); + $this->socket = \stream_socket_client('unix:///tmp/flexisip-proxy-'.$pid, $errno, $errstr); } public function __destruct() @@ -43,7 +43,7 @@ class FlexisipConnector ]); $devices = collect(); - if (isset($content->contacts)) { + if ($content && isset($content->contacts)) { foreach ($content->contacts as $contact) { $device = new Device; $device->fromContact($contact); @@ -62,9 +62,10 @@ class FlexisipConnector ]); } - private function request(string $command, array $parameters) + private function request(string $command, array $parameters): ?\stdClass { fwrite($this->socket, $command.' '.\implode(' ', $parameters)); + return json_decode(fread($this->socket, 8192)); } } diff --git a/flexiapi/composer.lock b/flexiapi/composer.lock index 6b3bb71..a11eda1 100644 --- a/flexiapi/composer.lock +++ b/flexiapi/composer.lock @@ -1466,16 +1466,16 @@ }, { "name": "laravel/framework", - "version": "v8.83.25", + "version": "v8.83.26", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "b77b908a9426efa41d6286a2ef4c3adbf5398ca1" + "reference": "7411d9fa71c1b0fd73a33e225f14512b74e6c81e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/b77b908a9426efa41d6286a2ef4c3adbf5398ca1", - "reference": "b77b908a9426efa41d6286a2ef4c3adbf5398ca1", + "url": "https://api.github.com/repos/laravel/framework/zipball/7411d9fa71c1b0fd73a33e225f14512b74e6c81e", + "reference": "7411d9fa71c1b0fd73a33e225f14512b74e6c81e", "shasum": "" }, "require": { @@ -1635,7 +1635,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2022-09-30T13:00:40+00:00" + "time": "2022-11-01T14:48:50+00:00" }, { "name": "laravel/serializable-closure", diff --git a/flexiapi/composer.phar b/flexiapi/composer.phar index 6d812d6..6d799eb 100755 Binary files a/flexiapi/composer.phar and b/flexiapi/composer.phar differ diff --git a/flexiapi/resources/views/account/devices/index.blade.php b/flexiapi/resources/views/account/devices/index.blade.php index 7a14273..954bbcd 100644 --- a/flexiapi/resources/views/account/devices/index.blade.php +++ b/flexiapi/resources/views/account/devices/index.blade.php @@ -18,7 +18,7 @@ @foreach ($devices as $device)