Skip to content

Commit

Permalink
#818 Поправил определение статусов телефонов
Browse files Browse the repository at this point in the history
  • Loading branch information
boffart committed Nov 7, 2024
1 parent 8be088f commit 8f3f67f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Core/Asterisk/AsteriskManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -1399,13 +1399,15 @@ public function getPjSipPeers(): array
$peers = [];
$result = $this->sendRequestTimeout('PJSIPShowEndpoints');
$endpoints = $result['data']['EndpointList'] ?? [];
print_r($endpoints);
foreach ($endpoints as $peer) {
if ($peer['ObjectName'] === 'anonymous') {
continue;
}
$state_array = [
'Not in use' => 'OK',
'Busy' => 'OK',
'Ringing' => 'OK'
];
$state = $state_array[$peer['DeviceState']] ?? 'UNKNOWN';
$oldAState = $peers[$peer['Auths']]['state'] ?? '';
Expand All @@ -1415,8 +1417,9 @@ public function getPjSipPeers(): array
}

$peers[$peer['Auths']] = [
'id' => $peer['Auths'],
'state' => strtoupper($state)
'id' => $peer['Auths'],
'state' => strtoupper($state),
'detailed-state' => $peer['DeviceState']
];
}
return array_values($peers);
Expand Down

0 comments on commit 8f3f67f

Please sign in to comment.