Reputation: 31
Since I few weeks I'm trying to establish a websession between a native android app (https://github.com/njovy/AppRTCDemo
) and a browser by using apprtc. The app worked perfectly when using appr.tc as room-server url.
I already set up the apprtc project on Ubuntu and I'm able to create a conference between a browser on the Ubuntu machine and for example the browser of my mobile device. But when I try to establish the connection between the browser on ubuntu and the app I always receive the following error:
Room IO error: java.io.IOException:
Non-200 response when requesting
TURN server from https://
networktraversal.googleapis.com/
v1alpha/iceconfig?key=none : HTTP/
1.1 400 Bad Request
The URL mentioned in the error message is defined in src/app_engine/constants.py (https://github.com/webrtc/apprtc/blob/master/src/app_engine/constants.py
). But I have no clue what to do with it
# TODO(jansson): Remove once AppRTCDemo on iOS supports ICE_SERVER.
TURN_BASE_URL = 'https://computeengineondemand.appspot.com'
TURN_URL_TEMPLATE = '%s/turn?username=%s&key=%s'
CEOD_KEY = '4080218913'
ICE_SERVER_BASE_URL = 'https://networktraversal.googleapis.com'
ICE_SERVER_URL_TEMPLATE = '%s/v1alpha/iceconfig?key=%s'
ICE_SERVER_API_KEY = os.environ.get('ICE_SERVER_API_KEY')
CALLSTATS_PARAMS = {
'appId': os.environ.get('CALLSTATS_APP_ID'),
'appSecret': os.environ.get('CALLSTATS_APP_SECRET')
}
So what did I do so far? (It's almost the deployment process of apprtc https://github.com/webrtc/apprtc#deployment
)
- Downloaded the latest verion of apprtc from git
- Installed npm, nodejs and grunt
- Building sources by using grunt build
- Downloaded, installed and configured collider (collider runs on rtc:8089)
- 4.1 I had to change my main.go in workspace/src/collidermain
from: var roomSrv = flag.String("room-server", "hxxps://appr.tc", "The origin of the room server")
to: var roomSrv = flag.String("room-server", "hxxp://rtc", "The origin of the room server")- 4.2 Also changed WS_INSTANCE_HOST_KEY to colliders adresse rtc:8089 in src/app_engine/constants.py
- I installed CoTurn and added a turnserver.conf that looks like
listening-port=3478
listening-ip=192.168.178.20
user=rtc:webrtc
cert=/home/rtc/work/src/collider/cert/cert.pem
pkey=/home/rtc/work/src/collider/cert/key.pem
Collider runs on 192.168.178.20:8089 (or rtc:8089) and the turnserver on 192.168.178.20:3478. Credentials defined in turnserver.conf: Username = rtc, Password = webrtc
After the setup I added the requestIceServers-Method into src/web_app/js/util.js (https://github.com/webrtc/apprtc/blob/master/src/web_app/js/util.js
)
function requestIceServers(iceServerRequestUrl, iceTransports) {
return new Promise(function(resolve, reject) {
var servers = [{
credential: "webrtc",
username: "rtc",
urls: [
"turn:192.168.178.20:3478?transport=udp",
"turn:192.168.178.20:3478?transport=tcp"
]
}];
resolve(servers);
});
}
and commented out the standard method:
//function requestIceServers(iceServerRequestUrl, iceTransports) {
//return new Promise(function(resolve, reject) {
//sendAsyncUrlRequest('POST', iceServerRequestUrl).then(function(response) {
//var iceServerRequestResponse = parseJSON(response);
//if (!iceServerRequestResponse) {
//reject(Error('Error parsing response JSON: ' + response));
//return;
//}
//if (iceTransports !== '') {
//filterIceServersUrls(iceServerRequestResponse, iceTransports);
//}
//trace('Retrieved ICE server information.');
//resolve(iceServerRequestResponse.iceServers);
//}).catch(function(error) {
//reject(Error('ICE server request error: ' + error.message));
//return;
//});
//});
//}
When I now start my GAE, my turnserver and collider
python ~/google_appengine/dev_appserver.py ~/google_projects/apprtc-master/out/app_engine --host=0.0.0.0
sudo turnserver -a -r 192.168.178.20
$GOPATH/bin/collidermain -port=8089 -tls=false
I'm able to establish a connection between two browser clients (log from collider-terminal)
rtc@rtc:~$ $GOPATH/bin/collidermain -port=8089 -tls=false
2016/11/05 00:07:32 Starting collider: tls = false, port = 8089, room-server=http://rtc
2016/11/05 00:10:24 Created room stackoverflow
2016/11/05 00:10:24 Added client 97869213 to room stackoverflow
2016/11/05 00:10:24 Client 97869213 registered in room stackoverflow
2016/11/05 00:10:57 Added client 96368166 to room stackoverflow
2016/11/05 00:10:57 Client 96368166 registered in room stackoverflow
2016/11/05 00:10:57 Sent queued messages from 97869213 to 96368166
2016/11/05 00:11:09 Deregistered client 96368166 from room stackoverflow
2016/11/05 00:11:09 Removed client 96368166 from room stackoverflow
2016/11/05 00:11:19 Removing client 96368166 from room stackoverflow due to timeout
When I now try to connect via native app, I always receive the error mentioned above.
After investigation I found the following link on git but it didn't help me that much: https://github.com/webrtc/apprtc/issues/366
So I decided to play around with the constants.py (https://github.com/webrtc/apprtc/blob/master/src/app_engine/constants.py
) and found a place where to override the Turn/Stun server
# Turn/Stun server override. This allows AppRTC to connect to turn servers
# directly rather than retrieving them from an ICE server provider.
TURN_SERVER_OVERRIDE = []
# Enable by uncomment below and comment out above, then specify turn and stun
# servers below.
#TURN_SERVER_OVERRIDE = [
# {
# "urls": [
# "turn:192.168.178.20:3478?transport=udp",
# "turn:192.168.178.20:3478?transport=tcp"
# ],
# "username": "rtc",
# "credential": "webrtc"
# },
# {
# "urls": [
# "stun:stun.l.google.com:19305"
# ]
# }
#]
so I commented the TURN_SERVER_OVERRIDE = [] out, commented the the other lines in and filled in the IP of my turnserver and my credentials, configured in turnserver.conf
GAE is recognizing that there is a new request coming the app. It logs
INFO 2016-11-05 00:06:31,649 apprtc.py:408] Added client 50600142 in room stackoverflow, retries = 0
INFO 2016-11-05 00:06:31,650 apprtc.py:92] Applying media constraints: {'video': True, 'audio': True}
WARNING 2016-11-05 00:06:31,653 apprtc.py:136] Invalid or no value returned from memcache, using fallback: null
INFO 2016-11-05 00:06:31,653 apprtc.py:551] User 50600142 joined room stackoverflow
INFO 2016-11-05 00:06:31,653 apprtc.py:552] Room stackoverflow has state ['50600142']
INFO 2016-11-05 00:06:31,658 module.py:788] default: "POST /join/stackoverflow?wstls=false HTTP/1.1" 200 1175
but still throws the same error.
Since this doesn't do the trick aswell I tried to insert turn-server adresse into the ICE_SERVER_BASE_URL (still in constants.py)
ICE_SERVER_BASE_URL = 'https://networktraversal.googleapis.com'
ICE_SERVER_URL_TEMPLATE = '%s/v1alpha/iceconfig?key=%s'
ICE_SERVER_API_KEY = os.environ.get('ICE_SERVER_API_KEY')
Changed to
ICE_SERVER_BASE_URL = '192.168.178.20:3478'
ICE_SERVER_URL_TEMPLATE = ''
ICE_SERVER_API_KEY = os.environ.get('ICE_SERVER_API_KEY')
This changed the error to:
Connection error
Non-200 response to POST to URL:
http://rtc:8080/join/stackoverflow=wstls=false : HTTP/1.1 500 Internal
Server Error
But now I'm no longer able to open the host from a browser. Therefore I guess it's might be completly wrong.
Thanks in advance!
Upvotes: 3
Views: 2635
Reputation: 1241
set all of them to empty string:
ICE_SERVER_BASE_URL = ''
ICE_SERVER_URL_TEMPLATE = ''
ICE_SERVER_API_KEY = ''
did you set collinder url? and your turnserver should using oauth config. Check all log of: apprtc, chrome console log, turnserver log, collinder log.. for more details.
Upvotes: 0