SIP phone is working, Video Demos are not

marcw

Member
Hello!

Since ages I am using the WCS for managing SIP phone calls. Also on the default demo dashboard I can use the SIP phone demo successfully. Also for ages I did not use any video streaming with the WCS (I think I did it successfully some years ago but I am not totally sure). But for a new project I need the video streaming functionality. But it is not working. I can see the local preview streaming from my webcam. Clicking on "connect" and/or "start" returns "established" but the remote window stays empty. I tried it with three different browsers. In the server ogs I found

02:32:52,649 ERROR HttpServerHandler - HTTPS-pool-5-thread-82 HTTP error
javax.net.ssl.SSLException: not an SSL/TLS record: 474554202f20485454502f312e310d0a486f73743a206a756c69652d6d616c657265692e64650d0a557365722d4167656e743a20457870616e736520696e646578657320746865206e6574776f726b20706572696d6574657273206f66206f757220637573746f6d6572732e20496620796f75206861766520616e79207175657374696f6e73206f7220636f6e6365726e732c20706c65617365207265616368206f757420746f3a207363616e696e666f40657870616e7365696e632e636f6d0d0a0d0a
at org.jboss.netty.handler.ssl.SslHandler.decode(Unknown Source)
at org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode(Unknown Source)
at org.jboss.netty.handler.codec.frame.FrameDecoder.messageReceived(Unknown Source)
at org.jboss.netty.channel.Channels.fireMessageReceived(Unknown Source)
at org.jboss.netty.channel.Channels.fireMessageReceived(Unknown Source)
at org.jboss.netty.channel.socket.nio.NioWorker.read(Unknown Source)
at org.jboss.netty.channel.socket.nio.AbstractNioWorker.processSelectedKeys(Unknown Source)
at org.jboss.netty.channel.socket.nio.DeadlockAwareNioWorker.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
02:32:54,533 DEBUG sipMessages - Flashphoner-SipStack-Timer


Okay, that sounds to be a SSL problem. But what exactlly? My domain is marcophono.com and the SSL certificate is correctly installed. Through the flashphoner dashboard I have uploaded the full cert and the private key also successfully. So I have no idea at the moment how to solve this issue.

Best regards
Marc
 

Max

Administrator
Staff member
Good day.
Please provide SSH access to the server and access to WCS dashboard using this form, we will check.
 

Max

Administrator
Staff member
We checked your server.
The issue is in your REST hook /connect implementation: you always add SIP credentials to register on SIP PBX. In this case, websocket session is intended to SIP calls only, not for streaming.
The solution is to divide REST hook application to one for SIP calls and one for WebRTC streaming, for example appSIP and appStreaming
Code:
add app appSIP appSIP "http://server/rest-hooks-sip"
add app appStreaming appStreaming "http://server/rest-hooks-stream"
The http://server/rest-hooks-stream endpoint should only check domain (we see you're using REST hooks for this task), but should not add any SIP options.
Then you should use those application when creating a session:
For SIP calls:
Code:
connectionOptions = {
            urlServer: url,
            sipOptions: sipOptions,
            keepAlive: false,
            appKey: "appSIP"
        };
Flashphoner.createSession(connectionOptions).on(SESSION_STATUS.ESTABLISHED, function(session, connection){
    ...
});
For streaming:
Code:
connectionOptions = {
            urlServer: url,
            appKey: "appStreaming"
        };
Flashphoner.createSession(connectionOptions).on(SESSION_STATUS.ESTABLISHED, function(session, connection){
    ...
});
 

marcw

Member
Hello!

I could bring all to work on my product server. But I have (other) issues on a development server where a trial version of WCS 5.2.1085 is running on. When I use one of the video demos the preview window displays the webcam's view but the remote window stays empty. I have attached the WCS log file. In the error logs of my nginx webserver I found

