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]); console.log("Browser: " + browser + ", version: " + version); if ( !( (browser == "Chrome" && version >= 28) || (browser == "Firefox" && version >= 26) ) ) { callback({'status': 'browserError', message: "Browser version not supported"}); return; } server = server || window.document.location.host.split(':')[0] console.log("user " + username + " calling to " + voiceBridge); var configuration = { uri: 'sip:' + escape(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