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

STUN/TURN Server to make video call #1925

Closed
diegobill opened this issue Aug 10, 2017 · 11 comments
Closed

STUN/TURN Server to make video call #1925

diegobill opened this issue Aug 10, 2017 · 11 comments
Assignees

Comments

@diegobill
Copy link

Related issue with client xmpp : jsxc/jsxc#583

What version of ejabberd are you using?
Version: 16.01-2

What operating system (version) are you using?
Ubuntu 16.04 Desktop amd64

How did you install ejabberd (source, package, distribution)?
package

What did not work as expected? What was the unexpected behavior?
I can not make a video call between two clients via stun/turn server

What was the expected result?
I can make a video call between two clients via stun/turn server. When the clients in the same network the problem does not happens

Client config:

RTCPeerConfig: {
         /** Time-to-live for config from url */
         ttl: 3600,

         /** [optional] If set, jsxc requests and uses RTCPeerConfig from this url */
         url: null,

         /** If true, jsxc send cookies when requesting RTCPeerConfig from the url above */
         withCredentials: false,

         /** ICE servers like defined in http://www.w3.org/TR/webrtc/#idl-def-RTCIceServer */
         iceServers: [{
            urls: 'stun:'+localStorage["JABBER_IP"],
         },{
            urls: 'stun:'+localStorage["JABBER_IP"]+':3478',
         }
         ,{
            urls: 'turn:'+localStorage["JABBER_IP"]+':3478?transport=udp',
            username: 'LOGIN',
            credential: 'PASSWORD',
            credentialType: 'password'
         },
         {
            urls: 'turn:'+localStorage["JABBER_IP"]+':3478?transport=tcp',
            username: 'LOGIN',
            credential: 'PASSWORD',
            credentialType: 'password'
         }
         ]
      }

/etc/ejabberd/ejabberd.yml :

  -
    port: 3478
    transport: udp
    user_turn: true
    turn_ip: "10.67.125.28"
    module: ejabberd_stun
    certfile: "/etc/ejabberd/ejabberd.pem"
    auth_type: anonymous

  -
    port: 3478
    transport: tcp
    user_turn: true
    turn_ip: "10.67.125.28"
    module: ejabberd_stun
    certfile: "/etc/ejabberd/ejabberd.pem"
    auth_type: anonymous

Are there error messages in the log ?

Nothing printed in /var/log/ejabberd/error.log, but this is the /var/log/ejabberd/ejabberd.log with info and debug messages:

https://drive.google.com/open?id=0BwWxTurDNQ47TzdQR0tDcEp4WVU

XMPP Client log (JSXC):

