| @@ 255-265 (lines=11) @@ | ||
| 252 | * @throws NotFoundException |
|
| 253 | * @throws ConflictException |
|
| 254 | */ |
|
| 255 | public function answer($channelId) |
|
| 256 | { |
|
| 257 | $uri = "/channels/$channelId/answer"; |
|
| 258 | try { |
|
| 259 | $this->client->getEndpoint()->post($uri, array()); |
|
| 260 | } catch (Pest_NotFound $e) { |
|
| 261 | throw new NotFoundException($e); |
|
| 262 | } catch (Pest_Conflict $e) { |
|
| 263 | throw new ConflictException($e); |
|
| 264 | } |
|
| 265 | } |
|
| 266 | ||
| 267 | /** |
|
| 268 | * Indicate ringing to a channel. |
|
| @@ 274-284 (lines=11) @@ | ||
| 271 | * @throws NotFoundException |
|
| 272 | * @throws ConflictException |
|
| 273 | */ |
|
| 274 | public function startRinging($channelId) |
|
| 275 | { |
|
| 276 | $uri = "/channels/$channelId/ring"; |
|
| 277 | try { |
|
| 278 | $this->client->getEndpoint()->post($uri, array()); |
|
| 279 | } catch (Pest_NotFound $e) { |
|
| 280 | throw new NotFoundException($e); |
|
| 281 | } catch (Pest_Conflict $e) { |
|
| 282 | throw new ConflictException($e); |
|
| 283 | } |
|
| 284 | } |
|
| 285 | ||
| 286 | /** |
|
| 287 | * Stop ringing indication on a channel if locally generated. |
|
| @@ 293-303 (lines=11) @@ | ||
| 290 | * @throws NotFoundException |
|
| 291 | * @throws ConflictException |
|
| 292 | */ |
|
| 293 | public function stopRinging($channelId) |
|
| 294 | { |
|
| 295 | $uri = "/channels/$channelId/ring"; |
|
| 296 | try { |
|
| 297 | $this->client->getEndpoint()->delete($uri); |
|
| 298 | } catch (Pest_NotFound $e) { |
|
| 299 | throw new NotFoundException($e); |
|
| 300 | } catch (Pest_Conflict $e) { |
|
| 301 | throw new ConflictException($e); |
|
| 302 | } |
|
| 303 | } |
|
| 304 | ||
| 305 | /** |
|
| 306 | * Send provided DTMF to a given channel. |
|
| @@ 368-378 (lines=11) @@ | ||
| 365 | * @throws NotFoundException |
|
| 366 | * @throws ConflictException |
|
| 367 | */ |
|
| 368 | public function unmute($channelId, $direction) |
|
| 369 | { |
|
| 370 | $uri = "/channels/$channelId/mute?direction=".$this->client->getEndpoint()->jsonEncode($direction); |
|
| 371 | try { |
|
| 372 | $this->client->getEndpoint()->delete($uri); |
|
| 373 | } catch (Pest_NotFound $e) { |
|
| 374 | throw new NotFoundException($e); |
|
| 375 | } catch (Pest_Conflict $e) { |
|
| 376 | throw new ConflictException($e); |
|
| 377 | } |
|
| 378 | } |
|
| 379 | ||
| 380 | /** |
|
| 381 | * Hold a channel. |
|
| @@ 387-397 (lines=11) @@ | ||
| 384 | * @throws NotFoundException |
|
| 385 | * @throws ConflictException |
|
| 386 | */ |
|
| 387 | public function hold($channelId) |
|
| 388 | { |
|
| 389 | $uri = "/channels/$channelId/hold"; |
|
| 390 | try { |
|
| 391 | $this->client->getEndpoint()->post($uri, array()); |
|
| 392 | } catch (Pest_NotFound $e) { |
|
| 393 | throw new NotFoundException($e); |
|
| 394 | } catch (Pest_Conflict $e) { |
|
| 395 | throw new ConflictException($e); |
|
| 396 | } |
|
| 397 | } |
|
| 398 | ||
| 399 | /** |
|
| 400 | * Remove a channel from hold. |
|
| @@ 406-416 (lines=11) @@ | ||
| 403 | * @throws NotFoundException |
|
| 404 | * @throws ConflictException |
|
| 405 | */ |
|
| 406 | public function unhold($channelId) |
|
| 407 | { |
|
| 408 | $uri = "/channels/$channelId/hold"; |
|
| 409 | try { |
|
| 410 | $this->client->getEndpoint()->delete($uri); |
|
| 411 | } catch (Pest_NotFound $e) { |
|
| 412 | throw new NotFoundException($e); |
|
| 413 | } catch (Pest_Conflict $e) { |
|
| 414 | throw new ConflictException($e); |
|
| 415 | } |
|
| 416 | } |
|
| 417 | ||
| 418 | /** |
|
| 419 | * Play silence to a channel. Using media operations such as /play on a channel playing silence in this manner will suspend silence without resuming automatically. |
|
| @@ 425-435 (lines=11) @@ | ||
| 422 | * @throws NotFoundException |
|
| 423 | * @throws ConflictException |
|
| 424 | */ |
|
| 425 | public function startSilence($channelId) |
|
| 426 | { |
|
| 427 | $uri = "/channels/$channelId/silence"; |
|
| 428 | try { |
|
| 429 | $this->client->getEndpoint()->post($uri, array()); |
|
| 430 | } catch (Pest_NotFound $e) { |
|
| 431 | throw new NotFoundException($e); |
|
| 432 | } catch (Pest_Conflict $e) { |
|
| 433 | throw new ConflictException($e); |
|
| 434 | } |
|
| 435 | } |
|
| 436 | ||
| 437 | /** |
|
| 438 | * Stop playing silence to a channel. |
|
| @@ 444-454 (lines=11) @@ | ||
| 441 | * @throws NotFoundException |
|
| 442 | * @throws ConflictException |
|
| 443 | */ |
|
| 444 | public function stopSilence($channelId) |
|
| 445 | { |
|
| 446 | $uri = "/channels/$channelId/silence"; |
|
| 447 | try { |
|
| 448 | $this->client->getEndpoint()->delete($uri); |
|
| 449 | } catch (Pest_NotFound $e) { |
|
| 450 | throw new NotFoundException($e); |
|
| 451 | } catch (Pest_Conflict $e) { |
|
| 452 | throw new ConflictException($e); |
|
| 453 | } |
|
| 454 | } |
|
| 455 | ||
| 456 | /** |
|
| 457 | * Get the value of a channel variable or function. |
|
| @@ 55-67 (lines=13) @@ | ||
| 52 | * @throws NotFoundException |
|
| 53 | * @throws ConflictException |
|
| 54 | */ |
|
| 55 | public function startMusicOnHold($id, $mohClass) |
|
| 56 | { |
|
| 57 | $uri = "/{$this->getType()}/$id/moh"; |
|
| 58 | try { |
|
| 59 | $this->client->getEndpoint()->post($uri, array( |
|
| 60 | 'mohClass' => $mohClass, |
|
| 61 | )); |
|
| 62 | } catch (Pest_NotFound $e) { |
|
| 63 | throw new NotFoundException($e); |
|
| 64 | } catch (Pest_Conflict $e) { |
|
| 65 | throw new ConflictException($e); |
|
| 66 | } |
|
| 67 | } |
|
| 68 | ||
| 69 | /** |
|
| 70 | * Stop playing music on hold to a channel. |
|
| @@ 76-86 (lines=11) @@ | ||
| 73 | * @throws NotFoundException |
|
| 74 | * @throws ConflictException |
|
| 75 | */ |
|
| 76 | public function stopMusicOnHold($id) |
|
| 77 | { |
|
| 78 | $uri = "/{$this->getType()}/$id/moh"; |
|
| 79 | try { |
|
| 80 | $this->client->getEndpoint()->delete($uri); |
|
| 81 | } catch (Pest_NotFound $e) { |
|
| 82 | throw new NotFoundException($e); |
|
| 83 | } catch (Pest_Conflict $e) { |
|
| 84 | throw new ConflictException($e); |
|
| 85 | } |
|
| 86 | } |
|
| 87 | ||
| 88 | /** |
|
| 89 | * Start playback of media. The media URI may be any of a number of URI's. Currently sound:, |
|
| @@ 175-185 (lines=11) @@ | ||
| 172 | * @throws ConflictException |
|
| 173 | * @throws NotFoundException |
|
| 174 | */ |
|
| 175 | public function pauseLiveRecording($recordingName) |
|
| 176 | { |
|
| 177 | $uri = "/recordings/live/$recordingName/pause"; |
|
| 178 | try { |
|
| 179 | $this->client->getEndpoint()->post($uri, array()); |
|
| 180 | } catch (Pest_NotFound $e) { |
|
| 181 | throw new NotFoundException($e); |
|
| 182 | } catch (Pest_Conflict $e) { |
|
| 183 | throw new ConflictException($e); |
|
| 184 | } |
|
| 185 | } |
|
| 186 | ||
| 187 | /** |
|
| 188 | * Unause a live recording. |
|
| @@ 194-204 (lines=11) @@ | ||
| 191 | * @throws ConflictException |
|
| 192 | * @throws NotFoundException |
|
| 193 | */ |
|
| 194 | public function unpauseLiveRecording($recordingName) |
|
| 195 | { |
|
| 196 | $uri = "/recordings/live/$recordingName/pause"; |
|
| 197 | try { |
|
| 198 | $this->client->getEndpoint()->delete($uri); |
|
| 199 | } catch (Pest_NotFound $e) { |
|
| 200 | throw new NotFoundException($e); |
|
| 201 | } catch (Pest_Conflict $e) { |
|
| 202 | throw new ConflictException($e); |
|
| 203 | } |
|
| 204 | } |
|
| 205 | ||
| 206 | /** |
|
| 207 | * Mute a live recording. Muting a recording suspends silence detection, which will be restarted when the recording is unmuted. |
|
| @@ 213-223 (lines=11) @@ | ||
| 210 | * @throws ConflictException |
|
| 211 | * @throws NotFoundException |
|
| 212 | */ |
|
| 213 | public function muteLiveRecording($recordingName) |
|
| 214 | { |
|
| 215 | $uri = "/recordings/live/$recordingName/mute"; |
|
| 216 | try { |
|
| 217 | $this->client->getEndpoint()->post($uri, array()); |
|
| 218 | } catch (Pest_NotFound $e) { |
|
| 219 | throw new NotFoundException($e); |
|
| 220 | } catch (Pest_Conflict $e) { |
|
| 221 | throw new ConflictException($e); |
|
| 222 | } |
|
| 223 | } |
|
| 224 | ||
| 225 | /** |
|
| 226 | * Unmute a live recording. |
|
| @@ 232-242 (lines=11) @@ | ||
| 229 | * @throws ConflictException |
|
| 230 | * @throws NotFoundException |
|
| 231 | */ |
|
| 232 | public function unmuteLiveRecording($recordingName) |
|
| 233 | { |
|
| 234 | $uri = "/recordings/live/$recordingName/mute"; |
|
| 235 | try { |
|
| 236 | $this->client->getEndpoint()->delete($uri); |
|
| 237 | } catch (Pest_NotFound $e) { |
|
| 238 | throw new NotFoundException($e); |
|
| 239 | } catch (Pest_Conflict $e) { |
|
| 240 | throw new ConflictException($e); |
|
| 241 | } |
|
| 242 | } |
|
| 243 | ||
| 244 | } |
|
| 245 | ||
| @@ 106-116 (lines=11) @@ | ||
| 103 | * @throws ConflictException |
|
| 104 | * @throws NotFoundException |
|
| 105 | */ |
|
| 106 | public function deleteDeviceState($deviceName) |
|
| 107 | { |
|
| 108 | $uri = "/deviceStates/$deviceName"; |
|
| 109 | try { |
|
| 110 | $this->client->getEndpoint()->delete($uri); |
|
| 111 | } catch (Pest_NotFound $e) { |
|
| 112 | throw new NotFoundException($e); |
|
| 113 | } catch (Pest_Conflict $e) { |
|
| 114 | throw new ConflictException($e); |
|
| 115 | } |
|
| 116 | } |
|
| 117 | ||
| 118 | } |
|
| 119 | ||