|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Hsy\SimotelConnect; |
|
4
|
|
|
|
|
5
|
|
|
|
|
6
|
|
|
use Illuminate\Support\Facades\Http; |
|
|
|
|
|
|
7
|
|
|
|
|
8
|
|
|
class SimotelApi |
|
9
|
|
|
{ |
|
10
|
|
|
private $message = ""; |
|
11
|
|
|
|
|
12
|
|
|
private function call($query) |
|
13
|
|
|
{ |
|
14
|
|
|
$user = config("simotel.simotelApi.user"); |
|
|
|
|
|
|
15
|
|
|
$pass = config("simotel.simotelApi.pass"); |
|
16
|
|
|
$apiServer = config("simotel.simotelApi.apiUrl"); |
|
17
|
|
|
|
|
18
|
|
|
try { |
|
19
|
|
|
$endpoint = $apiServer . "/" . $query; |
|
20
|
|
|
$response = Http::withBasicAuth($user, $pass)->post($endpoint); |
|
21
|
|
|
$res = $response->json(); |
|
22
|
|
|
$this->message = $res["message"]; |
|
23
|
|
|
if ($res["ok"] == 1) |
|
24
|
|
|
return true; |
|
25
|
|
|
return false; |
|
26
|
|
|
|
|
27
|
|
|
} catch (\Exception $e) { |
|
28
|
|
|
$this->message = $e->getMessage(); |
|
29
|
|
|
return false; |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
public function getMessage() |
|
35
|
|
|
{ |
|
36
|
|
|
return $this->message; |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
public function addToQueue($queue, $source, $agent, $penalty = 0) |
|
40
|
|
|
{ |
|
41
|
|
|
$query = "queue/add/?queue={$queue}&source={$source}&agent={$agent}&penalty={$penalty}"; |
|
42
|
|
|
return $this->call($query); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
public function removeFromQueue($queue, $agent) |
|
46
|
|
|
{ |
|
47
|
|
|
$query = "/queue/remove/?queue={$queue}&agent={$agent}"; |
|
48
|
|
|
return $this->call($query); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
public function pauseInQueue($queue, $agent) |
|
52
|
|
|
{ |
|
53
|
|
|
$query = "/queue/pause/?queue={$queue}&agent={$agent}"; |
|
54
|
|
|
return $this->call($query); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
public function resumeInQueue($queue, $agent) |
|
58
|
|
|
{ |
|
59
|
|
|
$query = "/queue/resume/?queue={$queue}&agent={$agent}"; |
|
60
|
|
|
return $this->call($query); |
|
61
|
|
|
} |
|
62
|
|
|
} |
|
63
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths