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

**URL:** <https://community.sendbird.com/t/user-are-getting-call-notification-eventhough-user-is-already-in-another-call/975>\
**Category:** JavaScript\
**Tags:** sendbird-call\
**Created:** [September 16, 2020, 11:33am UTC](https://community.sendbird.com/t/user-are-getting-call-notification-eventhough-user-is-already-in-another-call/975 "2020-09-16T11:33:25Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rajeev\_Bhaskaran](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/rajeev_bhaskaran/32/512_2.png) [@Rajeev\_Bhaskaran](https://community.sendbird.com/u/Rajeev_Bhaskaran)\
**Post date:** [September 16, 2020, 11:33am UTC](https://community.sendbird.com/t/user-are-getting-call-notification-eventhough-user-is-already-in-another-call/975/1 "2020-09-16T11:33:25Z")

</div>

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,

---

<div class="post-metadata">

**Author:** ![kckern](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/kckern/32/65_2.png) [@kckern](https://community.sendbird.com/u/kckern)\
**Post date:** [September 16, 2020, 12:13pm UTC](https://community.sendbird.com/t/user-are-getting-call-notification-eventhough-user-is-already-in-another-call/975/2 "2020-09-16T12:13:48Z")

</div>

We are planning a “Call Waiting” feature and will make it available in a future release. ([https://en.wikipedia.org/wiki/Call\_waiting](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.

---

<div class="post-metadata">

**Author:** ![Rajeev\_Bhaskaran](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/rajeev_bhaskaran/32/512_2.png) [@Rajeev\_Bhaskaran](https://community.sendbird.com/u/Rajeev_Bhaskaran)\
**Post date:** [September 16, 2020, 12:16pm UTC](https://community.sendbird.com/t/user-are-getting-call-notification-eventhough-user-is-already-in-another-call/975/3 "2020-09-16T12:16:05Z")

</div>

Hi,

Using chat SDK, members connection status?

Thanks

---

<div class="post-metadata">

**Author:** ![kckern](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/kckern/32/65_2.png) [@kckern](https://community.sendbird.com/u/kckern)\
**Post date:** [September 16, 2020, 12:49pm UTC](https://community.sendbird.com/t/user-are-getting-call-notification-eventhough-user-is-already-in-another-call/975/4 "2020-09-16T12:49:36Z")

</div>

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:

> **[User Channel Metadata | JavaScript Chat SDK Documentation | Sendbird](https://docs.sendbird.com/javascript/user_channel_metadata#3_user_metadata_4_update)**
>
> With metadata and metacounter which consist of key-value items, you can store additional information to users and channels. This page explains how to manage user metadata, channel metadata, and channel metacounter.

---

<div class="post-metadata">

**Author:** ![Rajeev\_Bhaskaran](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/rajeev_bhaskaran/32/512_2.png) [@Rajeev\_Bhaskaran](https://community.sendbird.com/u/Rajeev_Bhaskaran)\
**Post date:** [September 17, 2020, 9:31am UTC](https://community.sendbird.com/t/user-are-getting-call-notification-eventhough-user-is-already-in-another-call/975/5 "2020-09-17T09:31:31Z")

</div>

> [@kckern](#):
>
> in\_call

Hi,  
@kckern

```auto
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

---

<div class="post-metadata">

**Author:** ![kckern](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/kckern/32/65_2.png) [@kckern](https://community.sendbird.com/u/kckern)\
**Post date:** [September 17, 2020, 11:02am UTC](https://community.sendbird.com/t/user-are-getting-call-notification-eventhough-user-is-already-in-another-call/975/6 "2020-09-17T11:02:09Z")

</div>

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:

```auto
//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.

> **[Group Channel | JavaScript Chat SDK Documentation | Sendbird](https://docs.sendbird.com/javascript/group_channel#3_retrieve_a_list_of_all_members)**
>
> A group channel is a chat that allows close interactions among a limited number of users. It can be private or public. A private group channel can let a user join the chat through an invitation by another user who is already a member of the chatroom....

---

<div class="post-metadata">

**Author:** ![Rajeev\_Bhaskaran](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/rajeev_bhaskaran/32/512_2.png) [@Rajeev\_Bhaskaran](https://community.sendbird.com/u/Rajeev_Bhaskaran)\
**Post date:** [September 17, 2020, 11:16am UTC](https://community.sendbird.com/t/user-are-getting-call-notification-eventhough-user-is-already-in-another-call/975/7 "2020-09-17T11:16:08Z")

</div>

> [@kckern](#):
>
> `{in_call:true}`

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

```auto
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 ?
```

---

<div class="post-metadata">

**Author:** ![kckern](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/kckern/32/65_2.png) [@kckern](https://community.sendbird.com/u/kckern)\
**Post date:** [September 17, 2020, 11:26am UTC](https://community.sendbird.com/t/user-are-getting-call-notification-eventhough-user-is-already-in-another-call/975/8 "2020-09-17T11:26:29Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Rajeev\_Bhaskaran](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/rajeev_bhaskaran/32/512_2.png) [@Rajeev\_Bhaskaran](https://community.sendbird.com/u/Rajeev_Bhaskaran)\
**Post date:** [September 17, 2020, 12:09pm UTC](https://community.sendbird.com/t/user-are-getting-call-notification-eventhough-user-is-already-in-another-call/975/9 "2020-09-17T12:09:09Z")

</div>

> [@kckern](#):
>
> `user.createMetaData({in_call:false}, ...);`

HI @kckern

- SendBird JavaScript SDK v3.0.35

![image](https://us1.discourse-cdn.com/flex020/uploads/sendbird/original/1X/161c250df30393a60bde7176bdd9be90281fca19.png)

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

what might be the issue.

i could see that the user is populated

---

<div class="post-metadata">

**Author:** ![kckern](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/kckern/32/65_2.png) [@kckern](https://community.sendbird.com/u/kckern)\
**Post date:** [September 17, 2020, 12:11pm UTC](https://community.sendbird.com/t/user-are-getting-call-notification-eventhough-user-is-already-in-another-call/975/10 "2020-09-17T12:11:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Rajeev\_Bhaskaran](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/rajeev_bhaskaran/32/512_2.png) [@Rajeev\_Bhaskaran](https://community.sendbird.com/u/Rajeev_Bhaskaran)\
**Post date:** [September 17, 2020, 12:52pm UTC](https://community.sendbird.com/t/user-are-getting-call-notification-eventhough-user-is-already-in-another-call/975/11 "2020-09-17T12:52:04Z")

</div>

Hi @kckern

 ![image](https://us1.discourse-cdn.com/flex020/uploads/sendbird/original/1X/a05cad70972ed04a4660c8945ce0eb64239a85ee.png)

---

<div class="post-metadata">

**Author:** ![kckern](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/kckern/32/65_2.png) [@kckern](https://community.sendbird.com/u/kckern)\
**Post date:** [September 17, 2020, 10:17pm UTC](https://community.sendbird.com/t/user-are-getting-call-notification-eventhough-user-is-already-in-another-call/975/12 "2020-09-17T22:17:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Rajeev\_Bhaskaran](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/rajeev_bhaskaran/32/512_2.png) [@Rajeev\_Bhaskaran](https://community.sendbird.com/u/Rajeev_Bhaskaran)\
**Post date:** [September 18, 2020, 4:48am UTC](https://community.sendbird.com/t/user-are-getting-call-notification-eventhough-user-is-already-in-another-call/975/13 "2020-09-18T04:48:19Z")

</div>

Hi @kckern,

This is the console log of Sb

 ![image](https://us1.discourse-cdn.com/flex020/uploads/sendbird/original/1X/8eaf33af323c20786ed28be068ef98fc0a0f1eca.png)

is this correct?

---

<div class="post-metadata">

**Author:** ![kckern](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/kckern/32/65_2.png) [@kckern](https://community.sendbird.com/u/kckern)\
**Post date:** [September 18, 2020, 12:25pm UTC](https://community.sendbird.com/t/user-are-getting-call-notification-eventhough-user-is-already-in-another-call/975/14 "2020-09-18T12:25:18Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Rajeev\_Bhaskaran](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/rajeev_bhaskaran/32/512_2.png) [@Rajeev\_Bhaskaran](https://community.sendbird.com/u/Rajeev_Bhaskaran)\
**Post date:** [September 18, 2020, 12:29pm UTC](https://community.sendbird.com/t/user-are-getting-call-notification-eventhough-user-is-already-in-another-call/975/15 "2020-09-18T12:29:59Z")

</div>

@kckern

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

![image](https://us1.discourse-cdn.com/flex020/uploads/sendbird/original/1X/84fdcd7b8bd08602b6a60f69775fdca5b7314426.png)

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

---

<div class="post-metadata">

**Author:** ![kckern](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/kckern/32/65_2.png) [@kckern](https://community.sendbird.com/u/kckern)\
**Post date:** [September 18, 2020, 12:44pm UTC](https://community.sendbird.com/t/user-are-getting-call-notification-eventhough-user-is-already-in-another-call/975/16 "2020-09-18T12:44:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Rajeev\_Bhaskaran](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/rajeev_bhaskaran/32/512_2.png) [@Rajeev\_Bhaskaran](https://community.sendbird.com/u/Rajeev_Bhaskaran)\
**Post date:** [September 21, 2020, 6:12am UTC](https://community.sendbird.com/t/user-are-getting-call-notification-eventhough-user-is-already-in-another-call/975/17 "2020-09-21T06:12:40Z")

</div>

Hi @kckern

 ![image](https://us1.discourse-cdn.com/flex020/uploads/sendbird/original/1X/dca19c8d5961990e1f4ccdb26dd0cda3384a1f36.png)

no create metadata

---

<div class="post-metadata">

**Author:** ![Rajeev\_Bhaskaran](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/rajeev_bhaskaran/32/512_2.png) [@Rajeev\_Bhaskaran](https://community.sendbird.com/u/Rajeev_Bhaskaran)\
**Post date:** [September 25, 2020, 10:24am UTC](https://community.sendbird.com/t/user-are-getting-call-notification-eventhough-user-is-already-in-another-call/975/18 "2020-09-25T10:24:28Z")

</div>

@kckern ??

any help ,i dont see the createmetadata function

---

<div class="post-metadata">

**Author:** ![Rajeev\_Bhaskaran](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/rajeev_bhaskaran/32/512_2.png) [@Rajeev\_Bhaskaran](https://community.sendbird.com/u/Rajeev_Bhaskaran)\
**Post date:** [September 25, 2020, 10:29am UTC](https://community.sendbird.com/t/user-are-getting-call-notification-eventhough-user-is-already-in-another-call/975/19 "2020-09-25T10:29:09Z")

</div>

@kckern

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

---

<div class="post-metadata">

**Author:** ![kckern](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/kckern/32/65_2.png) [@kckern](https://community.sendbird.com/u/kckern)\
**Post date:** [September 25, 2020, 10:35am UTC](https://community.sendbird.com/t/user-are-getting-call-notification-eventhough-user-is-already-in-another-call/975/20 "2020-09-25T10:35:25Z")

</div>

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

createMetaData is documented here:

> **[User - Documentation](https://sendbird.github.io/core-sdk-javascript/module-model_user-User.html#createMetaData)**

[Next page](https://community.sendbird.com/t/user-are-getting-call-notification-eventhough-user-is-already-in-another-call/975.md?page=2)
