Skip to content

Member mute on conference #1048

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

avoylenko
Copy link
Contributor

It seems like mute/unmute was never working for Conference task, so fixing this.

@@ -549,8 +549,8 @@ class Conference extends Task {
/**
* mute or unmute side of the call
*/
mute(callSid, doMute) {
this.doConferenceMute(this.callSession, {conf_mute_status: doMute});
async mute(callSid, doMute) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why async when you are not awaiting on a promise anywhere

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It not true, we are attaching the catch block here:

task.mute(callSid, mute).catch((err) => this.logger.error(err, 'CallSession:_lccMuteStatus'));

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still don't agree on this actually.

in line 1531 we call task.mute expecting to receive a Promise.
however mute() currently doesnt return anything
it does call doConferenceMute() which returns nothing.

The fact that we expect a Promise in line 1531 does not mean that the called function (task.mute()) needs to be declared async -- it can return a Promise without being declared async. It only needs to be declared async if it uses await.

I prefer not to declare a function aysnc unless it uses await syntax within the function body. Let me know if you spot problems in my reasoning.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davehorton you are 100% right, we don't need the async function here, but removing it will force us to change the mute function for dial verb. See

async mute(callSid, doMute) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra info, the mute function is being called here based on active task

async _lccMuteStatus(mute, callSid) {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really dont see why that would force a change anywhere else.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The _lccMuteStatus function calls the mute function based on session active task and since the function inside the dial task returns a promise(we have an await function there), we have to return a promise for the conference task as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davehorton do you need anything else or PR can be accepted?

@davehorton
Copy link
Contributor

please rebase

@@ -549,8 +549,8 @@ class Conference extends Task {
/**
* mute or unmute side of the call
*/
mute(callSid, doMute) {
this.doConferenceMute(this.callSession, {conf_mute_status: doMute});
async mute(callSid, doMute) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still don't agree on this actually.

in line 1531 we call task.mute expecting to receive a Promise.
however mute() currently doesnt return anything
it does call doConferenceMute() which returns nothing.

The fact that we expect a Promise in line 1531 does not mean that the called function (task.mute()) needs to be declared async -- it can return a Promise without being declared async. It only needs to be declared async if it uses await.

I prefer not to declare a function aysnc unless it uses await syntax within the function body. Let me know if you spot problems in my reasoning.

@avoylenko avoylenko requested a review from davehorton February 24, 2025 18:25
@avoylenko
Copy link
Contributor Author

@davehorton could you please merge this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants