Skip to content

Commit 61e5860

Browse files
authored
Merge pull request #116 from thomasvargiu/feature/events-compatibility
Events compatibility with Asterisk v12-14
2 parents 4bbc95b + dff91b7 commit 61e5860

File tree

4 files changed

+688
-39
lines changed

4 files changed

+688
-39
lines changed

src/PAMI/Message/Event/NewextenEvent.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
*/
3030
namespace PAMI\Message\Event;
3131

32-
use PAMI\Message\Event\EventMessage;
33-
3432
/**
3533
* Event triggered when a new extension is accessed.
3634
*
@@ -66,7 +64,8 @@ public function getChannel()
6664
}
6765

6866
/**
69-
* Returns key: 'Exten'.
67+
* Returns key: 'Extension'.
68+
* @deprecated Please use {@see getExten()}.
7069
*
7170
* @return string
7271
*/
@@ -75,6 +74,16 @@ public function getExtension()
7574
return $this->getKey('Extension');
7675
}
7776

77+
/**
78+
* Returns key: 'Exten'.
79+
*
80+
* @return string
81+
*/
82+
public function getExten()
83+
{
84+
return $this->getKey('Exten') ?: $this->getKey('Extension');
85+
}
86+
7887
/**
7988
* Returns key: 'Context'.
8089
*

src/PAMI/Message/Event/ParkedCallEvent.php

Lines changed: 176 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
*/
3030
namespace PAMI\Message\Event;
3131

32-
use PAMI\Message\Event\EventMessage;
33-
3432
/**
3533
* Event triggered when a call is parked.
3634
*
@@ -77,81 +75,249 @@ public function getFrom()
7775

7876
/**
7977
* Returns key: 'Timeout'.
78+
* @deprecated Deprecated since Asterisk 12. {@use ParkingTimeout()}.
8079
*
8180
* @return string
8281
*/
8382
public function getTimeout()
8483
{
85-
return $this->getKey('Timeout');
84+
return $this->getParkingTimeout();
8685
}
8786

8887
/**
8988
* Returns key: 'ConnectedLineNum'.
89+
* @deprecated Deprecated since Asterisk 12. {@use getParkeeConnectedLineNum()}.
9090
*
9191
* @return string
9292
*/
9393
public function getConnectedLineNum()
9494
{
95-
return $this->getKey('ConnectedLineNum');
95+
return $this->getParkeeConnectedLineNum();
9696
}
9797

9898
/**
9999
* Returns key: 'ConnectedLineName'.
100+
* @deprecated Deprecated since Asterisk 12. {@use getParkeeConnectedLineName()}.
100101
*
101102
* @return string
102103
*/
103104
public function getConnectedLineName()
104105
{
105-
return $this->getKey('ConnectedLineName');
106+
return $this->getParkeeConnectedLineName();
106107
}
107108

108109
/**
109110
* Returns key: 'Channel'.
111+
* @deprecated Deprecated since Asterisk 12. {@use getParkeeChannel()}.
110112
*
111113
* @return string
112114
*/
113115
public function getChannel()
114116
{
115-
return $this->getKey('Channel');
117+
return $this->getParkeeChannel();
116118
}
117119

118120
/**
119121
* Returns key: 'CallerIDNum'.
122+
* @deprecated Deprecated since Asterisk 12. {@use getParkeeCallerIDNum()}.
120123
*
121124
* @return string
122125
*/
123126
public function getCallerIDNum()
124127
{
125-
return $this->getKey('CallerIDNum');
128+
return $this->getParkeeCallerIDNum();
126129
}
127130

128131
/**
129132
* Returns key: 'CallerIDName'.
133+
* @deprecated Deprecated since Asterisk 12. {@use getParkeeCallerIDName()}.
130134
*
131135
* @return string
132136
*/
133137
public function getCallerIDName()
134138
{
135-
return $this->getKey('CallerIDName');
139+
return $this->getParkeeCallerIDName();
136140
}
137141

138142
/**
139143
* Returns key: 'UniqueID'.
144+
* @deprecated Deprecated since Asterisk 12. {@use getParkeeUniqueid()}.
140145
*
141146
* @return string
142147
*/
143148
public function getUniqueID()
144149
{
145-
return $this->getKey('UniqueID');
150+
return $this->getParkeeUniqueid();
146151
}
147152

