-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
base: main
Are you sure you want to change the base?
Conversation
@@ -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) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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')); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
jambonz-feature-server/lib/tasks/dial.js
Line 336 in 8bed44c
async mute(callSid, doMute) { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
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) { |
There was a problem hiding this comment.
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.
@davehorton could you please merge this? |
It seems like mute/unmute was never working for Conference task, so fixing this.