Help getting started with secure IP Cam streaming

Max

Administrator
Staff member
The stream will be played if add this setting to WCS_HOME/conf/flashphoner.properties
Code:
rtp_force_synchronization =true
Restart WCS server to apply the configuration change.
 

Julien

Member
Hi, setting rtp_force_synchronization worked, thank you.

Now i've been struggling to make my app work with Edge, Edge works fine with your demos, but didn't with my app, and i have finally found where the problem is.
If i create a session without passing ICE server options, it works fine in Edge, but with ICE servers, it doesn't work in Edge. I do it as follows:
Code:
Flashphoner.createSession({
    urlServer: 'xxxx',
    appKey: 'xxxx'
    custom: {xxxx},
    mediaOptions: {
      "iceServers": [{"urls":"turn:xxx", "username"=>"xxx", "credential"=>"xxx"}],
      "iceTransportPolicy": "relay"
    }
  })
It works fine with the ICE servers in the other browsers except for Edge, any idea why and how to fix this?
 

Max

Administrator
Staff member
Would it work if change '=>' to ':'?
Code:
"iceServers": [{"urls":"turn:xxx", "username":"xxx", "credential":"xxx"}]
Please confirm if Firewall Streaming demo does work.
 

Julien

Member
Would it work if change '=>' to ':'?
Sorry that was just a typo.
The firewall streaming demo works, i have done several more tests and it seems that Edge doesn't like the ICE servers array that i am providing.
Using the one from the firewall demo it works, but trying with the one i receive from Twilio it doesn't work. Here's an example of what the array looks like:
Code:
"iceServers": [
                {
                    urls:"stun:global.stun.twilio.com:3478?transport=udp"
                },
                {
                    urls:"turn:global.turn.twilio.com:3478?transport=udp",
                    username:"e2d3f46d141c1ab4208d815c8018e44a56385608ecae535071ba7eecb9e6b529",
                    credential:"5j7LiWxxWS9gSsQDNbqQ8Tuew4sTEo2cBj/W1jf83SA="
                },
                {
                    urls:"turn:global.turn.twilio.com:3478?transport=tcp",
                    username:"e2d3f46d141c1ab4208d815c8018e44a56385608ecae535071ba7eecb9e6b529",
                    credential:"5j7LiWxxWS9gSsQDNbqQ8Tuew4sTEo2cBj/W1jf83SA="
                },
                {
                    urls:"turn:global.turn.twilio.com:443?transport=tcp",
                    username:"e2d3f46d141c1ab4208d815c8018e44a56385608ecae535071ba7eecb9e6b529",
                    credential:"5j7LiWxxWS9gSsQDNbqQ8Tuew4sTEo2cBj/W1jf83SA="
                }
            ]
This array works fine with the other browsers but doesn't with Edge. Doing further testing i found out that once i remove the first entry (the STUN address), it finally works in Edge, so the problem is clearly from that entry. I don't know if its because its STUN or because it is an entry without username / credential properties but clearly this should work and doesn't.
Any idea how to solve this?

Note: Those Twilio credentials are only valid for a short time so they will most likely have expired by the time you see them in case you decide to try them.
Note 2: I'm using urls instead of url as the property name for each ice server to avoid the WebRTC warnings in the console, but i have also tried using just url and get the same results mentioned above.
 

Julien

Member
Ah yes, Microsoft torturing developers since 1975.. :D
Ok for now i am just removing the STUN entry before passing it to the session when Edge is detected.
Thanks for all the help, i will start porting another app soon that is a bit different so i might have some questions in the future but i'll start a new thread when the time comes.
Thanks again!
 

Julien

Member
Hi again,
sorry to reopen this thread, i just have a quick question, it happened twice already that i couldn't get the streams working, one time the connection could not be established, and trying to connect to the dashboard was just showing a white error page (white label error i think), once i restarted webcallserver it started working fine again.

