Respond to a conversation invitation

Applies to: Skype for Business 2015

A conversation invitation is extended to the local user to join a conversation. Invitations can come from any version of the Skype for Business client, another Skype Web SDK-enabled webpage, or a compatible client from the public cloud.

Responding to a conversation invitation

The SDK creates a set of objects and raises several events to support a new conversation.

At this moment, the app must call the accept method or the reject method on the ConversationService object. Whether the call is taken or declined depends on which method is called.

The following procedure catches the conversation-related "added" events, forms a UI prompt, accepts the user's action, and updates the app UI to show the right kind of content.

Respond to a conversation invitation

  1. Listen for the added event on the ConversationsManager.conversations collection for new conversations.

  2. For a new conversation, listen for change events on the service's state property as enumerated CallConnectionState. If the state is 'Notified', then it indicates the incoming invitation.

  3. If it is an incoming IM invitation, call the ChatService.accept method to accept the invitation.

  4. You may call the ChatService.reject method to decline the invitation.

The following example shows how to accept an incoming IM call.

//Register a listener for incoming calls
conversationsManager.conversations.added(function (conversation) {
    if (conversation.chatService.accept.enabled()) {
        // this is an incoming IM call
        conversation.chatService.accept();
    }
});

The following example shows how to reject an incoming IM call.

//Register a listener for incoming calls
conversationsManager.conversations.added(function (conversation) {
    if (conversation.chatService.enabled()) {
        // this is an incoming IM call
        Conversation.chatService.reject();
    }
});

The following example shows how to accept an incoming audio call.

//Register a listener for incoming calls
conversationsManager.conversations.added(function (conversation) {
    if (conversation.audioService.accept.enabled()) {
        // this is an incoming audio call
        conversation.audioService.accept();
    }
});

The following example shows how to reject an incoming audio call.

//Register a listener for incoming calls
conversationsManager.conversations.added(function (conversation) {
    if (conversation.audioService.enabled()) {
        // this is an incoming audio call
        Conversation.audioService.reject();
    }
});

The following example shows how to accept an incoming video call.

//Register a listener for incoming calls
conversationsManager.conversations.added(function (conversation) {
    if (conversation.videoService.accept.enabled()) {
        // this is an incoming video call
        conversation.videoService.accept();
    }
});

The following example shows how to reject an incoming video call.

//Register a listener for incoming calls
conversationsManager.conversations.added(function (conversation) {
    if (conversation.videoService.enabled()) {
        // this is an incoming video call
        Conversation.videoService.reject();
    }
});

See also