Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
20 changed files
with
20,101 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
117 changes: 117 additions & 0 deletions
117
bigbluebutton-client/resources/prod/lib/bbb_webrtc_bridge_jssip.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
|
||
|
||
var bbbAudioConference; | ||
var currentSession; | ||
|
||
// Hang Up webrtc call | ||
function webrtc_hangup(callback) { | ||
console.log("Terminating current session"); | ||
currentSession.terminate(); // allows calling multiple times | ||
callback(); | ||
} | ||
|
||
// Call | ||
function webrtc_call(username, voiceBridge, server, callback) { | ||
var sayswho = navigator.sayswho, | ||
browser = sayswho[0], | ||
version = +(sayswho[1].split('.')[0]); | ||
|
||
|
||
if currentSession currentSession.terminate(); | ||
|
||
console.log("Browser: " + browser + ", version: " + version); | ||
if ( !( (browser == "Chrome" && version > 27) || (browser == "Firefox" && version > 26) ) ) { | ||
callback("Browser version not supported"); | ||
return; | ||
} | ||
|
||
server = server || window.document.location.host; | ||
console.log("user " + username + " calling to " + voiceBridge); | ||
|
||
var configuration = { | ||
uri: 'sip:' + username + '@' + server, | ||
// password: freeswitchPassword, | ||
// ws_servers: 'wss://' + server + ':7443', | ||
ws_servers: 'ws://' + server + ':5066', | ||
display_name: username, | ||
// authorization_user: freeswitchUser, | ||
register: false, | ||
// register_expires: null, | ||
// no_answer_timeout: null, | ||
trace_sip: true, | ||
stun_servers: "stun:74.125.134.127:19302", | ||
// turn_servers: null, | ||
// use_preloaded_route: null, | ||
// connection_recovery_min_interval: null, | ||
// connection_recovery_max_interval: null, | ||
// hack_via_tcp: null, | ||
// hack_ip_in_contact: null | ||
}; | ||
|
||
|
||
bbbAudioConference = new JsSIP.UA(configuration); | ||
bbbAudioConference.on('newRTCSession', function(e) { | ||
console.log("New Webrtc session created!"); | ||
currentSession = e.data.session; | ||
}); | ||
bbbAudioConference.start(); | ||
// Make an audio/video call: | ||
// HTML5 <video> elements in which local and remote video will be shown | ||
var selfView = document.getElementById('local-media'); | ||
var remoteView = document.getElementById('remote-media'); | ||
|
||
|
||
|
||
console.log("Registering callbacks to desired call events.."); | ||
var eventHandlers = { | ||
'progress': function(e){ | ||
console.log('call is in progress'); | ||
}, | ||
'failed': function(e){ | ||
console.log('call failed with cause: '+ e.data.cause); | ||
}, | ||
'ended': function(e){ | ||
console.log('call ended with cause: '+ e.data.cause); | ||
}, | ||
'started': function(e){ | ||
var rtcSession = e.sender; | ||
|
||
console.log('BigBlueButton call started'); | ||
|
||
// Attach local stream to selfView | ||
if (rtcSession.getLocalStreams().length > 0) { | ||
console.log("Got local stream"); | ||
} | ||
|
||
// Attach remote stream to remoteView | ||
if (rtcSession.getRemoteStreams().length > 0) { | ||
console.log("Got remote stream"); | ||
remoteView.src = window.URL.createObjectURL(rtcSession.getRemoteStreams()[0]); | ||
} | ||
|
||
callback(); | ||
} | ||
}; | ||
|
||
console.log("Setting options.. "); | ||
var options = { | ||
'eventHandlers': eventHandlers, | ||
'mediaConstraints': {'audio': true, 'video': false} | ||
}; | ||
|
||
console.log("Calling to " + voiceBridge + "...."); | ||
bbbAudioConference.call('sip:' + voiceBridge + '@' + server, options); | ||
|
||
|
||
} | ||
|
||
// http://stackoverflow.com/questions/5916900/detect-version-of-browser | ||
navigator.sayswho= (function(){ | ||
var ua= navigator.userAgent, | ||
N= navigator.appName, | ||
tem, | ||
M= ua.match(/(opera|chrome|safari|firefox|msie|trident)\/?\s*([\d\.]+)/i) || []; | ||
M= M[2]? [M[1], M[2]]:[N, navigator.appVersion, '-?']; | ||
if(M && (tem= ua.match(/version\/([\.\d]+)/i))!= null) M[2]= tem[1]; | ||
return M; | ||
})(); |
Oops, something went wrong.