1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* Copyright 2014 Brian Smith <[email protected]>. |
5
|
|
|
* |
6
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
7
|
|
|
* you may not use this file except in compliance with the License. |
8
|
|
|
* You may obtain a copy of the License at |
9
|
|
|
* |
10
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
11
|
|
|
* |
12
|
|
|
* Unless required by applicable law or agreed to in writing, software |
13
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
14
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
15
|
|
|
* See the License for the specific language governing permissions and |
16
|
|
|
* limitations under the License. |
17
|
|
|
*/ |
18
|
|
|
|
19
|
|
|
namespace phparia\Events; |
20
|
|
|
|
21
|
|
|
use phparia\Client\AriClient; |
22
|
|
|
use phparia\Resources\Channel; |
23
|
|
|
use phparia\Resources\Bridge; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Notification that a blind transfer has occurred. |
27
|
|
|
* |
28
|
|
|
* @author Brian Smith <[email protected]> |
29
|
|
|
*/ |
30
|
|
|
class BridgeBlindTransfer extends Event implements IdentifiableEventInterface |
31
|
|
|
{ |
32
|
|
|
/** |
33
|
|
|
* @var Bridge (optional) - The bridge being transferred |
34
|
|
|
*/ |
35
|
|
|
private $bridge; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @var Channel The channel performing the blind transfer |
39
|
|
|
*/ |
40
|
|
|
private $channel; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @var string The context transferred to |
44
|
|
|
*/ |
45
|
|
|
private $contex; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @var string The extension transferred to |
49
|
|
|
*/ |
50
|
|
|
private $exten; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @var boolean Whether the transfer was externally initiated or not |
54
|
|
|
*/ |
55
|
|
|
private $isExternal; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @var Channel (optional) - The channel that is replacing transferer when the transferee(s) can not be transferred directly |
59
|
|
|
*/ |
60
|
|
|
private $replaceChannel; |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @var string The result of the transfer attempt |
64
|
|
|
*/ |
65
|
|
|
private $result; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @var Channel (optional) - The channel that is being transferred |
69
|
|
|
*/ |
70
|
|
|
private $transferee; |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @return Bridge (optional) - The bridge being transferred |
74
|
|
|
*/ |
75
|
|
|
public function getBridge() |
76
|
|
|
{ |
77
|
|
|
return $this->bridge; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @return Channel The channel performing the blind transfer |
82
|
|
|
*/ |
83
|
|
|
public function getChannel() |
84
|
|
|
{ |
85
|
|
|
return $this->channel; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* @return string The context transferred to |
90
|
|
|
*/ |
91
|
|
|
public function getContext() |
92
|
|
|
{ |
93
|
|
|
return $this->contex; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @return string The extension transferred to |
98
|
|
|
*/ |
99
|
|
|
public function getExten() |
100
|
|
|
{ |
101
|
|
|
return $this->exten; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* @return boolean Whether the transfer was externally initiated or not |
106
|
|
|
*/ |
107
|
|
|
public function isExternal() |
108
|
|
|
{ |
109
|
|
|
return $this->isExternal; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* @return Channel (optional) - The channel that is replacing transferer when the transferee(s) can not be transferred directly |
114
|
|
|
*/ |
115
|
|
|
public function getReplaceChannel() |
116
|
|
|
{ |
117
|
|
|
return $this->replaceChannel; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @return string The result of the transfer attempt |
122
|
|
|
*/ |
123
|
|
|
public function getResult() |
124
|
|
|
{ |
125
|
|
|
return $this->result; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* @return Channel (optional) - The channel that is being transferred |
130
|
|
|
*/ |
131
|
|
|
public function getTransferee() |
132
|
|
|
{ |
133
|
|
|
return $this->transferee; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
public function getEventId() |
137
|
|
|
{ |
138
|
|
|
return "{$this->getType()}_{$this->getBridge()->getId()}"; |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* @param AriClient $client |
143
|
|
|
* @param string $response |
144
|
|
|
*/ |
145
|
|
|
public function __construct(AriClient $client, $response) |
146
|
|
|
{ |
147
|
|
|
parent::__construct($client, $response); |
148
|
|
|
|
149
|
|
|
$this->bridge = $this->getResponseValue('bridge', '\phparia\Resources\Bridge', $client); |
150
|
|
|
$this->channel = $this->getResponseValue('channel', '\phparia\Resources\Channel', $client); |
151
|
|
|
$this->contex = $this->getResponseValue('context'); |
152
|
|
|
$this->exten = $this->getResponseValue('exten'); |
153
|
|
|
$this->isExternal = $this->getResponseValue('is_external'); |
154
|
|
|
$this->replaceChannel = $this->getResponseValue('replace_channel', '\phparia\Resources\Channel', $client); |
155
|
|
|
$this->result = $this->getResponseValue('result'); |
156
|
|
|
$this->transferee = $this->getResponseValue('transferee', '\phparia\Resources\Channel', $client); |
157
|
|
|
} |
158
|
|
|
} |
159
|
|
|
|