匿名会议加入 - Skype UCWA for online

时间:2016-07-12 07:22:08

标签: skype-for-business ucwa

我正试图通过会议URI匿名加入会议,这似乎不起作用。我去了SKYPE UCWA网站并转到交互式SDK - 并尝试匿名参加会议,但该页面没有做任何事情。

https://ucwa.skype.com/websdk

下面是我试图匿名加入会议的代码,但是对client.signInManager.signIn的调用永远不会完成,也不会抛出任何异常。

寻找解决此问题的建议。此外,如果有人使用SKYPE web sdk(UCWA)匿名加入会议的代码,请分享相同的内容。感谢。

function InitialiseSkype() {
                Skype.initialize({ apiKey: config.apiKey }, function (api) {
                window.skypeWebAppCtor = api.application;
                window.skypeWebApp = new api.application();
                client = new window.skypeWebAppCtor;
                //once intialised, sign in
                           
                alert("Skype SDK Initialized");
                JoinAnonymous();
                
            }, function (err) {
                console.log(err);
                alert('Cannot load the SDK.');
            });
        } 

function JoinAnonymous(){
client.signInManager.signIn({
                version: config.Version,
                name: $('#name').val(),
                meeting: $('#meetingUri').val()
            }).then(function () {
                alert('Signed In, Anonymously');
                var conversation = application.conversationsManager.getConversationByUri(uri);
            }, function (error) {
                alert(error);
            }); 
}

3 个答案:

答案 0 :(得分:0)

实际上我确实使用该代码匿名登录:

//Init
    var config = {apiKey: 'a42fcebd-5b43-4b89-a065-74450fb91255', // SDK
                 apiKeyCC: '9c967f6b-a846-4df2-b43d-5167e47d81e1' // SDK+UI
                 };

     Skype.initialize({ apiKey: config.apiKey }, function (api) {
         window.skypeWebApp =  new api.application; 
    }, function (err) {
        console.log("cannot load the sdk package", err);
      }); 

//Actual code
    var uri ="sip:xxxxxxxx;gruu;opaque=app:conf:focus:id:xxxxxxxx";
    window.skypeWebApp.signInManager.signIn({
      name: "pseudo",
      meeting:uri
    }).then(function () {
      alert('Signed In, Anonymously');

    }, function (error) {
      alert(error);
    });

我确实连接了ucwa.skype交互式网页sdk页面中给出的uri。 但之后我没有设法加入对话,可能是因为交互式样本并没有真正创造出空间。

我可以使用示例帐户登录Office365帐户加入会议。但是我无法匿名加入我的会议室。 您是尝试使用内部部署帐户还是使用Office365帐户?

答案 1 :(得分:0)

在线Skype for Business似乎尚未提供匿名加入会议。

答案 2 :(得分:0)

WebSDK的新更新现在支持SfB Online的匿名会议加入