The second time it was connecting fine but the stream would not start playing. Looking in the logs i saw the following error:
Code:
11:27:22,977 ERROR         MediaHandler - pool-49-thread-1 publishStream exception 
com.flashphoner.server.license.manager.exception.LicensePeriodIsExpired: License period is expired Wed Nov 15 11:27:22 UTC 2017 Wed Jan 31 00:00:00 UTC 2018 Wed Jan 01 00:00:00 UTC 3000
    at com.flashphoner.server.license.manager.A.A.D.check(Unknown Source)
    at com.flashphoner.server.license.manager.LicenseManager.check(Unknown Source)
    at com.flashphoner.server.client.handler.wcs4.MediaHandler.createMediaSession(Unknown Source)
    at com.flashphoner.server.client.handler.wcs4.MediaHandler.publishStream(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.flashphoner.server.client.handler.MediaHandlerProxyCreator$MediaHandlerInvocationHandler.invoke(Unknown Source)
    at com.flashphoner.server.client.handler.wcs4.WCS4Handler_$$_jvst66e_0.publishStream(WCS4Handler_$$_jvst66e_0.java)
    at com.flashphoner.server.G.E.A(Unknown Source)
    at com.flashphoner.D.B.messageReceived(Unknown Source)
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(Unknown Source)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(Unknown Source)
    at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(Unknown Source)
    at org.jboss.netty.channel.Channels.fireMessageReceived(Unknown Source)
    at org.jboss.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(Unknown Source)
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(Unknown Source)
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(Unknown Source)
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(Unknown Source)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(Unknown Source)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(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.AbstractNioWorker.run(Unknown Source)
    at org.jboss.netty.channel.socket.nio.NioWorker.run(Unknown Source)
    at org.jboss.netty.util.ThreadRenamingRunnable.run(Unknown Source)
    at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:748)
Looks like it is complaining about the license being expired even though it is not, again i just restarted webcallserver and it started working fine again. Not sure that this error was related since it was not showing up in the logs for every attempt at streaming that i did.

How can i debug this to know why this is happening, and how can i get somehow notified as soon as the server is not working correctly so that i know i have to restart it?
By the way, does webcallserver restarts automatically if it crashes?

Note: if you need to connect to my server to check the logs, the credentials i sent you are still active.

thanks!
 

Max

Administrator
Staff member
Hello
The trial license can do external checks to synchronize time.
If such a check was failed by any reason, it can raise similar error even if it is really not expired.
So you can either do wcs restart or purchase a commercial license that does not have such time checks.
 

Julien

Member
Ok that would explain why it only showed up once in the log, but what about the rest? One of the times the server was simply unreachable. How can i debug that?
Does the server restarts by itself if it crashes?
How can i get notified as soon as the server is not working correctly so that i know i have to restart it? Or maybe there is a way automate checking if the server is working correctly?
 

Max

Administrator
Staff member
Hello

Try to setup watchdog as described in the docs:
https://flashphoner.com/docs/wcs5/w..._subsystem_of_server_availability_control.htm
https://flashphoner.com/docs/wcs5/w...gs-the_conf_directory-watchdog_properties.htm

Here you can see example of WCS_HOME/conf/watchdog.properties configured on our server:
Code:
wcs_core_pid=/var/run/FlashphonerMainWebCallServer.pid
client.jmx_port=50999
client.jmx_login=admin
client.jmx_password=admin
client.max_failure_count=2
client.handle_failure_interval=60000
client.failure_check_interval=60000
client.notification.email=support@flashphoner.com
client.notify_only=false
watchdog_events=CoreProcessDown
on_watchdog_event=watchdog_event_hook.sh
watchdog_autorun=true
server.registration.credentials=login:login,authenticationName:authenticationName,password:password,domain:domain,outboundProxy:outboundProxy,port:5060
server.registration.credentials.delimiter1=,
server.registration.credentials.delimiter2=:
#sendmail_script=watchdog_mail_script.sh
mail.smtp.auth=true
mail.smtp.starttls.enable=true
mail.smtp.host=smtp.gmail.com
mail.smtp.port=587
mail.username=watchdog@flashphoner.com
mail.password=12345
So when server core process is down watchdog will send e-mail notification to {client.notification.email} then restart WCS server.
 

Max

Administrator
Staff member
If you set
Code:
client.notify_only=true
Watchdog will just send notification. It will not fix issue using server core restart.
If you have outage it looks ubnormal. Please send us SSH access again. We will investigate the cause of issues.
 
Top