148153
/**
149154
* Returns key: 'Exten'.
155+
* @deprecated Deprecated since Asterisk 12. {@use getParkingSpace()}.
150156
*
151157
* @return string
152158
*/
153159
public function getExtension()
154160
{
155-
return $this->getKey('Exten');
161+
return $this->getParkingSpace();
162+
}
163+
164+
/**
165+
* Returns key: 'ParkeeChannel'.
166+
*
167+
* @return string
168+
*/
169+
public function getParkeeChannel()
170+
{
171+
return $this->getKey('ParkeeChannel') ?: $this->getKey('Channel');
172+
}
173+
174+
/**
175+
* Returns key: 'ParkeeChannelState'.
176+
*
177+
* @return string
178+
*/
179+
public function getParkeeChannelState()
180+
{
181+
return $this->getKey('ParkeeChannelState');
182+
}
183+
184+
/**
185+
* Returns key: 'ParkeeChannelStateDesc'.
186+
*
187+
* @return string
188+
*/
189+
public function getParkeeChannelStateDesc()
190+
{
191+
return $this->getKey('ParkeeChannelStateDesc');
192+
}
193+
194+
/**
195+
* Returns key: 'ParkeeCallerIDNum'.
196+
*
197+
* @return string
198+
*/
199+
public function getParkeeCallerIDNum()
200+
{
201+
return $this->getKey('ParkeeCallerIDNum') ?: $this->getKey('CallerIDNum');
202+
}
203+
204+
/**
205+
* Returns key: 'ParkeeCallerIDName'.
206+
*
207+
* @return string
208+
*/
209+
public function getParkeeCallerIDName()
210+
{
211+
return $this->getKey('ParkeeCallerIDName') ?: $this->getKey('CallerIDName');
212+
}
213+
214+
/**
215+
* Returns key: 'ParkeeConnectedLineNum'.
216+
*
217+
* @return string
218+
*/
219+
public function getParkeeConnectedLineNum()
220+
{
221+
return $this->getKey('ParkeeConnectedLineNum') ?: $this->getKey('ConnectedLineNum');
222+
}
223+
224+
/**
225+
* Returns key: 'ParkeeConnectedLineName'.
226+
*
227+
* @return string
228+
*/
229+
public function getParkeeConnectedLineName()
230+
{
231+
return $this->getKey('ParkeeConnectedLineName') ?: $this->getKey('ConnectedLineName');
232+
}
233+
234+
/**
235+
* Returns key: 'ParkeeAccountCode'.
236+
*
237+
* @return string
238+
*/
239+
public function getParkeeAccountCode()
240+
{
241+
return $this->getKey('ParkeeAccountCode');
242+
}
243+
244+
/**
245+
* Returns key: 'ParkeeContext'.
246+
*
247+
* @return string
248+
*/
249+
public function getParkeeContext()
250+
{
251+
return $this->getKey('ParkeeContext');
252+
}
253+
254+
/**
255+
* Returns key: 'ParkeeExten'.
256+
*
257+
* @return string
258+
*/
259+
public function getParkeeExten()
260+
{
261+
return $this->getKey('ParkeeExten');
262+
}
263+
264+
/**
265+
* Returns key: 'ParkeePriority'.
266+
*
267+
* @return string
268+
*/
269+
public function getParkeePriority()
270+
{
271+
return $this->getKey('ParkeePriority');
272+
}
273+
274+
/**
275+
* Returns key: 'ParkeeUniqueid'.
276+
*
277+
* @return string
278+
*/
279+
public function getParkeeUniqueid()
280+
{
281+
return $this->getKey('ParkeeUniqueid') ?: $this->getKey('UniqueId');
282+
}
283+
284+
/**
285+
* Returns key: 'ParkerDialString'.
286+
*
287+
* @return string
288+
*/
289+
public function getParkerDialString()
290+
{
291+
return $this->getKey('ParkerDialString');
292+
}
293+
294+
/**
295+
* Returns key: 'ParkingSpace'.
296+
*
297+
* @return string
298+
*/
299+
public function getParkingSpace()
300+
{
301+
return $this->getKey('ParkingSpace') ?: $this->getKey('Exten');
302+
}
303+
304+
/**
305+
* Returns key: 'ParkingTimeout'.
306+
*
307+
* @return string
308+
*/
309+
public function getParkingTimeout()
310+
{
311+
return $this->getKey('ParkingTimeout') ?: $this->getKey('Timeout');
312+
}
313+
314+
/**
315+
* Returns key: 'ParkingDuration'.
316+
*
317+
* @return string
318+
*/
319+
public function getParkingDuration()
320+
{
321+
return $this->getKey('ParkingDuration');
156322
}
157323
}

0 commit comments

Comments
 (0)