Skip to content

Commit a3a6f46

Browse files
committed
Merge commit 'refs/pull/159/merge' of github.com:marcelog/PAMI into PR3
PR: ( marcelog#159) PR Description: add Cdr Event Provided By: @amir200xven Added Tests for CdrEvent
2 parents 79b66ff + d0ab5a0 commit a3a6f46

File tree

3 files changed

+235
-0
lines changed

3 files changed

+235
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ can still catch them. If you catch one of these, please report it!
199199
* vgsm_sms_rx
200200
* VoicemailUserEntry
201201
* VoicemailUserEntryComplete
202+
* Cdr
202203

203204
# Currently Supported Actions
204205

src/PAMI/Message/Event/CdrEvent.php

+213
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
<?php
2+
/**
3+
* Event triggered when a channel changes its status.
4+
*
5+
* NOTE: For correct callerid values: see: https://issues.asterisk.org/jira/browse/ASTERISK-16910
6+
*
7+
* PHP Version 5
8+
*
9+
* @category Pami
10+
* @package Message
11+
* @subpackage Event
12+
* @author Marcelo Gornstein <[email protected]>
13+
* @license http://marcelog.github.com/PAMI/ Apache License 2.0
14+
* @version SVN: $Id$
15+
* @link http://marcelog.github.com/PAMI/
16+
*
17+
* Copyright 2011 Marcelo Gornstein <[email protected]>
18+
*
19+
* Licensed under the Apache License, Version 2.0 (the "License");
20+
* you may not use this file except in compliance with the License.
21+
* You may obtain a copy of the License at
22+
*
23+
* http://www.apache.org/licenses/LICENSE-2.0
24+
*
25+
* Unless required by applicable law or agreed to in writing, software
26+
* distributed under the License is distributed on an "AS IS" BASIS,
27+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28+
* See the License for the specific language governing permissions and
29+
* limitations under the License.
30+
*
31+
*/
32+
namespace PAMI\Message\Event;
33+
34+
use PAMI\Message\Event\EventMessage;
35+
36+
/**
37+
* Event triggered when a channel changes its status.
38+
*
39+
* PHP Version 5
40+
*
41+
* @category Pami
42+
* @package Message
43+
* @subpackage Event
44+
* @author Marcelo Gornstein <[email protected]>
45+
* @license http://marcelog.github.com/PAMI/ Apache License 2.0
46+
* @link http://marcelog.github.com/PAMI/
47+
*/
48+
class CdrEvent extends EventMessage
49+
{
50+
/**
51+
* Returns key: 'UniqueID'.
52+
*
53+
* @return string
54+
*/
55+
public function getUniqueID()
56+
{
57+
return $this->getKey('UniqueID');
58+
}
59+
60+
/**
61+
* Returns key: 'Privilege'.
62+
*
63+
* @return string
64+
*/
65+
public function getPrivilege()
66+
{
67+
return $this->getKey('Privilege');
68+
}
69+
/**
70+
* Returns key: 'AccountCode'.
71+
*
72+
* @return string
73+
*/
74+
public function getAccountCode()
75+
{
76+
return $this->getKey('AccountCode');
77+
}
78+
/**
79+
* Returns key: 'Source'.
80+
*
81+
* @return string
82+
*/
83+
public function getSource()
84+
{
85+
return $this->getKey('Source');
86+
}
87+
/**
88+
* Returns key: 'Destination'.
89+
*
90+
* @return string
91+
*/
92+
public function getDestination()
93+
{
94+
return $this->getKey('Destination');
95+
}
96+
/**
97+
* Returns key: 'DestinationContext'.
98+
*
99+
* @return string
100+
*/
101+
public function getDestinationContext()
102+
{
103+
return $this->getKey('DestinationContext');
104+
}
105+
/**
106+
* Returns key: 'CallerID'.
107+
*
108+
* @return string
109+
*/
110+
public function getCallerID()
111+
{
112+
return $this->getKey('CallerID');
113+
}
114+
/**
115+
* Returns key: 'Channel'.
116+
*
117+
* @return string
118+
*/
119+
public function getChannel()
120+
{
121+
return $this->getKey('Channel');
122+
}
123+
/**
124+
* Returns key: 'DestinationChannel'.
125+
*
126+
* @return string
127+
*/
128+
public function getDestinationChannel()
129+
{
130+
return $this->getKey('DestinationChannel');
131+
}
132+
/**
133+
* Returns key: 'LastApplication'.
134+
*
135+
* @return string
136+
*/
137+
public function getLastApplication()
138+
{
139+
return $this->getKey('LastApplication');
140+
}
141+
/**
142+
* Returns key: 'LastData'.
143+
*
144+
* @return string
145+
*/
146+
public function getLastData()
147+
{
148+
return $this->getKey('LastData');
149+
}
150+
/**
151+
* Returns key: 'StartTime'.
152+
*
153+
* @return string
154+
*/
155+
public function getStartTime()
156+
{
157+
return $this->getKey('StartTime');
158+
}
159+
/**
160+
* Returns key: 'AnswerTime'.
161+
*
162+
* @return string
163+
*/
164+
public function getAnswerTime()
165+
{
166+
return $this->getKey('AnswerTime');
167+
}
168+
/**
169+
* Returns key: 'EndTime'.
170+
*
171+
* @return string
172+
*/
173+
public function getEndTime()
174+
{
175+
return $this->getKey('EndTime');
176+
}
177+
/**
178+
* Returns key: 'Duration'.
179+
*
180+
* @return string
181+
*/
182+
public function getDuration()
183+
{
184+
return $this->getKey('Duration');
185+
}
186+
/**
187+
* Returns key: 'BillableSeconds'.
188+
*
189+
* @return string
190+
*/
191+
public function getBillableSeconds()
192+
{
193+
return $this->getKey('BillableSeconds');
194+
}
195+
/**
196+
* Returns key: 'Disposition'.
197+
*
198+
* @return string
199+
*/
200+
public function getDisposition()
201+
{
202+
return $this->getKey('Disposition');
203+
}
204+
/**
205+
* Returns key: 'AMAFlags'.
206+
*
207+
* @return string
208+
*/
209+
public function getAMAFlags()
210+
{
211+
return $this->getKey('AMAFlags');
212+
}
213+
}

test/events/Test_Events.php

+21
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ public function can_report_events()
110110
'QueueCallerAbandon',
111111
'EndpointList',
112112
'EndpointListComplete',
113+
'Cdr',
113114
);
114115
$eventTranslatedValues = array(
115116
'QueueMemberStatus' => array(
@@ -1640,6 +1641,26 @@ public function can_report_events()
16401641
'ActiveChannels' => 0,
16411642
),
16421643
'EndpointListComplete' => array('ListItems' => 'ListItems'),
1644+
'Cdr' => array(
1645+
'UniqueID' => 'UniqueID',
1646+
'Privilege' => 'Privilege',
1647+
'AccountCode' => 'AccountCode',
1648+
'Source' => 'Source',
1649+
'Destination' => 'Destination',
1650+
'DestinationContext' => 'DestinationContext',
1651+
'CallerID' => 'CallerID',
1652+
'Channel' => 'Channel',
1653+
'DestinationChannel' => 'DestinationChannel',
1654+
'LastApplication' => 'LastApplication',
1655+
'LastData' => 'LastData',
1656+
'StartTime' => 'StartTime',
1657+
'AnswerTime' => 'AnswerTime',
1658+
'EndTime' => 'EndTime',
1659+
'Duration' => 'Duration',
1660+
'BillableSeconds' => 'BillableSeconds',
1661+
'Disposition' => 'Disposition',
1662+
'AMAFlags' => 'AMAFlags'
1663+
),
16431664
);
16441665
$eventGetters = array(
16451666
'UserEvent' => array(

0 commit comments

Comments
 (0)