Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify transport protocol when issuing connection #1323

Open
oz123 opened this issue Apr 25, 2023 · 10 comments
Open

Specify transport protocol when issuing connection #1323

oz123 opened this issue Apr 25, 2023 · 10 comments

Comments

@oz123
Copy link

oz123 commented Apr 25, 2023

I am running a coturn server using the following configuration:

TURNSERVER_ENABLED=1

fingerprint
listening-port=3478
log-file=/var/log/turnserver.log
simple-log

listening-ip=10.0.18.122
relay-ip=10.0.18.122
external-ip=X.YYY.242.48/10.0.18.122

Checking ICE servers it seems to work only if I specify the protocol:

image

It seems my application isn't working because there is no way to specify the connection protocol?

image

Here are the logs from the client:

image

@qwu16
Copy link
Collaborator

qwu16 commented Apr 26, 2023

Please download js sdk doc by clicking "Client SDK/Javascript*" in https://www.intel.com/content/www/us/en/developer/tools/webrtc-sdk/overview.html. In the unzipped document, Owt.Conference.ConferenceClient.html and Owt.Conference.ConferenceClientConfiguration.html describe related APIs

You can set the stun server address in ConferenceClientConfiguration when initializing ConferenceClient object:

new ConferenceClient(config, signalingImpl), where config can be set as:
// Following object can be set to conferenceClientConfiguration.rtcConfiguration.
{
iceServers: [{
urls: "stun:example.com:3478"
}, {
urls: [
"turn:example.com:3478?transport=udp",
"turn:example.com:3478?transport=tcp"
],
credential: "password",
username: "username"
}
}

@oz123
Copy link
Author

oz123 commented Apr 27, 2023

Thanks for your reply. With the code change you suggested I encountered an error. I did add the following:

// web-meeting/html/js/index.js
 createToken(roomId, localName, 'presenter', function(response) {                            
    var token = response;
    if (!room) {
      let ccOptions = {                                                                        
        rtcConfiguration: {                                                                    
            iceServers: [{
                urls: ['turn:aa.bb.yyy.xx:3478?transport=tcp',                                
                       'turn:aa.bb.yyy.xx:3478?transport=udp'],                                
                credential: 'sekret',
                username: 'user'
            }]  
         }  
      };
      let {                                                                                    
       ConferenceClient,                                                                      
       SioSignaling
      } = Owt.Conference;                                                                      
     
      let signaling = new SioSignaling({                                                      
        transports: ['websocket'],
      });
      room = new ConferenceClient(ccOptions, signaling);

With the suggested changes, I am still seeing the following error in the browser console:

ICE connection state changed to checking channel.js:486:11
WebRTC: ICE failed, add a STUN server and see about:webrtc for more details

@qwu16
Copy link
Collaborator

qwu16 commented Apr 27, 2023

Please set stun server in iceServers:

{
urls: "stun:example.com:3478"
}

stun server is needed for signaling, in your configuration, only turn server is set.

@oz123
Copy link
Author

oz123 commented Apr 27, 2023

Thank you for the quick reply, I added a public stun server:

      let ccOptions = {
        rtcConfiguration: {
            iceServers: [
            {urls: ["stun:stun3.l.google.com:19302"]},
            {
                
                urls: ['turn:aa.xx.yy.zz:3478?transport=tcp'],
                username: 'foobar'
                credential: 'blablupbla',

            }]
         }
      };
      room = new Owt.Conference.ConferenceClient(ccOptions);

Unfortunately, I still seening the same error.
I about:webrtc I see the following:

image

image

@qwu16
Copy link
Collaborator

qwu16 commented Apr 28, 2023

According to the console log, it seems turn server is broken. And in your ICE server testing snapshot, relay address is not displayed with your setting turn server, make sure your turn server could get the relay address in the ICE server testing.

@qwu16
Copy link
Collaborator

qwu16 commented Apr 28, 2023

BTW, check the stun server first, stun server is enough in most network. When you click "gather candidate" button in ice servers testing page, there should be no error message displayed below "gather candidate" button and according to the description in this page, validate stun/turn server by:

If you test a STUN server, it works if you can gather a candidate with type "srflx". If you test a TURN server, it works if you can gather a candidate with type "relay".

@oz123
Copy link
Author

oz123 commented Apr 28, 2023

Thanks for your reply. Assuming that my turn server is indeed not configured properly, I tries using a public stun
server.
It's not clear to me how to pass the configuration just with a stun server.

I tried with:

  createToken(roomId, localName, 'presenter', function(response) {
    var token = response;
    if (!room) {
      let ccOptions = {
        rtcConfiguration: {
            iceServers: [
            {urls: ["stun:stun3.l.google.com:19302"]}   ] } }

      room = new Owt.Conference.ConferenceClient(ccOptions);
      addRoomEventListener();
    }

Which results in:
image

@qwu16
Copy link
Collaborator

qwu16 commented Apr 28, 2023

In fact, you can keep turn server url in the configuration, stun server will be firstly used if it works well. I checked "stun:stun3.l.google.com:19302" in ice, it seems this stun server does not work well with following error:

Note: errors from onicecandidateerror above are not neccessarily fatal. For example an IPv6 DNS lookup may fail but relay candidates can still be gathered via IPv4.
The server stun:stun3.l.google.com:19302 returned an error with code=701:
STUN binding request timed out.
The server stun:stun3.l.google.com:19302 returned an error with code=701:
STUN binding request timed out.

We used to setup stun server with coturn in public network and it worked well. So check your coturn environment to make sure stun service work well.

@oz123
Copy link
Author

oz123 commented Apr 28, 2023

According to your previous comment, if I see a srflx candidate it works.

image

@oz123
Copy link
Author

oz123 commented Apr 28, 2023

I finally got some more information from my turn server:

      let ccOptions = {
        rtcConfiguration: {
            iceServers: [
            {urls: ["stun:stun3.l.google.com:19302"]}, // stun
            {urls: ["turn:xx.zz.118:3478"], username: "test", credential: "test123"}              

            ]  // iceServers
        } // rtcConfiguration
      } // ccOptions

on the turn server :

43: : session 003000000000000006: realm <> user <test>: incoming packet CREATE_PERMISSION processed, success
43: : session 003000000000000010: realm <> user <>: incoming packet message processed, error 401: Unauthorized
43: : session 002000000000000002: realm <> user <>: incoming packet message processed, error 401: Unauthorized
43: : session 000000000000000006: realm <> user <>: incoming packet message processed, error 401: Unauthorized
43: : session 001000000000000004: peer 10.0.6.178 lifetime updated: 300
43: : session 001000000000000004: realm <> user <test>: incoming packet CREATE_PERMISSION processed, success
43: : IPv4. Local relay addr: 45.134.226.118:14967
43: : session 000000000000000006: new, realm=<>, username=<test>, lifetime=3600
43: : session 000000000000000006: realm <> user <test>: incoming packet ALLOCATE processed, success
43: : session 003000000000000005: peer 10.0.6.178 lifetime updated: 300
43: : session 003000000000000005: realm <> user <test>: incoming packet CREATE_PERMISSION processed, success
43: : session 003000000000000006: peer 10.0.6.178 lifetime updated: 300
43: : session 003000000000000006: realm <> user <test>: incoming packet CREATE_PERMISSION processed, success
43: : session 000000000000000004: realm <> user <>: incoming packet message processed, error 401: Unauthorized
43: : session 001000000000000004: peer 10.0.6.178 lifetime updated: 300
43: : session 001000000000000004: realm <> user <test>: incoming packet CREATE_PERMISSION processed, success
43: : session 003000000000000009: realm <> user <>: incoming packet message processed, error 401: Unauthorized
43: : session 000000000000000005: realm <> user <>: incoming packet message processed, error 401: Unauthorized
43: : session 003000000000000010: realm <> user <>: incoming packet message processed, error 401: Unauthorized
43: : session 001000000000000003: realm <> user <>: incoming packet message processed, error 401: Unauthorized

Why is succeeding and then getting 401?

Also on the ICE page I don't have this problem. So is it just my client?

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants