4

Recently I tried to use OpenTok's WebRTC demo for a web application requiring peer-to-peer video/audio communication.

I went through the tutorials on http://www.tokbox.com/opentok/webrtc/docs/js/tutorials/ and http://www.tokbox.com/opentok/docs/server/server_side_libraries.html and I got something working using JavaScript (client-side) and PHP's library (server-side) for token/session generation.

I managed to code a basic peer-to-peer chat room locally. However, as soon as I upload it to a web server it blows up returning the following error:

Fatal error: Uncaught exception 'RequestException' with message 'Request error: Failed
to connect to 70.42.47.98: Permission denied' in /home/www/dummy_url.com/php-
sdk/SDK/Opentok-PHP-SDK/OpenTokSDK.php:192 Stack trace: #0 /home/www/dummy_url.com/php-
sdk/SDK/Opentok-PHP-SDK/OpenTokSDK.php(107): OpenTokSDK->_do_request('/session/create',
Array) #1 /home/www/dummy_url.com/php-sdk/SDK/Opentok-PHP-SDK/OpenTokSDK.php(221): 
OpenTokSDK->createSession('74.96.245.119', Array) #2 /home/www/dummy_url.com/php-
sdk/index.php(16): OpenTokSDK->create_session('74.96.245.119', Array) #3 {main} thrown
in /home/www/dummy_url.com/php-sdk/SDK/Opentok-PHP-SDK/OpenTokSDK.php on line 192

I took a look at line 192:

//die(function_exists('curl_version')); // debugging
$res = curl_exec($ch);
if(curl_errno($ch)) {
    throw new RequestException('Request error: ' . curl_error($ch)); // <=== LINE 192
}
curl_close($ch);

and verified the server had curl enabled. It does.

Then I tried to run the demo test and it fails at:

Assertion Failed: File '/home/www/skillfullearning.net/test/test/TestOpenTokSDK.php'
Line '102'
Code ''

What's in Line '102'? This:

...
$token = $a->generateToken("mysession", RoleConstants::MODERATOR, gmmktime() + 100000);
assert('$token');

$token = $a->generateToken("mysession", RoleConstants::MODERATOR, gmmktime());
assert('$token');

try {
$token = $a->generateToken("mysession", RoleConstants::MODERATOR, gmmktime() + 
1000000);
assert(false);
} catch (Exception $e) {
assert('$e'); // <================ LINE 102
}
...

I really don't know where to go from here. I would really appreciate some help with this matter.

/E

ecr
  • 391
  • 1
  • 3
  • 7
  • 1
    your remote host might be blocking socket connections – DevZer0 Jul 17 '13 at 02:36
  • Thanks for the response, @DevZer0. How could I verify this is in fact happening? I have the feeling that could be it since it's not allowing me to generate session id and token from server side library. However, it runs perfectly when I generate session it and token from opentok.com and just hard code it into my file. Thanks again, sir. – ecr Jul 26 '13 at 03:27

1 Answers1

3

The error is caused by outdated tests. Here is an outstanding issue, hopefully it will be resolved soon. if you simply remove the test files, you would not have that problem anymore.

songz
  • 2,082
  • 1
  • 14
  • 18
  • Unfortunately, that didn't solve my problem. Please, refer to this [comment](http://stackoverflow.com/questions/17690086/unable-to-run-opentoks-webrtc-demo#comment26096660_17690086). The problem is I cannot generate session ids nor tokens from php's server side library. Any other ideas? Thanks! – ecr Jul 31 '13 at 01:21