|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
* MikoPBX - free phone system for small business |
|
4
|
|
|
* Copyright © 2017-2021 Alexey Portnov and Nikolay Beketov |
|
5
|
|
|
* |
|
6
|
|
|
* This program is free software: you can redistribute it and/or modify |
|
7
|
|
|
* it under the terms of the GNU General Public License as published by |
|
8
|
|
|
* the Free Software Foundation; either version 3 of the License, or |
|
9
|
|
|
* (at your option) any later version. |
|
10
|
|
|
* |
|
11
|
|
|
* This program is distributed in the hope that it will be useful, |
|
12
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14
|
|
|
* GNU General Public License for more details. |
|
15
|
|
|
* |
|
16
|
|
|
* You should have received a copy of the GNU General Public License along with this program. |
|
17
|
|
|
* If not, see <https://www.gnu.org/licenses/>. |
|
18
|
|
|
*/ |
|
19
|
|
|
|
|
20
|
|
|
namespace MikoPBX\Core\Workers\Libs\WorkerCallEvents; |
|
21
|
|
|
|
|
22
|
|
|
|
|
23
|
|
|
use MikoPBX\Common\Models\CallDetailRecordsTmp; |
|
24
|
|
|
use MikoPBX\Core\System\Util; |
|
25
|
|
|
use MikoPBX\Core\Workers\WorkerCallEvents; |
|
26
|
|
|
|
|
27
|
|
|
class ActionQueueAnswer |
|
28
|
|
|
{ |
|
29
|
|
|
public static function execute(WorkerCallEvents $worker, $data): void |
|
30
|
|
|
{ |
|
31
|
|
|
$filter = [ |
|
32
|
|
|
'UNIQUEID=:UNIQUEID: AND answer = ""', |
|
33
|
|
|
'bind' => [ |
|
34
|
|
|
'UNIQUEID' => $data['id'], |
|
35
|
|
|
], |
|
36
|
|
|
]; |
|
37
|
|
|
/** @var CallDetailRecordsTmp $m_data */ |
|
38
|
|
|
/** @var CallDetailRecordsTmp $row */ |
|
39
|
|
|
$m_data = CallDetailRecordsTmp::find($filter); |
|
40
|
|
|
foreach ($m_data as $row) { |
|
41
|
|
|
$row->writeAttribute('answer', $data['answer']); |
|
42
|
|
|
$row->writeAttribute('endtime', $data['answer']); |
|
43
|
|
|
$res = $row->save(); |
|
44
|
|
|
if ( ! $res) { |
|
45
|
|
|
Util::sysLogMsg('Action_queue_answer', implode(' ', $row->getMessages()), LOG_DEBUG); |
|
46
|
|
|
} |
|
47
|
|
|
} |
|
48
|
|
|
} |
|
49
|
|
|
} |