Rest hook validation on version 5.2.791 broken WebRTC in iPhone

Michael

New Member
After updating to the version 5.2.791 the WebRTC publish and play events on iPhone stopped working if we enable rest hook validation. Flashphoner creates the session but throws STREAM_STATUS.FAILED. Our rest validation is returning http 200. Same rest validation is working on Android and Desktop. Same rest validation is working on version 5.2.479. If we disable the rest validation (disable_rest_requests=true) iPhone publish and play events works. There is no error in the log, it shows as the session was normally terminated.

We have experienced same results in your test application. If we disable_rest_requests=true works, if we enable rest, it does not works.

Sample code:

Code:
var custom_data = {ourhash: "abcdefghijklmnopqrstuvxz"};
var url = 'wss://ourdomain.com:8443';
var stream_name = 'test';
var container = document.getElementById('player');
var PRELOADER_URL = "../../dependencies/media/preloader.mp4";
Flashphoner.playFirstVideo(container, true, PRELOADER_URL).then(function () {
    var connect_options = {
        urlServer: url,
        custom: custom_data,
        appKey: 'myApp'
    };
    session = Flashphoner.createSession(connect_options).on(SESSION_STATUS.ESTABLISHED, function(session){
           alert("Session created");
           var stream_options = {
            name: stream_name,
            display: container,           
            cacheLocalResources: true,
            custom: custom_data,
            transport: "TCP"           
        };
           session.createStream(stream_options).on(STREAM_STATUS.PUBLISHING, function(publishStream){
            alert("Publish started");       
        }).on(STREAM_STATUS.UNPUBLISHED, function(){
            alert("Publish stoped");
        }).on(STREAM_STATUS.FAILED, function(stream){
           alert("Publish failed");
        }).publish();     
    }).on(SESSION_STATUS.DISCONNECTED, function(){
       alert("Session disconnected");
    }).on(SESSION_STATUS.FAILED, function(){
        alert("Session failed");
    });
});
Any idea?
 

Max

Administrator
Staff member
Good day.
We cannot reproduce the issue on iOS Safari (iOS 12.4.8 and iOS 14.0.1) with REST hook application just echoing request with 200 OK response.
Please check if the issue can be reproduced using Two Way Streaming example. If not, please modify TwoWay Streaming application code minimally to reproduce the issue and send this code example to us with this form.
Also please collect a report as described here and send us using this form. Please make sure that INFO log level is enabled in log4j.properties file
Code:
log4j.rootLogger=info, stdout, fAppender
 

Max

Administrator
Staff member
This is what we can see from logs
Code:
11:57:08 INFO webrtc - {"audio":true,"video":{"width":{"min":320,"max":640},"height":{"min":240,"max":480},"frameRate":{"ideal":30}}}
Try to disable normalization and set constraints as ideal
Code:
publishStream = session.createStream({
    ...
    disableConstraintsNormalization: true,
    constraints {
        video: {
            width: {ideal: 640},
            height: {ideal: 480}
        },
        audio: true
    }
}).on(STREAM_STATUS.PUBLISHING, function (publishStream) {
    ...
});
publishStream.publish();
 

Michael

New Member
This is what we can see from logs
Code:
11:57:08 INFO webrtc - {"audio":true,"video":{"width":{"min":320,"max":640},"height":{"min":240,"max":480},"frameRate":{"ideal":30}}}
Try to disable normalization and set constraints as ideal
Code:
publishStream = session.createStream({
    ...
    disableConstraintsNormalization: true,
    constraints {
        video: {
            width: {ideal: 640},
            height: {ideal: 480}
        },
        audio: true
    }
}).on(STREAM_STATUS.PUBLISHING, function (publishStream) {
    ...
});
publishStream.publish();
We did as you suggested, but the issue persist.

We send the logs information of this new test as you suggested on your previous comments, by this form.
We have used the 2 way streaming example on this log report, just with disableConstraintsNormalization:true and constraints changes matching your example.

Seems not related with constraints, since the issue happens on viewer to play a stream too.

Just to clarify:
  • We are validating this events at database.yml: myApp: [connect, ConnectionStatusEvent, publishStream, playRTSP, playStream, playHLS]
  • The streamings are working normally for windows and android to publish and play with hook validation turned on or off
  • The streamings do not work on Iphone with hook validation turned on (publish or play). At 2 way streaming demo, shows "Failed by DTLS error". What it means?
  • The streamings just work on Iphone when we turn of hook validation with the disable_rest_requests=true option
  • We simplified the validation for this test, just to return a json {"ok":"ok"} with http status 200 in every request
  • We already have tried with the url http://localhost:8081/apps/EchoApp, but the issue persist
  • This issue started once we upgrade the Server from the version 5.2.479 to 5.2.791

This is our server log at the report we had send:
Code:
[21/Oct/2020:16:58:13 -0400] "POST /connect HTTP/1.0" 200 38 0.0029
[21/Oct/2020:16:58:13 -0400] "POST /ConnectionStatusEvent HTTP/1.0" 200 38 0.0024
[21/Oct/2020:16:58:19 -0400] "POST /publishStream HTTP/1.0" 200 38 0.0026
[21/Oct/2020:16:58:23 -0400] "POST /playStream HTTP/1.0" 200 38 0.0024
[21/Oct/2020:16:58:33 -0400] "POST /publishStream HTTP/1.0" 200 38 0.0018
[21/Oct/2020:16:58:38 -0400] "POST /publishStream HTTP/1.0" 200 38 0.0019
[21/Oct/2020:16:58:42 -0400] "POST /ConnectionStatusEvent HTTP/1.0" 200 38 0.0016
Print screen of 2 way streaming example on the report logs:
Device: Iphone X
OS: IOS 13.5.1
Browser: Safari 13.5

IMG_0042 (1).jpg
 

Max

Administrator
Staff member
The streamings do not work on Iphone with hook validation turned on (publish or play). At 2 way streaming demo, shows "Failed by DTLS error". What it means?
This means DTLS connection establishing error, usually due to port forwarding or blocking issues.
We cannot see any traces of sending and receiving HTTP requests to and from backend in server logs.
Please provide us SSH access to your staging server, we'll check the configuration and try to reproduce the issue with default backend. You can send SSH credentials using this form.
 

Michael

New Member
Hello,

We have generated the logs again in production env to include the HTTP requests.

We already send this report at that form you requested.

Can you check?

Thanks
 

Max

Administrator
Staff member
REST hook authentication itself passes correctly (otherwise, no STUN connection is performed).
Seems like backend server is in docker or something. Please try the following^
1. Exclude external network from backend interaction (use local address to connect to REST hook application)
2. Add the following parameter to flashphoner.properties
Code:
rtc_ice_add_local_interface=true
3. Check and clean up iptables settings
If nothing hepls, please provide us SSH access to your staging server, we'll check the configuration and try to reproduce the issue with default backend. You can send SSH credentials using this form.
 
Top