cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2087
Views
1
Helpful
4
Replies

Jabber Web SDK AutoAnswer

klaas.kuiken1
Level 1
Level 1

Hi There, We've wrapped the Jabber Web SDK into another web application which determines who is going to be called and already knows he or she is going to be called. For that purpose we would like to be able to "Auto-Answer" the Video call, avoiding having to click the "Answer" button as soon as it comes in or is in the "Ringin" state. We tried, coding using: document.getElementById('answerbtn').focus(); document.getElementById('answerbtn').click(); but no luck so far. It is not necessary that the the incoming call "Rings" ; it can be auto answered immediately. Could somebody please help us with a codesnippet on how to accomplish this? Thanks in Advance, Klaas.

4 Replies 4

dstaudt
Cisco Employee
Cisco Employee

It sounds like you may be focusing on trying to automate the HTML from one of the sample apps, rather than using the Jabber JavaScript library in the more direct fashion intended.  E.g. your web page should be looking to implement a handler for the cwic 'conversationIncoming' event, from there calling 'startConversation' to answer the call, handling 'conversationStarted' event to confirm the call answer has been completed, etc.

E.g. from the sample.html:

function addCwicEventHandlers() {

    /**

     * Add handlers for conversationStart and conversationIncoming events

     */

    $('#phonecontainer')

        .bind('conversationStart.cwic', handleConversationStart)

        .bind('conversationIncoming.cwic', handleConversationIncoming)

    /**

...

and

function handleConversationIncoming(event, conversation, containerdiv) {

    calls.addCall(conversation, containerdiv);

};

where in the latter you could add something like:

if {configAutoAnswer} {

     $call.cwic('startConversation');

...

Hello DSTAUDT,

Again, Thank You Very Much for guiding us in the right direction.

First we would like to comment that the 2 bindings you mentions are already present in de default "sample.js" but it's OK to mention.

Second, in your answer, the last line, an additional parameter is necessary, so the call should read:

$call.cwic('startConversation', answerObject);

and "answerObject" must previously be defined as done in function " incomingAnswerClick(event) ". (We Guessed).

For simplicity we wanted to avoid the video call and added the following:

CodeSnip1.jpg

But now the chrome F12 console, after calling the directory number (dn), indicates

"Cannot set property 'videoDirection' of null" pointing to the line number with the red arrow.

I think we come a long way, but after lots of attempts and trails we could not solve this issue and probably we will have an other hurdle for assigning "answerObject.remoteVideoWindow"

Could you please give us another push ?

Best Regards,

Klaas.

Hi There,

We found that the following code implements the AutoAnswer functionality:

AutoAnswer-Modification.jpg

Although the voice communication works correctly and is bi-directional, the Video stream is only incoming from the DN how called.

We've added, before the $call.cwic(....) the following:

conversation.videoDirection =  'SendRecv';

conversation.remoteVideoWindow = 'videocallobject';

But it had no effect, thus the Video stream is only incoming and you will notice that the self view is displayed in gray-scale, probably indicating that the video is not outgoing.

If anybody could give us a hint on how to correct this behavior and have a bidirectional video stream we would be very grateful.

Best Regards,

Klaas.

klaas.kuiken1
Level 1
Level 1

Hi There,

Well today we inserted the 2 lines I was writing about in my previous post and the Auto-Answer with duplex video stream works perfectly. So this is the solution:

AutoAnswer-Duplex-Video.jpg

Best Regards,

Klaas.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: