P2P Escalation

Applies to: Skype for Business 2015

Notes

Important

P2P calls are not supported in Google Chrome.

Escalate a P2P call to a group call

To start off we need to start a P2P Outgoing call, as shown in the Outgoing P2P sample. Once the call is established, we can add a participant to the conversation which escalates the P2P call to a group call.

In the case of a peer-to-peer, P2P, conversation the server will escalate it to a conference.

conversation.participants.add('sip:xxx').then(function() {
    // participant added
}, function (error) {
    // error
});

End a call

To end the call, simply leave the conversation.

conversation.leave().then(function () {
    // successfully left the conversation
}, function (error) {
    // error
});

Complete code sample

Here is the complete code sample:

var conversation = application.conversationsManager.getConversation('sip:xxx');
conversation.selfParticipant.audio.state.when('Connected', function () {
    console.log('Connected to audio call');
});
conversation.state.changed(function (newValue, reason, oldValue) {
    console.log('Conversation state changed from', oldValue, 'to', newValue);

    if (newValue === 'Connected') {
        // once the P2P conversation was established, we can add another participant
        // to escalate to a group call
       conversation.participants.add('sip:yyy').then(function() {
            // participant added
        }, function (error) {
            // error
        });
    }
});
conversation.participants.added(function (participant) {
    console.log('Participant:', participant.displayName(), 'has been added to the conversation');
});
conversation.audioService.start().then(function() {
    console.log('The call has been started successfully');
}, function (error) {
    console.log('An error occurred starting the call', error);
});