get stun and turn credentials from server

This commit is contained in:
Philipp Hancke 2014-01-20 19:51:21 +01:00
parent f063aacc92
commit edf3fc64b0
2 changed files with 3 additions and 1 deletions

1
app.js
View File

@ -34,6 +34,7 @@ function init() {
connection.connect(jid, document.getElementById('password').value, function (status) {
if (status == Strophe.Status.CONNECTED) {
console.log('connected');
connection.jingle.getStunAndTurnCredentials();
if (RTC.browser == 'firefox') {
getUserMediaWithConstraints(['audio']);
} else {

View File

@ -571,6 +571,7 @@ Strophe.addConnectionPlugin('jingle', {
// validity have to be fetched before creating the peerconnection
// TODO: implement refresh via updateIce as described in
// https://code.google.com/p/webrtc/issues/detail?id=1650
var self = this;
this.connection.sendIQ(
$iq({type: 'get', to: this.connection.domain})
.c('services', {xmlns: 'urn:xmpp:extdisco:1'}).c('service', {host: 'turn.' + this.connection.domain}),
@ -610,7 +611,7 @@ Strophe.addConnectionPlugin('jingle', {
break;
}
});
this.ice_config.iceServers = iceservers;
self.ice_config.iceServers = iceservers;
},
function (err) {
console.warn('getting turn credentials failed', err);