Mountain View
Jabber SDK API Documentation

Tutorial: Answer/Reject Conversations

Answer/Reject Conversations

Title Incoming Telephony Conversations can be either answered or rejected. Incoming conversation is received through "onConversationIncoming" event (this event is covered in Handle Conversation Events tutorial).

Answering incoming conversation can be done in two ways, after which "onConversationStarted" event is fired. First it needs to be checked if conversation has canAnswer capability, and if it does, then call either TelephonyConversation.answerAudio or TelephonyConversation.answerVideo, as it is shown in the snippet below:

        var conversation;

        // ...
        // Here we have retrieved conversation "onConversationIncoming" event.
        // ...

        if(conversation.capabilities.canAnswer)
        {
            // Answer incoming conversation with audio only.
            conversation.answerAudio();

            // Answer incoming conversation with both video and audio.
            // conversation.answerVideo();
        }
    
Rejecting incoming conversation will cause "onConversationEnded" event to be fired. First it needs to be checked if conversation has canReject capability, and if it does, then call TelephonyConversation.reject as it is shown in the snippet below:

        var conversation;

        // ...
        // Here we have retrieved conversation through "onConversationIncoming" event.
        // ...

        if(conversation.capabilities.canReject)
        {
            // Reject incoming conversation.
            conversation.reject();
        }
    

Next

Previous