Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var XMPP_DOMAIN = xms;
- var xmpp_user = // xmpp user name
- navigator.getUserMedia = ( navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia);
- var localAudio_stream;
- navigator.getUserMedia({audio:true}, function(s){
- localAudio_stream = s;
- }, function(){
- alert("Audio Not Allowed");
- });
- var client = XMPP.createClient({
- jid: "user_jid",
- password: "user_password",
- transport: 'websocket',
- wsURL: "wss://domaine_name:5280/websocket/"
- });
- client.jingle.config.debug = true;
- client.jingle.addICEServer({
- urls: 'turn:a_valid_turn_server_with_port',
- username: 'turn_user',
- credential: 'turn_pass'
- });
- client.on('session:started', function () {
- client.enableCarbons();
- client.getRoster(function (err, resp) {
- client.updateCaps();
- client.sendPresence({
- caps: client.disco.caps
- });
- });
- });
- client.on('jingle:remotestream:added', function (session, stream) {
- attachMediaStream(stream, document.getElementById('remoteAudio'));
- document.getElementById('remoteAudio').play();
- });
- client.on('jingle:incoming', function (session) {
- session.addStream(localAudio_stream);
- session.accept();
- });
- client.connect();
- function callJID(full_jid){
- var session = client.jingle.createMediaSession(full_jid);
- session.addStream(localAudio_stream);
- session.start();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement