-
Notifications
You must be signed in to change notification settings - Fork 0
/
Base.php
304 lines (286 loc) · 9.29 KB
/
Base.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
<?php
/**
* This file is part of the Zimbra API in PHP library.
*
* © Nguyen Van Nguyen <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Zimbra\Voice;
use Zimbra\Account\Base as AccountBase;
use Zimbra\Enum\VoiceSortBy;
use Zimbra\Voice\Struct\ModifyFromNumSpec;
use Zimbra\Voice\Struct\ModifyVoiceFeaturesSpec;
use Zimbra\Voice\Struct\ModifyVoiceMailPinSpec;
use Zimbra\Voice\Struct\PhoneInfo;
use Zimbra\Voice\Struct\PhoneSpec;
use Zimbra\Voice\Struct\PhoneVoiceFeaturesSpec;
use Zimbra\Voice\Struct\ResetPhoneVoiceFeaturesSpec;
use Zimbra\Voice\Struct\StorePrincipalSpec;
use Zimbra\Voice\Struct\VoiceMsgActionSpec;
use Zimbra\Voice\Struct\VoiceMsgUploadSpec;
/**
* Base is a abstract class which allows to connect Zimbra API mail public functions via SOAP
*
* @package Zimbra
* @category Voice
* @author Nguyen Van Nguyen - [email protected]
* @copyright Copyright © 2013 by Nguyen Van Nguyen.
*/
abstract class Base extends AccountBase implements VoiceInterface
{
/**
* Base constructor
*
* @param string $location The Zimbra api soap location.
*/
public function __construct($location)
{
parent::__construct($location);
}
/**
* Update Zimbra's stored value of the password for unified communications.
*
* @param string $password Updated Password.
* @return mix
*/
public function changeUCPassword($password)
{
$request = new \Zimbra\Voice\Request\ChangeUCPassword(
$password
);
return $this->getClient()->doRequest($request);
}
/**
* Get Unified Communications information.
*
* @return mix
*/
public function getUCInfo()
{
$request = new \Zimbra\Voice\Request\GetUCInfo();
return $this->getClient()->doRequest($request);
}
/**
* Get Call features of a phone.
* Only features requested in <{call-feature}/> are returned in the response.
* At least one feature has to be specified.
* This is because the velodrome gateway returns only partial data if features are not specifically requested.
* Therefore for now we do not support the "want all" (i.e. no <{call-feature}>) request.
*
* @param StorePrincipalSpec $storeprincipal Store Principal specification
* @param PhoneVoiceFeaturesSpec $phone
* @return mix
*/
public function getVoiceFeatures(
StorePrincipalSpec $storeprincipal = null,
PhoneVoiceFeaturesSpec $phone = null
)
{
$request = new \Zimbra\Voice\Request\GetVoiceFeatures(
$storeprincipal, $phone
);
return $this->getClient()->doRequest($request);
}
/**
* Get Voice Folders.
*
* @param StorePrincipalSpec $storeprincipal Store Principal specification
* @param array $phone Phone specification
* @return mix
*/
public function getVoiceFolder(
StorePrincipalSpec $storeprincipal = null,
array $phone = []
)
{
$request = new \Zimbra\Voice\Request\GetVoiceFolder(
$storeprincipal, $phone
);
return $this->getClient()->doRequest($request);
}
/**
* Get voice information.
*
* @param array $phones
* @return mix
*/
public function getVoiceInfo(array $phones = [])
{
$request = new \Zimbra\Voice\Request\GetVoiceInfo(
$phones
);
return $this->getClient()->doRequest($request);
}
/**
* Get voice mail preferences.
* If no <pref> elements are provided, all known prefs for the requested phone are returned in the response.
* If <pref> elements are provided, only those prefs are returned in the response.
*
* @param StorePrincipalSpec $storeprincipal Store Principal specification
* @param PhoneSpec $phone Phone specification
* @return mix
*/
public function getVoiceMailPrefs(
StorePrincipalSpec $storeprincipal = null,
PhoneSpec $phone = null
)
{
$request = new \Zimbra\Voice\Request\GetVoiceMailPrefs(
$storeprincipal, $phone
);
return $this->getClient()->doRequest($request);
}
/**
* Modify the phone num and label.
* NOTE: UI should insert empty values for oldPhone, phone label in-case the user wants to leave them empty.
*
* @param StorePrincipalSpec $storeprincipal Store Principal specification
* @param ModifyFromNumSpec $phone Changes for phone
* @return mix
*/
public function modifyFromNum(
StorePrincipalSpec $storeprincipal = null,
ModifyFromNumSpec $phone = null
)
{
$request = new \Zimbra\Voice\Request\ModifyFromNum(
$storeprincipal, $phone
);
return $this->getClient()->doRequest($request);
}
/**
* Modify call features of a phone.
* Refer to GetVoiceFeaturesResponse for attributes and child elements of each call feature.
*
* @param StorePrincipalSpec $storeprincipal Store Principal specification
* @param ModifyVoiceFeaturesSpec $phone Specification of voice features to be modified
* @return mix
*/
public function modifyVoiceFeatures(
StorePrincipalSpec $storeprincipal = null,
ModifyVoiceFeaturesSpec $phone = null
)
{
$request = new \Zimbra\Voice\Request\ModifyVoiceFeatures(
$storeprincipal, $phone
);
return $this->getClient()->doRequest($request);
}
/**
* Modify the voice mail PIN.
*
* @param StorePrincipalSpec $storeprincipal Store Principal specification
* @param ModifyVoiceMailPinSpec $phone Specification for new PIN
* @return mix
*/
public function modifyVoiceMailPin(
StorePrincipalSpec $storeprincipal = null,
ModifyVoiceMailPinSpec $phone = null
)
{
$request = new \Zimbra\Voice\Request\ModifyVoiceMailPin(
$storeprincipal, $phone
);
return $this->getClient()->doRequest($request);
}
/**
* Modify voice mail preferences.
*
* @param StorePrincipalSpec $storeprincipal Store Principal specification
* @param PhoneInfo $phone New Preferences information
* @return mix
*/
public function modifyVoiceMailPrefs(
StorePrincipalSpec $storeprincipal = null,
PhoneInfo $phone = null
)
{
$request = new \Zimbra\Voice\Request\ModifyVoiceMailPrefs(
$storeprincipal, $phone
);
return $this->getClient()->doRequest($request);
}
/**
* Reset call features of a phone.
* If no <{call-feature}> are provided, all subscribed call features for the phone are reset to the default values.
* If <{call-feature}> elements are provided, only those call features are reset.
*
* @param StorePrincipalSpec $storeprincipal Store Principal specification
* @param ResetPhoneVoiceFeaturesSpec $phone Features to reset for a phone
* @return mix
*/
public function resetVoiceFeatures(
StorePrincipalSpec $storeprincipal = null,
ResetPhoneVoiceFeaturesSpec $phone = null
)
{
$request = new \Zimbra\Voice\Request\ResetVoiceFeatures(
$storeprincipal, $phone
);
return $this->getClient()->doRequest($request);
}
/**
* Search voice messages and call logs.
*
* @param string $query
* @param StorePrincipalSpec $storeprincipal
* @param int $limit
* @param int $offset
* @param string $types
* @param VoiceSortBy $sortBy
* @return mix
*/
public function searchVoice(
$query,
StorePrincipalSpec $storeprincipal = null,
$limit = null,
$offset = null,
$types = null,
VoiceSortBy $sortBy = null
)
{
$request = new \Zimbra\Voice\Request\SearchVoice(
$query, $storeprincipal, $limit, $offset, $types, $sortBy
);
return $this->getClient()->doRequest($request);
}
/**
* Retrieve the voice mail body from the gateway and upload(save) it as an attachment on the server.
*
* @param StorePrincipalSpec $storeprincipal Store Principal specification
* @param VoiceMsgUploadSpec $vm Specification of voice message to upload
* @return mix
*/
public function uploadVoiceMail(
StorePrincipalSpec $storeprincipal = null,
VoiceMsgUploadSpec $vm = null
)
{
$request = new \Zimbra\Voice\Request\UploadVoiceMail(
$storeprincipal, $vm
);
return $this->getClient()->doRequest($request);
}
/**
* Perform an action on a voice message
* - Modify state of voice messages
* - soft delete/undelete voice messages
* - empty (hard-delete) voice message trash folders
*
* @param VoiceMsgActionSpec $action Action specification
* @param StorePrincipalSpec $storeprincipal Store Principal specification
* @return mix
*/
public function voiceMsgAction(
VoiceMsgActionSpec $action,
StorePrincipalSpec $storeprincipal = null
)
{
$request = new \Zimbra\Voice\Request\VoiceMsgAction(
$action, $storeprincipal
);
return $this->getClient()->doRequest($request);
}
}