(function () {
    'use strict';

    // this will be populated when the auth token is fetched
    // it is later needed to sign into Skype for Business
    var authDetails = {};

    // A reference to the Skype SDK application object
    // set during initialization
    var app;

    displayStep(0);
    registerUIListeners();

    // Initializing the Skype application
    Skype.initialize({
        apiKey: '9c967f6b-a846-4df2-b43d-5167e47d81e1'
    }, function (api) {
        console.log('Skype SDK initialization successful');

        app = api.UIApplicationInstance;

        // Once it is initialized, display a UI prompt for a meeting URL
        displayStep(1);
    }, function (err) {
        console.error('Skype SDK initialization error:', err);
    });

    // After the user submits the meeting URL the next step is to 
    // fetch an auth token
    function getToken(evt) {
        var input = evt.target.querySelector('input'),
            meetingUrl = input.value,
            request = new XMLHttpRequest(),
            data;

        evt.preventDefault();
        console.log('Fetching auth token from meeting url:', meetingUrl);

        function guid() {
            function s4() {
                return Math.floor((1 + Math.random()) * 0x10000)
                .toString(16)
                .substring(1);
            }
            return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
                s4() + '-' + s4() + s4() + s4();
        }

        var sessionId = guid();
        data = 'ApplicationSessionId=' + sessionId +
            '&AllowedOrigins=' + encodeURIComponent(window.location.href) +
            '&MeetingUrl=' + encodeURIComponent(meetingUrl);

        request.onreadystatechange = function () {
            if (request.readyState === XMLHttpRequest.DONE) {
                if (request.status === 200) {
                    var response = JSON.parse(request.response);

                    authDetails.discoverUrl = response.DiscoverUri;
                    authDetails.authToken = "Bearer " + response.Token;

                    console.log('Successfully fetched the anonymous auth token and discoverUrl', authDetails);
                    displayStep(2);
                }
                else {
                    console.error('An error occured, fetching the anonymous auth token', request.responseText);
                }
            }
        };

        request.open('post', 'http://webrtctest.cloudapp.net/getAnonTokenJob');
        request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
        request.send(data);
    }

    // This uses the auth token and discovery URL to sign into Skype
    // and join the meeting
    function joinAVMeeting(evt) {
        var input = evt.target.querySelector('input'),
            name = input.value;

        evt.preventDefault();
        console.log('Joinig meeting as:', name);

        app.signInManager.signIn({
            name: name,
            cors: true,
            root: { user: authDetails.discoverUrl },
            auth: function (req, send) {
                // Send token with all requests except for the GET /discover
                if (req.url != authDetails.discoverUrl)
                    req.headers['Authorization'] = authDetails.authToken;
                return send(req);
            }
        }).then(function () {
            // When joining a conference anonymously, the SDK automatically creates
            // a conversation object to represent the conference being joined
            var conversation = app.conversationsManager.conversations(0);

            console.log('Successfully signed in with anonymous online meeting token');

            registerAppListeners(conversation);

            // This turns on local video and joins the meeting
            startVideoService(conversation);

        }).catch(function (error) {
            console.error('Unable to join conference anonymously:', error);
        });


        function registerAppListeners(conversation) {
            conversation.selfParticipant.video.state.when('Connected', function () {

                console.log('Showing self video');

                document.querySelector('.self').style.display = 'inline-block';
                setupContainer(conversation.selfParticipant.video.channels(0), document.querySelector('.self .video'));
                displayName(document.querySelector('.self'), conversation.selfParticipant);

                console.log('The video mode of the application is:', conversation.videoService.videoMode());

                if (conversation.videoService.videoMode() === 'MultiView') {
                    // Loading the sample in any other browser than Google Chrome means that 
                    // the videoMode is set to 'MultiView'
                    // Please refer to https://msdn.microsoft.com/en-us/skype/websdk/docs/ptvideogroup
                    // on an example on how to implement group video.
                }

                // When in active speaker mode only one remote channel is available.
                // To display videos of multiple remote parties the video in this one channel
                // is switched out automatically, depending on who is currently speaking
                if (conversation.videoService.videoMode() === 'ActiveSpeaker') {
                    var activeSpeaker = conversation.videoService.activeSpeaker;

                    setupContainer(activeSpeaker.channel, document.querySelector('.remote .video'));

                    activeSpeaker.channel.isVideoOn.when(true, function () {
                        document.querySelector('.remote').style.display = 'inline-block';
                        activeSpeaker.channel.isStarted(true);

                        console.log('ActiveSpeaker video is available and has been turned on.');
                    });

                    activeSpeaker.channel.isVideoOn.when(false, function () {
                        document.querySelector('.remote').style.display = 'none';
                        activeSpeaker.channel.isStarted(false);

                        console.log('ActiveSpeaker video is not available anymore and has been turned off.');
                    });

                    // the .participant object changes when the active speaker changes
                    activeSpeaker.participant.changed(function (newValue, reason, oldValue) {
                        console.log('The ActiveSpeaker has changed. Old ActiveSpeaker:', oldValue && oldValue.displayName(), 'New ActiveSpeaker:', newValue && newValue.displayName());

                        if (newValue) {
                            displayName(document.querySelector('.remote'), newValue);
                        }
                    });
                }
            });

            conversation.state.changed(function (newValue, reason, oldValue) {
                if (newValue === 'Disconnected' && (oldValue === 'Connected' || oldValue === 'Connecting')) {
                    console.log('The conversation has ended.');
                    reset();
                }
            });
        }

        function setupContainer(videoChannel, videoDiv) {
            videoChannel.stream.source.sink.format('Stretch');
            videoChannel.stream.source.sink.container(videoDiv);
        }

        function displayName(container, person) {
            container.querySelector('.displayName .detail').innerHTML = person.displayName();
        }

        function startVideoService(conversation) {
            conversation.videoService.start().then(null, function (error) {
                console.error('An error occured joining the conversation:', error);
            });
            displayStep(3);
        }
    }

    function endConversation(evt) {
        var conversation = app.conversationsManager.conversations(0);

        evt.preventDefault();

        conversation.leave().then(function () {
            console.log('The conversation has ended.');
            reset();
        }, function (error) {
            console.error('An error occured ending the conversation:', error);
        }).then(function () {
            reset();
        });
    }


    //-----------------------------------------------------------------------
    //UI helper functions
    function displayStep(step) {
        var nodes = document.querySelectorAll('.step');

        for (var i = 0; i < nodes.length; ++i) {
            var node = nodes[i];

            node.style.display = 'none';

            if (i === step) {
                node.style.display = 'block';
            }
        }
    }

    function registerUIListeners() {
        document.querySelector('.step1').onsubmit = getToken;
        document.querySelector('.step2').onsubmit = joinAVMeeting;
        document.querySelector('.step3').onsubmit = endConversation;
    }

    function reset() {
        window.location = window.location.href;
    }

})();

https://github.com/OfficeDev/skype-docs/blob/master/Skype/WebSDK/samples/Meetings/Anonymous%20Online/standalone/index.js

相关问题