2021/11/23 01:41:05 [error] 10061#10061: *104 FastCGI sent in stderr: "PHP message: PHP Notice: Only variables should be passed by reference in /var/www/nettesviertel.de/html/rest-hooks/index.php on line 2" while reading response header from upstream, client: 127.0.0.1, server: nettesviertel.de, request: "POST /rest-hooks/ConnectionStatusEvent HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.3-fpm.sock:", host: "nettesviertel.de"
2021/11/23 01:41:16 [error] 10061#10061: *106 FastCGI sent in stderr: "PHP message: PHP Notice: Only variables should be passed by reference in /var/www/nettesviertel.de/html/rest-hooks/index.php on line 2PHP message: sessionId: /176.199.250.52:50696/168.119.39.80:8443-18d36884-1a40-4676-9816-1a79a339fcdfPHP message: origin: https://nettesviertel.de:8888PHP message: User authorized by domain nettesviertel.de" while reading response header from upstream, client: 127.0.0.1, server: nettesviertel.de, request: "POST /rest-hooks/connect HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.3-fpm.sock:", host: "nettesviertel.de"
2021/11/23 01:41:16 [error] 10061#10061: *108 FastCGI sent in stderr: "PHP message: PHP Notice: Only variables should be passed by reference in /var/www/nettesviertel.de/html/rest-hooks/index.php on line 2" while reading response header from upstream, client: 127.0.0.1, server: nettesviertel.de, request: "POST /rest-hooks/ConnectionStatusEvent HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.3-fpm.sock:", host: "nettesviertel.de"
2021/11/23 01:41:18 [error] 10061#10061: *110 FastCGI sent in stderr: "PHP message: PHP Notice: Only variables should be passed by reference in /var/www/nettesviertel.de/html/rest-hooks/index.php on line 2" while reading response header from upstream, client: 127.0.0.1, server: nettesviertel.de, request: "POST /rest-hooks/publishStream HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.3-fpm.sock:", host: "nettesviertel.de"

Not sure if that says something.

I am on a Debian 10 with nginx.

Best regards
Marc
 

Attachments

Max

Administrator
Staff member
PHP message: PHP Notice: Only variables should be passed by reference in /var/www/nettesviertel.de/html/rest-hooks/index.php on line 2
Please check line 2 of your index.php script, may be you're passing array to a function.
When I use one of the video demos the preview window displays the webcam's view but the remote window stays empty.
In the log we see that stream is not publishing due to NPE
Code:
01:57:08,866 ERROR         MediaHandler - API-ASYNC-pool-7-thread-119 publishStream exception 
java.lang.NullPointerException
    ...
01:57:08,866 ERROR monStatSamplerThread - API-ASYNC-pool-7-thread-119 Can not create CommonStatSamplerThread instance: null
java.lang.NullPointerException
Please check if /usr/local/FlashphonerWebCallServer/conf/database.yml file exists and is not empty or corrupted. If so, restore it from distribution package and then re-add your REST hook application.
If this didn't help, please provide SSH access to the server using this form.
 

Max

Administrator
Staff member
We checked your server.
About PHP warning: the reason is here:
Code:
$api_method = array_pop(explode("/", $_SERVER['REQUEST_URI']));
Just replace it to
Code:
$request_uri = $_SERVER['REQUEST_URI'];
$api_method = array_pop(explode("/", $request_uri));
and warning should not appear again.
About publishing: seems like database.yml file or flashponer.license file has a wrong permissions. Since build 5.2.864, WCS is running from user flashphoner for security reasons. So permissions should be fixed if file was modified or copied by other user (root for example). We stopped WCS, fixed the permissions and started again
Code:
systemctl stop webcallserver
/usr/local/FlashphonerWebCallServer/bin/webcallserver set-permissions
systemctl start webcallserver
Now, WebRTC publishing and playback seems working.
 

marcw

Member
Oooh! Wonderful! Thank you so much! Such a wonderful piece of technology! (and wonderful people behind it!)

Best regards
Marc
 

Max

Administrator
Staff member
Good day.
To someone who sent its report from this topic (Marc, this is definitely not you): please register and create your own topic so we can answer you. Two tips:
1. Your A record points to a different IP address, not to WCS instance.
2. You should import SSL certificate to WCS storage as described here.
 
Top