|
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 an attended transfer has occurred. |
|
27
|
|
|
* |
|
28
|
|
|
* @author Brian Smith <[email protected]> |
|
29
|
|
|
*/ |
|
30
|
|
|
class BridgeAttendedTransfer extends Event implements IdentifiableEventInterface |
|
31
|
|
|
{ |
|
32
|
|
|
/** |
|
33
|
|
|
* @var string (optional) - Application that has been transferred into |
|
34
|
|
|
*/ |
|
35
|
|
|
private $destinationApplication; |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* @var string (optional) - Bridge that survived the merge result |
|
39
|
|
|
*/ |
|
40
|
|
|
private $destinationBridge; |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* @var Channel (optional) - First leg of a link transfer result |
|
44
|
|
|
*/ |
|
45
|
|
|
private $destinationLinkFirstLeg; |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* @var Channel (optional) - Second leg of a link transfer result |
|
49
|
|
|
*/ |
|
50
|
|
|
private $destinationLinkSecondLeg; |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* @var Bridge (optional) - Bridge that survived the threeway result |
|
54
|
|
|
*/ |
|
55
|
|
|
private $destinationThreewayBridge; |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* @var Channel (optional) - Transferer channel that survived the threeway result |
|
59
|
|
|
*/ |
|
60
|
|
|
private $destinationThreewayChannel; |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* @var string How the transfer was accomplished |
|
64
|
|
|
*/ |
|
65
|
|
|
private $destinationType; |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* @var boolean Whether the transfer was externally initiated or not |
|
69
|
|
|
*/ |
|
70
|
|
|
private $isExternal; |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* @var Channel (optional) - The channel that is replacing transferer_first_leg in the swap |
|
74
|
|
|
*/ |
|
75
|
|
|
private $replaceChannel; |
|
76
|
|
|
|
|
77
|
|
|
/** |
|
78
|
|
|
* @var string The result of the transfer attempt |
|
79
|
|
|
*/ |
|
80
|
|
|
private $result; |
|
81
|
|
|
|
|
82
|
|
|
/** |
|
83
|
|
|
* @var Channel (optional) - The channel that is being transferred to |
|
84
|
|
|
*/ |
|
85
|
|
|
private $transferTarget; |
|
86
|
|
|
|
|
87
|
|
|
/** |
|
88
|
|
|
* @var Channel (optional) - The channel that is being transferred |
|
89
|
|
|
*/ |
|
90
|
|
|
private $transferee; |
|
91
|
|
|
|
|
92
|
|
|
/** |
|
93
|
|
|
* @var Channel First leg of the transferer |
|
94
|
|
|
*/ |
|
95
|
|
|
private $transfererFirstLeg; |
|
96
|
|
|
|
|
97
|
|
|
/** |
|
98
|
|
|
* @var Bridge (optional) - Bridge the transferer first leg is in |
|
99
|
|
|
*/ |
|
100
|
|
|
private $transfererFirstLegBridge; |
|
101
|
|
|
|
|
102
|
|
|
/** |
|
103
|
|
|
* @var Channel Second leg of the transferer |
|
104
|
|
|
*/ |
|
105
|
|
|
private $transfererSecondLeg; |
|
106
|
|
|
|
|
107
|
|
|
/** |
|
108
|
|
|
* @var Bridge (optional) - Bridge the transferer second leg is in |
|
109
|
|
|
*/ |
|
110
|
|
|
private $transfererSecondLegBridge; |
|
111
|
|
|
|
|
112
|
|
|
/** |
|
113
|
|
|
* @return string (optional) - Application that has been transferred into |
|
114
|
|
|
*/ |
|
115
|
|
|
public function getDestinationApplication() |
|
116
|
|
|
{ |
|
117
|
|
|
return $this->destinationApplication; |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
/** |
|
121
|
|
|
* @return string (optional) - Bridge that survived the merge result |
|
122
|
|
|
*/ |
|
123
|
|
|
public function getDestinationBridge() |
|
124
|
|
|
{ |
|
125
|
|
|
return $this->destinationBridge; |
|
126
|
|
|
} |
|
127
|
|
|
|
|
128
|
|
|
/** |
|
129
|
|
|
* @return Channel (optional) - First leg of a link transfer result |
|
130
|
|
|
*/ |
|
131
|
|
|
public function getDestinationLinkFirstLeg() |
|
132
|
|
|
{ |
|
133
|
|
|
return $this->destinationLinkFirstLeg; |
|
134
|
|
|
} |
|
135
|
|
|
|
|
136
|
|
|
/** |
|
137
|
|
|
* @return Channel (optional) - Second leg of a link transfer result |
|
138
|
|
|
*/ |
|
139
|
|
|
public function getDestinationLinkSecondLeg() |
|
140
|
|
|
{ |
|
141
|
|
|
return $this->destinationLinkSecondLeg; |
|
142
|
|
|
} |
|
143
|
|
|
|
|
144
|
|
|
/** |
|
145
|
|
|
* @return Bridge (optional) - Bridge that survived the threeway result |
|
146
|
|
|
*/ |
|
147
|
|
|
public function getDestinationThreewayBridge() |
|
148
|
|
|
{ |
|
149
|
|
|
return $this->destinationThreewayBridge; |
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
|
|
/** |
|
153
|
|
|
* @return Channel (optional) - Transferer channel that survived the threeway result |
|
154
|
|
|
*/ |
|
155
|
|
|
public function getDestinationThreewayChannel() |
|
156
|
|
|
{ |
|
157
|
|
|
return $this->destinationThreewayChannel; |
|
158
|
|
|
} |
|
159
|
|
|
|
|
160
|
|
|
/** |
|
161
|
|
|
* @return string How the transfer was accomplished |
|
162
|
|
|
*/ |
|
163
|
|
|
public function getDestinationType() |
|
164
|
|
|
{ |
|
165
|
|
|
return $this->destinationType; |
|
166
|
|
|
} |
|
167
|
|
|
|
|
168
|
|
|
/** |
|
169
|
|
|
* @return boolean Whether the transfer was externally initiated or not |
|
170
|
|
|
*/ |
|
171
|
|
|
public function isExternal() |
|
172
|
|
|
{ |
|
173
|
|
|
return $this->isExternal; |
|
174
|
|
|
} |
|
175
|
|
|
|
|
176
|
|
|
/** |
|
177
|
|
|
* @return Channel (optional) - The channel that is replacing transferer_first_leg in the swap |
|
178
|
|
|
*/ |
|
179
|
|
|
public function getReplaceChannel() |
|
180
|
|
|
{ |
|
181
|
|
|
return $this->replaceChannel; |
|
182
|
|
|
} |
|
183
|
|
|
|
|
184
|
|
|
/** |
|
185
|
|
|
* @return string The result of the transfer attempt |
|
186
|
|
|
*/ |
|
187
|
|
|
public function getResult() |
|
188
|
|
|
{ |
|
189
|
|
|
return $this->result; |
|
190
|
|
|
} |
|
191
|
|
|
|
|
192
|
|
|
/** |
|
193
|
|
|
* @return Channel (optional) - The channel that is being transferred to |
|
194
|
|
|
*/ |
|
195
|
|
|
public function getTransferTarget() |
|
196
|
|
|
{ |
|
197
|
|
|
return $this->transferTarget; |
|
198
|
|
|
} |
|
199
|
|
|
|
|
200
|
|
|
/** |
|
201
|
|
|
* @return Channel (optional) - The channel that is being transferred |
|
202
|
|
|
*/ |
|
203
|
|
|
public function getTransferee() |
|
204
|
|
|
{ |
|
205
|
|
|
return $this->transferee; |
|
206
|
|
|
} |
|
207
|
|
|
|
|
208
|
|
|
/** |
|
209
|
|
|
* @return Channel First leg of the transferer |
|
210
|
|
|
*/ |
|
211
|
|
|
public function getTransfererFirstLeg() |
|
212
|
|
|
{ |
|
213
|
|
|
return $this->transfererFirstLeg; |
|
214
|
|
|
} |
|
215
|
|
|
|
|
216
|
|
|
/** |
|
217
|
|
|
* @return Bridge (optional) - Bridge the transferer first leg is in |
|
218
|
|
|
*/ |
|
219
|
|
|
public function getTransfererFirstLegBridge() |
|
220
|
|
|
{ |
|
221
|
|
|
return $this->transfererFirstLegBridge; |
|
222
|
|
|
} |
|
223
|
|
|
|
|
224
|
|
|
/** |
|
225
|
|
|
* @return Channel Second leg of the transferer |
|
226
|
|
|
*/ |
|
227
|
|
|
public function getTransfererSecondLeg() |
|
228
|
|
|
{ |
|
229
|
|
|
return $this->transfererSecondLeg; |
|
230
|
|
|
} |
|
231
|
|
|
|
|
232
|
|
|
/** |
|
233
|
|
|
* @return Bridge (optional) - Bridge the transferer second leg is in |
|
234
|
|
|
*/ |
|
235
|
|
|
public function getTransfererSecondLegBridge() |
|
236
|
|
|
{ |
|
237
|
|
|
return $this->transfererSecondLegBridge; |
|
238
|
|
|
} |
|
239
|
|
|
|
|
240
|
|
|
public function getEventId() |
|
241
|
|
|
{ |
|
242
|
|
|
return "{$this->getType()}_{$this->getTransfererFirstLegBridge()->getId()}"; |
|
243
|
|
|
} |
|
244
|
|
|
|
|
245
|
|
|
/** |
|
246
|
|
|
* @param AriClient $client |
|
247
|
|
|
* @param string $response |
|
248
|
|
|
*/ |
|
249
|
|
|
public function __construct(AriClient $client, $response) |
|
250
|
|
|
{ |
|
251
|
|
|
parent::__construct($client, $response); |
|
252
|
|
|
|
|
253
|
|
|
$this->destinationApplication = $this->getResponseValue('destination_application'); |
|
254
|
|
|
$this->destinationBridge = $this->getResponseValue('destination_bridge'); |
|
255
|
|
|
$this->destinationLinkFirstLeg = $this->getResponseValue('destination_link_first_leg', |
|
256
|
|
|
'\phparia\Resources\Channel', $client); |
|
257
|
|
|
$this->destinationLinkSecondLeg = $this->getResponseValue('destination_link_second_leg'); |
|
258
|
|
|
$this->destinationThreewayBridge = $this->getResponseValue('destination_threeway_bridge', |
|
259
|
|
|
'\phparia\Resources\Bridge', $client); |
|
260
|
|
|
$this->destinationThreewayChannel = $this->getResponseValue('destination_threeway_channel', |
|
261
|
|
|
'\phparia\Resources\Channel', $client); |
|
262
|
|
|
$this->destinationType = $this->getResponseValue('destination_type'); |
|
263
|
|
|
$this->isExternal = $this->getResponseValue('is_external'); |
|
264
|
|
|
$this->replaceChannel = $this->getResponseValue('replace_channel', '\phparia\Resources\Channel', $client); |
|
265
|
|
|
$this->result = $this->getResponseValue('result'); |
|
266
|
|
|
$this->transferTarget = $this->getResponseValue('transfer_target', '\phparia\Resources\Channel', $client); |
|
267
|
|
|
$this->transferee = $this->getResponseValue('transferee', '\phparia\Resources\Channel', $client); |
|
268
|
|
|
$this->transfererFirstLeg = $this->getResponseValue('transferer_first_leg', '\phparia\Resources\Channel', |
|
269
|
|
|
$client); |
|
270
|
|
|
$this->transfererFirstLegBridge = $this->getResponseValue('transferer_first_leg_bridge', |
|
271
|
|
|
'\phparia\Resources\Bridge', $client); |
|
272
|
|
|
$this->transfererSecondLeg = $this->getResponseValue('transferer_second_leg', '\phparia\Resources\Channel', |
|
273
|
|
|
$client); |
|
274
|
|
|
$this->transfererSecondLegBridge = $this->getResponseValue('transferer_second_leg_bridge', |
|
275
|
|
|
'\phparia\Resources\Bridge', $client); |
|
276
|
|
|
} |
|
277
|
|
|
} |
|
278
|
|
|
|