> <body rid=​"2114991485" xmlns=​"http:​/​/​jabber.org/​protocol/​httpbind" sid=​"b2c40521759182ee1fb03a52e5f8f39311f47e4e">​</body>​
jsxc.js:1223 < <body xmlns=​"http:​/​/​jabber.org/​protocol/​httpbind">​</body>​
jsxc.js:1226 > <body rid=​"2114991486" xmlns=​"http:​/​/​jabber.org/​protocol/​httpbind" sid=​"b2c40521759182ee1fb03a52e5f8f39311f47e4e">​</body>​
jsxc.js:1223 < <body xmlns=​"http:​/​/​jabber.org/​protocol/​httpbind">​<iq xmlns=​"jabber:​client" from=​"02712124383@10.67.125.28/​1155396996667267226156489642346183031844098824391575475675" to=​"02633223354@10.67.125.28/​1560928211242866028599368404399127563701010324836150290726" type=​"set">​…​</iq>​</body>​
jsxc.js:165 [JINGLE][log:debug] 528365d6-0bfd-4930-906d-daf4aef99154: session-initiate
jsxc.js:165 [JINGLE][log:info] 528365d6-0bfd-4930-906d-daf4aef99154: Initiating incoming session
jsxc.js:165 [JINGLE][log:info] 528365d6-0bfd-4930-906d-daf4aef99154: Changing session state to: pending
jsxc.js:183 incoming call from 02712124383@10.67.125.28/1155396996667267226156489642346183031844098824391575475675
jsxc.js:165 [JINGLE][log:info] 528365d6-0bfd-4930-906d-daf4aef99154: Ringing on incoming session
jsxc.js:165 [JINGLE][log:info] 528365d6-0bfd-4930-906d-daf4aef99154: Stream added
jsxc.js:165 [Webrtc] Remote stream for session 528365d6-0bfd-4930-906d-daf4aef99154 added.
jsxc.js:165 [Webrtc] Use remote video device.
jsxc.js:165 [Webrtc] Use remote audio device.
jsxc.js:1226 > <body rid=​"2114991487" xmlns=​"http:​/​/​jabber.org/​protocol/​httpbind" sid=​"b2c40521759182ee1fb03a52e5f8f39311f47e4e">​…​</body>​
jsxc.js:1223 < <body xmlns=​"http:​/​/​jabber.org/​protocol/​httpbind">​<iq xmlns=​"jabber:​client" from=​"02712124383@10.67.125.28/​1155396996667267226156489642346183031844098824391575475675" to=​"02633223354@10.67.125.28/​1560928211242866028599368404399127563701010324836150290726" type=​"set">​…​</iq>​<iq xmlns=​"jabber:​client" from=​"02712124383@10.67.125.28/​1155396996667267226156489642346183031844098824391575475675" to=​"02633223354@10.67.125.28/​1560928211242866028599368404399127563701010324836150290726" type=​"set">​…​</iq>​<iq xmlns=​"jabber:​client" from=​"02712124383@10.67.125.28/​1155396996667267226156489642346183031844098824391575475675" to=​"02633223354@10.67.125.28/​1560928211242866028599368404399127563701010324836150290726" type=​"set">​…​</iq>​<iq xmlns=​"jabber:​client" from=​"02712124383@10.67.125.28/​1155396996667267226156489642346183031844098824391575475675" to=​"02633223354@10.67.125.28/​1560928211242866028599368404399127563701010324836150290726" type=​"set">​…​</iq>​<iq xmlns=​"jabber:​client" from=​"02712124383@10.67.125.28/​1155396996667267226156489642346183031844098824391575475675" to=​"02633223354@10.67.125.28/​1560928211242866028599368404399127563701010324836150290726" type=​"set">​…​</iq>​<iq xmlns=​"jabber:​client" from=​"02712124383@10.67.125.28/​1155396996667267226156489642346183031844098824391575475675" to=​"02633223354@10.67.125.28/​1560928211242866028599368404399127563701010324836150290726" type=​"set">​…​</iq>​<iq xmlns=​"jabber:​client" from=​"02712124383@10.67.125.28/​1155396996667267226156489642346183031844098824391575475675" to=​"02633223354@10.67.125.28/​1560928211242866028599368404399127563701010324836150290726" type=​"set">​…​</iq>​<iq xmlns=​"jabber:​client" from=​"02712124383@10.67.125.28/​1155396996667267226156489642346183031844098824391575475675" to=​"02633223354@10.67.125.28/​1560928211242866028599368404399127563701010324836150290726" type=​"set">​…​</iq>​<iq xmlns=​"jabber:​client" from=​"02712124383@10.67.125.28/​1155396996667267226156489642346183031844098824391575475675" to=​"02633223354@10.67.125.28/​1560928211242866028599368404399127563701010324836150290726" type=​"set">​…​</iq>​<iq xmlns=​"jabber:​client" from=​"02712124383@10.67.125.28/​1155396996667267226156489642346183031844098824391575475675" to=​"02633223354@10.67.125.28/​1560928211242866028599368404399127563701010324836150290726" type=​"set">​…​</iq>​<iq xmlns=​"jabber:​client" from=​"02712124383@10.67.125.28/​1155396996667267226156489642346183031844098824391575475675" to=​"02633223354@10.67.125.28/​1560928211242866028599368404399127563701010324836150290726" type=​"set">​…​</iq>​<iq xmlns=​"jabber:​client" from=​"02712124383@10.67.125.28/​1155396996667267226156489642346183031844098824391575475675" to=​"02633223354@10.67.125.28/​1560928211242866028599368404399127563701010324836150290726" type=​"set">​…​</iq>​<iq xmlns=​"jabber:​client" from=​"02712124383@10.67.125.28/​1155396996667267226156489642346183031844098824391575475675" to=​"02633223354@10.67.125.28/​1560928211242866028599368404399127563701010324836150290726" type=​"set">​…​</iq>​<iq xmlns=​"jabber:​client" from=​"02712124383@10.67.125.28/​1155396996667267226156489642346183031844098824391575475675" to=​"02633223354@10.67.125.28/​1560928211242866028599368404399127563701010324836150290726" type=​"set">​…​</iq>​<iq xmlns=​"jabber:​client" from=​"02712124383@10.67.125.28/​1155396996667267226156489642346183031844098824391575475675" to=​"02633223354@10.67.125.28/​1560928211242866028599368404399127563701010324836150290726" type=​"set">​…​</iq>​<iq xmlns=​"jabber:​client" from=​"02712124383@10.67.125.28/​1155396996667267226156489642346183031844098824391575475675" to=​"02633223354@10.67.125.28/​1560928211242866028599368404399127563701010324836150290726" type=​"set">​…​</iq>​<iq xmlns=​"jabber:​client" from=​"02712124383@10.67.125.28/​1155396996667267226156489642346183031844098824391575475675" to=​"02633223354@10.67.125.28/​1560928211242866028599368404399127563701010324836150290726" type=​"set">​…​</iq>​<iq xmlns=​"jabber:​client" from=​"02712124383@10.67.125.28/​1155396996667267226156489642346183031844098824391575475675" to=​"02633223354@10.67.125.28/​1560928211242866028599368404399127563701010324836150290726" type=​"set">​…​</iq>​<iq xmlns=​"jabber:​client" from=​"02712124383@10.67.125.28/​1155396996667267226156489642346183031844098824391575475675" to=​"02633223354@10.67.125.28/​1560928211242866028599368404399127563701010324836150290726" type=​"set">​…​</iq>​<iq xmlns=​"jabber:​client" from=​"02712124383@10.67.125.28/​1155396996667267226156489642346183031844098824391575475675" to=​"02633223354@10.67.125.28/​1560928211242866028599368404399127563701010324836150290726" type=​"set">​…​</iq>​</body>​
jsxc.js:165 [JINGLE][log:debug] 528365d6-0bfd-4930-906d-daf4aef99154: transport-info
jsxc.js:165 [JINGLE][log:debug] 528365d6-0bfd-4930-906d-daf4aef99154: transport-info
jsxc.js:165 [JINGLE][log:debug] 528365d6-0bfd-4930-906d-daf4aef99154: transport-info
jsxc.js:165 [JINGLE][log:debug] 528365d6-0bfd-4930-906d-daf4aef99154: transport-info
jsxc.js:165 [JINGLE][log:debug] 528365d6-0bfd-4930-906d-daf4aef99154: transport-info
jsxc.js:165 [JINGLE][log:debug] 528365d6-0bfd-4930-906d-daf4aef99154: transport-info
jsxc.js:165 [JINGLE][log:debug] 528365d6-0bfd-4930-906d-daf4aef99154: transport-info
jsxc.js:165 [JINGLE][log:debug] 528365d6-0bfd-4930-906d-daf4aef99154: transport-info
jsxc.js:165 [JINGLE][log:debug] 528365d6-0bfd-4930-906d-daf4aef99154: transport-info
jsxc.js:165 [JINGLE][log:debug] 528365d6-0bfd-4930-906d-daf4aef99154: transport-info
jsxc.js:165 [JINGLE][log:debug] 528365d6-0bfd-4930-906d-daf4aef99154: transport-info
jsxc.js:165 [JINGLE][log:debug] 528365d6-0bfd-4930-906d-daf4aef99154: transport-info
jsxc.js:165 [JINGLE][log:debug] 528365d6-0bfd-4930-906d-daf4aef99154: transport-info
jsxc.js:165 [JINGLE][log:debug] 528365d6-0bfd-4930-906d-daf4aef99154: transport-info
jsxc.js:165 [JINGLE][log:debug] 528365d6-0bfd-4930-906d-daf4aef99154: transport-info
jsxc.js:165 [JINGLE][log:debug] 528365d6-0bfd-4930-906d-daf4aef99154: transport-info
jsxc.js:165 [JINGLE][log:debug] 528365d6-0bfd-4930-906d-daf4aef99154: transport-info
jsxc.js:165 [JINGLE][log:debug] 528365d6-0bfd-4930-906d-daf4aef99154: transport-info
2jsxc.js:165 [JINGLE][log:debug] 528365d6-0bfd-4930-906d-daf4aef99154: transport-info
jsxc.js:1226 > <body rid=​"2114991488" xmlns=​"http:​/​/​jabber.org/​protocol/​httpbind" sid=​"b2c40521759182ee1fb03a52e5f8f39311f47e4e">​…​</body>​
jsxc.js:1223 < <body xmlns=​"http:​/​/​jabber.org/​protocol/​httpbind">​<iq xmlns=​"jabber:​client" from=​"02712124383@10.67.125.28/​1155396996667267226156489642346183031844098824391575475675" to=​"02633223354@10.67.125.28/​1560928211242866028599368404399127563701010324836150290726" type=​"result">​</iq>​</body>​
jsxc.js:1226 > <body rid=​"2114991489" xmlns=​"http:​/​/​jabber.org/​protocol/​httpbind" sid=​"b2c40521759182ee1fb03a52e5f8f39311f47e4e">​</body>​
jsxc.js:183 onUserMediaSuccess
jsxc.js:165 [Webrtc] Accept call
jsxc.js:183 close dialog
jsxc.dep.js:49872 i18next::translator: missingKey pt-BR translation No_video_signal 
jsxc.js:165 [JINGLE][log:info] 528365d6-0bfd-4930-906d-daf4aef99154: Accepted incoming session
jsxc.js:165 [JINGLE][log:info] 528365d6-0bfd-4930-906d-daf4aef99154: Changing session state to: active
jsxc.js:165 [JINGLE][log:info] 528365d6-0bfd-4930-906d-daf4aef99154: Changing connection state to: connecting
jsxc.js:165 connection state for 528365d6-0bfd-4930-906d-daf4aef99154 connecting
4jsxc.js:165 [JINGLE][log:info] 528365d6-0bfd-4930-906d-daf4aef99154: Discovered new ICE candidate
jsxc.js:1226 > <body rid=​"2114991490" xmlns=​"http:​/​/​jabber.org/​protocol/​httpbind" sid=​"b2c40521759182ee1fb03a52e5f8f39311f47e4e">​…​</body>​
jsxc.js:1223 < <body xmlns=​"http:​/​/​jabber.org/​protocol/​httpbind">​</body>​
jsxc.js:1223 < <body xmlns=​"http:​/​/​jabber.org/​protocol/​httpbind">​<iq xmlns=​"jabber:​client" from=​"02712124383@10.67.125.28/​1155396996667267226156489642346183031844098824391575475675" to=​"02633223354@10.67.125.28/​1560928211242866028599368404399127563701010324836150290726" type=​"result">​</iq>​</body>​
jsxc.js:1226 > <body rid=​"2114991491" xmlns=​"http:​/​/​jabber.org/​protocol/​httpbind" sid=​"b2c40521759182ee1fb03a52e5f8f39311f47e4e">​</body>​
jsxc.js:1223 < <body xmlns=​"http:​/​/​jabber.org/​protocol/​httpbind">​<iq xmlns=​"jabber:​client" from=​"02712124383@10.67.125.28/​1155396996667267226156489642346183031844098824391575475675" to=​"02633223354@10.67.125.28/​1560928211242866028599368404399127563701010324836150290726" type=​"result">​</iq>​<iq xmlns=​"jabber:​client" from=​"02712124383@10.67.125.28/​1155396996667267226156489642346183031844098824391575475675" to=​"02633223354@10.67.125.28/​1560928211242866028599368404399127563701010324836150290726" type=​"result">​</iq>​<iq xmlns=​"jabber:​client" from=​"02712124383@10.67.125.28/​1155396996667267226156489642346183031844098824391575475675" to=​"02633223354@10.67.125.28/​1560928211242866028599368404399127563701010324836150290726" type=​"result">​</iq>​<iq xmlns=​"jabber:​client" from=​"02712124383@10.67.125.28/​1155396996667267226156489642346183031844098824391575475675" to=​"02633223354@10.67.125.28/​1560928211242866028599368404399127563701010324836150290726" type=​"result">​</iq>​</body>​
jsxc.js:1226 > <body rid=​"2114991492" xmlns=​"http:​/​/​jabber.org/​protocol/​httpbind" sid=​"b2c40521759182ee1fb03a52e5f8f39311f47e4e">​</body>​
jsxc.js:1223 < <body xmlns=​"http:​/​/​jabber.org/​protocol/​httpbind">​<iq xmlns=​"jabber:​client" from=​"02712124383@10.67.125.28/​1155396996667267226156489642346183031844098824391575475675" to=​"02633223354@10.67.125.28/​1560928211242866028599368404399127563701010324836150290726" type=​"set">​…​</iq>​</body>​
jsxc.js:165 [JINGLE][log:debug] 528365d6-0bfd-4930-906d-daf4aef99154: session-terminate
jsxc.js:165 [JINGLE][log:info] 528365d6-0bfd-4930-906d-daf4aef99154: Terminating session
jsxc.js:165 [JINGLE][log:info] 528365d6-0bfd-4930-906d-daf4aef99154: Stream removed
jsxc.js:165 [Webrtc] Remote stream for undefined removed.
jsxc.js:165 [JINGLE][log:info] 528365d6-0bfd-4930-906d-daf4aef99154: Changing session state to: ended
jsxc.js:165 [Webrtc] call terminated 02712124383@10.67.125.28/1155396996667267226156489642346183031844098824391575475675failed-transport
jsxc.js:183 close dialog
jsxc.dep.js:49872 i18next::translator: missingKey pt-BR translation jingle_reason_failed-transport jingle_reason_failed-transport
jsxc.js:165 [JINGLE][log:info] 528365d6-0bfd-4930-906d-daf4aef99154: Changing connection state to: disconnected
jsxc.js:165 connection state for 528365d6-0bfd-4930-906d-daf4aef99154 disconnected
jsxc.js:1226 > <body rid=​"2114991493" xmlns=​"http:​/​/​jabber.org/​protocol/​httpbind" sid=​"b2c40521759182ee1fb03a52e5f8f39311f47e4e">​…​</body>​
jsxc.js:1223 < <body xmlns=​"http:​/​/​jabber.org/​protocol/​httpbind">​<iq xmlns=​"jabber:​client" from=​"02712124383@10.67.125.28/​1155396996667267226156489642346183031844098824391575475675" to=​"02633223354@10.67.125.28/​1560928211242866028599368404399127563701010324836150290726" type=​"set">​…​</iq>​</body>​
jsxc.js:165 [JINGLE][log:error] Unknown session
jsxc.js:1226 > <body rid=​"2114991494" xmlns=​"http:​/​/​jabber.org/​protocol/​httpbind" sid=​"b2c40521759182ee1fb03a52e5f8f39311f47e4e">​…​</body>​
@diegobill
Copy link
Author

