| @@ 30-89 (lines=60) @@ | ||
| 27 | * @author Brian Smith <[email protected]> |
|
| 28 | * @todo Add cause constants |
|
| 29 | */ |
|
| 30 | class ChannelHangupRequest extends Event implements IdentifiableEventInterface |
|
| 31 | { |
|
| 32 | /** |
|
| 33 | * @var int (optional) - Integer representation of the cause of the hangup. |
|
| 34 | */ |
|
| 35 | private $cause; |
|
| 36 | ||
| 37 | /** |
|
| 38 | * @var \phparia\Resources\Channel The channel on which the hangup was requested. |
|
| 39 | */ |
|
| 40 | private $channel; |
|
| 41 | ||
| 42 | /** |
|
| 43 | * @var boolean (optional) - Whether the hangup request was a soft hangup request. |
|
| 44 | */ |
|
| 45 | private $soft; |
|
| 46 | ||
| 47 | /** |
|
| 48 | * @return int |
|
| 49 | */ |
|
| 50 | public function getCause() |
|
| 51 | { |
|
| 52 | return $this->cause; |
|
| 53 | } |
|
| 54 | ||
| 55 | /** |
|
| 56 | * @return Channel |
|
| 57 | */ |
|
| 58 | public function getChannel() |
|
| 59 | { |
|
| 60 | return $this->channel; |
|
| 61 | } |
|
| 62 | ||
| 63 | /** |
|
| 64 | * @return boolean |
|
| 65 | */ |
|
| 66 | public function getSoft() |
|
| 67 | { |
|
| 68 | return $this->soft; |
|
| 69 | } |
|
| 70 | ||
| 71 | public function getEventId() |
|
| 72 | { |
|
| 73 | return "{$this->getType()}_{$this->getChannel()->getId()}"; |
|
| 74 | } |
|
| 75 | ||
| 76 | /** |
|
| 77 | * @param AriClient $client |
|
| 78 | * @param string $response |
|
| 79 | */ |
|
| 80 | public function __construct(AriClient $client, $response) |
|
| 81 | { |
|
| 82 | parent::__construct($client, $response); |
|
| 83 | ||
| 84 | $this->cause = property_exists($this->response, 'cause') ? $this->response->cause : null; |
|
| 85 | $this->channel = new Channel($client, $this->response->channel); |
|
| 86 | $this->soft = property_exists($this->response, 'soft') ? $this->response->soft : null; |
|
| 87 | } |
|
| 88 | ||
| 89 | } |
|
| 90 | ||
| @@ 29-88 (lines=60) @@ | ||
| 26 | * |
|
| 27 | * @author Brian Smith <[email protected]> |
|
| 28 | */ |
|
| 29 | class StasisStart extends Event implements IdentifiableEventInterface |
|
| 30 | { |
|
| 31 | /** |
|
| 32 | * @var array Arguments to the application |
|
| 33 | */ |
|
| 34 | private $args; |
|
| 35 | ||
| 36 | /** |
|
| 37 | * @var Channel |
|
| 38 | */ |
|
| 39 | private $channel; |
|
| 40 | ||
| 41 | /** |
|
| 42 | * @var Channel (optional) |
|
| 43 | */ |
|
| 44 | private $replaceChannel; |
|
| 45 | ||
| 46 | /** |
|
| 47 | * @return array Arguments to the application |
|
| 48 | */ |
|
| 49 | public function getArgs() |
|
| 50 | { |
|
| 51 | return $this->args; |
|
| 52 | } |
|
| 53 | ||
| 54 | /** |
|
| 55 | * @return Channel |
|
| 56 | */ |
|
| 57 | public function getChannel() |
|
| 58 | { |
|
| 59 | return $this->channel; |
|
| 60 | } |
|
| 61 | ||
| 62 | /** |
|
| 63 | * @return Channel (optional) |
|
| 64 | */ |
|
| 65 | public function getReplaceChannel() |
|
| 66 | { |
|
| 67 | return $this->replaceChannel; |
|
| 68 | } |
|
| 69 | ||
| 70 | public function getEventId() |
|
| 71 | { |
|
| 72 | return "{$this->getType()}_{$this->getChannel()->getId()}"; |
|
| 73 | } |
|
| 74 | ||
| 75 | /** |
|
| 76 | * @param AriClient $client |
|
| 77 | * @param string $response |
|
| 78 | */ |
|
| 79 | public function __construct(AriClient $client, $response) |
|
| 80 | { |
|
| 81 | parent::__construct($client, $response); |
|
| 82 | ||
| 83 | $this->args = $this->response->args; |
|
| 84 | $this->channel = new Channel($client, $this->response->channel); |
|
| 85 | $this->replaceChannel = property_exists($this->response, 'replace_channel') ? new Channel($client, |
|
| 86 | $this->response->replace_channel) : null; |
|
| 87 | } |
|
| 88 | ||
| 89 | } |
|
| 90 | ||