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