processone/stun#12

@zinid
Copy link
Contributor

zinid commented Aug 10, 2017

It's hard to say something because stun library is not compiled with debug. You might see something in wireshark (recent versions of wireshark are able to understand STUN packets).
What bothers me at the moment is that you have set credentialType to password, but using auth_type: anonymous in ejabberd configuration. But that's only a guess.

@zinid
Copy link
Contributor

zinid commented Aug 10, 2017

You can also collect traffic on 3478 port using tcpdump and post it somewhere:

# tcpdump -s 1024 -i any -w /tmp/stun.pcap port 3478

@diegobill
Copy link
Author

@zinid , if I set auth_type to user, how can I register a username and credential (password)?

@zinid
Copy link
Contributor

zinid commented Aug 10, 2017

The same XMPP user's credentials are used

@zinid
Copy link
Contributor

zinid commented Aug 10, 2017

But the passwords should be plain-text'ed

@diegobill
Copy link
Author

@zinid , I changed to use a fixed ejabberd user (username and password) that can login, but when I tried to make a video call no log was print in my ext_auth.log (i am using external auth method via python script).

I tested these TURN/STUN servers and I did not have problem to make video call:

{
"urls":["turn:64.233.186.127:19305?transport=udp","turn:[2800:3F0:4003:C00::7F]:19305?transport=udp","turn:64.233.186.127:443?transport=tcp","turn:[2800:3F0:4003:C00::7F]:443?transport=tcp"],
"username":"CJHTt8wFEgYk/xMGh0oYzc/s6OMTIICjBQ",
"credential":"CPOiCHVWB/LCTdfhgtwkUacbo64="
},
{"urls":["stun:stun.l.google.com:19302"]}

My STUN/TURN server is in a private enterprise network, but my two client can ping it.

@diegobill
Copy link
Author

The wireshark capture of one ejabberd client (JSXC):

https://drive.google.com/open?id=0BwWxTurDNQ47ZmFaMEY4U3NVNzg

@zinid
Copy link
Contributor

zinid commented Aug 11, 2017

Have you opened this PCAP file in wireshark? Your client sends only STUN Binding requests to ejabberd (10.67.125.28). TURN Allocation requests are sent to some other servers (192.158.29.39, 66.228.45.110, etc).

@diegobill
Copy link
Author

@zinid , I fixed the problem, I configure coturn TURN server:

coturn/coturn#162

Thanks

@zinid zinid closed this as completed Aug 15, 2017
@lock
Copy link

lock bot commented Jun 10, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants