-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #344 from opentok/feature/sip-dial-streams
Feature/sip dial streams
- Loading branch information
Showing
3 changed files
with
44 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1123,6 +1123,9 @@ public function listStreams($sessionId) | |
* on PSTN phones. If from is undefined or set to a string (for example, "[email protected]"), | ||
* +00000000 will show up as the incoming number on PSTN phones.</li> | ||
* | ||
* <li><code>'streams'</code> (array) — The Stream IDs of the participants which will included in the SIP | ||
* call. If not provided, all streams in session will be selected.</li> | ||
* | ||
* </ul> | ||
* | ||
* @return SipCall An object contains the OpenTok connection ID and stream ID | ||
|
@@ -1140,7 +1143,8 @@ public function dial($sessionId, $token, $sipUri, $options = []) | |
'secure' => true, | ||
'from' => null, | ||
'video' => false, | ||
'observeForceMute' => false | ||
'observeForceMute' => false, | ||
'streams' => null | ||
); | ||
|
||
$options = array_merge($defaults, array_intersect_key($options, $defaults)); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2402,6 +2402,40 @@ public function testSipCallVideo(): void | |
$this->assertEquals(true, $body->sip->video); | ||
} | ||
|
||
public function testSipCallStreams(): void | ||
{ | ||
$this->setupOTWithMocks([[ | ||
'code' => 200, | ||
'headers' => [ | ||
'Content-Type' => 'application/json' | ||
], | ||
'path' => 'v2/project/APIKEY/dial' | ||
]]); | ||
|
||
$sessionId = '1_MX4xMjM0NTY3OH4-VGh1IEZlYiAyNyAwNDozODozMSBQU1QgMjAxNH4wLjI0NDgyMjI'; | ||
$bogusToken = 'T1==TEST'; | ||
$bogusSipUri = 'sip:[email protected]'; | ||
|
||
$options = [ | ||
'video' => true, | ||
'streams' => ['stream1', 'stream2'] | ||
]; | ||
|
||
$sipCall = $this->opentok->dial($sessionId, $bogusToken, $bogusSipUri, $options); | ||
|
||
$this->assertInstanceOf('OpenTok\SipCall', $sipCall); | ||
$this->assertNotNull($sipCall->id); | ||
$this->assertNotNull($sipCall->connectionId); | ||
$this->assertNotNull($sipCall->streamId); | ||
|
||
$this->assertCount(1, $this->historyContainer); | ||
$request = $this->historyContainer[0]['request']; | ||
|
||
$body = json_decode($request->getBody()); | ||
$this->assertEquals(true, $body->sip->video); | ||
$this->assertEquals('stream1', $body->sip->streams[0]); | ||
} | ||
|
||
public function testSipCallVideoWithObserveForceMute(): void | ||
{ | ||
$this->setupOTWithMocks([[ | ||
|