@@ -1232,5 +1232,43 @@ public function testFailedSipCall()
12321232 $ this ->assertNull ($ sipCall );
12331233 }
12341234 }
1235+
1236+ public function testSipCallFrom ()
1237+ {
1238+ // Arrange
1239+ $ mock = new MockPlugin ();
1240+ $ response = MockPlugin::getMockFile (
1241+ self ::$ mockBasePath . 'v2/project/APIKEY/dial '
1242+ );
1243+ $ mock ->addResponse ($ response );
1244+ $ this ->client ->addSubscriber ($ mock );
1245+
1246+ $ sessionId = '1_MX4xMjM0NTY3OH4-VGh1IEZlYiAyNyAwNDozODozMSBQU1QgMjAxNH4wLjI0NDgyMjI ' ;
1247+ $ bogusApiKey = '12345678 ' ;
1248+ $ bogusApiSecret = '0123456789abcdef0123456789abcdef0123456789 ' ;
1249+ $ bogusToken = 'T1==TEST ' ;
1250+ $ bogusSipUri =
'sip:[email protected] ' ;
1251+ $ opentok = new OpenTok ($ bogusApiKey , $ bogusApiSecret );
1252+
1253+ 1254+
1255+ // Act
1256+ $ sipCall = $ this ->opentok ->dial ($ sessionId , $ bogusToken , $ bogusSipUri , array (
1257+ 'from ' => $ from
1258+ ));
1259+
1260+ // Assert
1261+ $ this ->assertInstanceOf ('OpenTok\SipCall ' , $ sipCall );
1262+ $ this ->assertNotNull ($ sipCall ->id );
1263+ $ this ->assertNotNull ($ sipCall ->connectionId );
1264+ $ this ->assertNotNull ($ sipCall ->streamId );
1265+
1266+ $ requests = $ mock ->getReceivedRequests ();
1267+ $ this ->assertCount (1 , $ requests );
1268+ $ request = $ requests [0 ];
1269+
1270+ $ body = json_decode ($ request ->getBody ());
1271+ $ this ->assertEquals ($ from , $ body ->sip ->from );
1272+ }
12351273}
12361274/* vim: set ts=4 sw=4 tw=100 sts=4 et :*/
0 commit comments