User are getting call notification eventhough user is already in another call

Hi,

If the user1 is in a call (engaged in a call.).
Suppose another user2 try to call the user1 ,then how to handle the scenario in javascript.

I could see two call are getting generating,

i want the second user to notify that the user1 is already in a call.

anyway?

Thanks,

We are planning a “Call Waiting” feature and will make it available in a future release. (https://en.wikipedia.org/wiki/Call_waiting)

Until then, your app will need to handle connection states outside of the SDK. Using a group channel with the Chat SDK could be one workaround solution for this.

Hi,

Using chat SDK, members connection status?

Thanks

Connection status will only tell you if they are online or not. It will not tell you if they are in a call or not. However, you can use the Chat SDK to update user metadata (for example: in_call:true/false) and update it when a call begins/ends. The other users can lookup the user’s metadata before they try to call to know if they are in a call or not.

See:

1 Like

Hi,
@kckern

var user = sb.currentUser;
var value1 = user.metaData['key1'];

this will return the current user Metadata rt?
how can i get the other usermetadata.
couldnt find the code

Thanks

The updated user data will continue to be retrievable via the sb. object. The other user metadata is entirely defined by the dictionary you create during the user.createMetaData() step.

For example:

//init
user.createMetaData({in_call:false}, ...);
//start call
user.updateMetaData({in_call:true}, ...);
//end call
user.updateMetaData({in_call:false}, ...);

As an alternative, you could create a single group channel for your app that contains all the users that are currently in a call. Invoke groupChannel.join() when a call starts, invoke groupChannel.leave() when a call ends, and use groupChannel.members to get the list of who is currently in a call. With this you can check if the user you are calling is in a call.

Hi @kckern

for the first user enter the call then
var user = sb.user;
//init
user.createMetaData({in_call:false}, …);
//start call
user.updateMetaData({in_call:true}, …);

Now this time the second user user 2 tries to call user 1

if the user2 loges in and tries this

var user = sb.currentUser;
var value1 = user.metaData['in_call'];

he get his metadata not the user1 metadata.

how the user2 will get the user1 metadata

////if there any method like this
var user2=sb.getuserbyid(user1);

then get user2 metadata ?

Oh, I see what you mean now. To find user2, you will need to use the group channel as described above. groupChannel.members will return the user objects of others in the group, from which you can retrieve metadata. User2 will first have to join the group when the call starts. Then user1 can check if user2 is in there.

HI @kckern

  • SendBird JavaScript SDK v3.0.35

image

chat.js:2565 Uncaught TypeError: user.createMetaData is not a function

what might be the issue.

i could see that the user is populated

Can you show the output of console.log(user) ?

Hi @kckern

Can you verify that the sb object is from the Chat SDK, not the Calls SDK?

Hi @kckern,

This is the console log of Sb

is this correct?

Yes that is the Chat SDK object. The createMetaData method is only available on the currentUser object—can you verify that is the object you are trying to call the method from?

@kckern

yes, am calling the same object.
this is version of sendbird call.

image

do i need to enable setup anything in the sendbird dashboard to set the metadata?

That should work. Can you set a debugger in the code right after console.log(user). Then from the dev tools console, type user. (include the dot) and check what functions are available.

Hi @kckern

no create metadata

@kckern ??

any help ,i dont see the createmetadata function

@kckern

can you give the url to download latest senbird.min,js and sendbirdcall.min,js download URL?

Latest min.js file is here:
https://raw.githubusercontent.com/sendbird/SendBird-SDK-JavaScript/master/SendBird.min.js

createMetaData is documented here: