| @@ 92-131 (lines=40) @@ | ||
| 89 | * @throws InvalidParameterException |
|
| 90 | * @throws ServerException |
|
| 91 | */ |
|
| 92 | public function createChannel( |
|
| 93 | $endpoint, |
|
| 94 | $extension = null, |
|
| 95 | $context = null, |
|
| 96 | $priority = null, |
|
| 97 | $label = null, |
|
| 98 | $app = null, |
|
| 99 | $appArgs = null, |
|
| 100 | $callerId = null, |
|
| 101 | $timeout = null, |
|
| 102 | $channelId = null, |
|
| 103 | $otherChannelId = null, |
|
| 104 | $formats = null, |
|
| 105 | $variables = array() |
|
| 106 | ) { |
|
| 107 | $uri = 'channels'; |
|
| 108 | try { |
|
| 109 | $response = $this->client->getEndpoint()->post($uri, [ |
|
| 110 | 'form_params' => [ |
|
| 111 | 'endpoint' => $endpoint, |
|
| 112 | 'extension' => $extension, |
|
| 113 | 'context' => $context, |
|
| 114 | 'priority' => $priority, |
|
| 115 | 'label' => $label, |
|
| 116 | 'app' => $app, |
|
| 117 | 'appArgs' => $appArgs, |
|
| 118 | 'callerId' => $callerId, |
|
| 119 | 'timeout' => $timeout, |
|
| 120 | 'channelId' => $channelId, |
|
| 121 | 'otherChannelId' => $otherChannelId, |
|
| 122 | 'formats' => $formats, |
|
| 123 | 'variables' => array_map('strval', $variables), |
|
| 124 | ] |
|
| 125 | ]); |
|
| 126 | } catch (RequestException $e) { |
|
| 127 | $this->processRequestException($e); |
|
| 128 | } |
|
| 129 | ||
| 130 | return new Channel($this->client, \GuzzleHttp\json_decode($response->getBody())); |
|
| 131 | } |
|
| 132 | ||
| 133 | /** |
|
| 134 | * Channel details. |
|
| @@ 174-212 (lines=39) @@ | ||
| 171 | * @throws InvalidParameterException |
|
| 172 | * @throws ServerException |
|
| 173 | */ |
|
| 174 | public function createChannelWithId( |
|
| 175 | $endpoint, |
|
| 176 | $extension = null, |
|
| 177 | $context = null, |
|
| 178 | $priority = null, |
|
| 179 | $label = null, |
|
| 180 | $app = null, |
|
| 181 | $appArgs = null, |
|
| 182 | $callerId = null, |
|
| 183 | $timeout = null, |
|
| 184 | $channelId = null, |
|
| 185 | $otherChannelId = null, |
|
| 186 | $formats = null, |
|
| 187 | $variables = array() |
|
| 188 | ) { |
|
| 189 | $uri = "channels/$channelId"; |
|
| 190 | try { |
|
| 191 | $response = $this->client->getEndpoint()->post($uri, [ |
|
| 192 | 'form_params' => [ |
|
| 193 | 'endpoint' => $endpoint, |
|
| 194 | 'extension' => $extension, |
|
| 195 | 'context' => $context, |
|
| 196 | 'priority' => $priority, |
|
| 197 | 'label' => $label, |
|
| 198 | 'app' => $app, |
|
| 199 | 'appArgs' => $appArgs, |
|
| 200 | 'callerId' => $callerId, |
|
| 201 | 'timeout' => $timeout, |
|
| 202 | 'otherChannelId' => $otherChannelId, |
|
| 203 | 'formats' => $formats, |
|
| 204 | 'variables' => array_map('strval', $variables), |
|
| 205 | ] |
|
| 206 | ]); |
|
| 207 | } catch (RequestException $e) { |
|
| 208 | $this->processRequestException($e); |
|
| 209 | } |
|
| 210 | ||
| 211 | return new Channel($this->client, \GuzzleHttp\json_decode($response->getBody())); |
|
| 212 | } |
|
| 213 | ||
| 214 | /** |
|
| 215 | * Delete (i.e. hangup) a channel. |
|