-
Notifications
You must be signed in to change notification settings - Fork 354
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
feat(calling): move apis, listeners from calling client to line #3073
feat(calling): move apis, listeners from calling client to line #3073
Conversation
const {lineId} = this.lineDict[deviceId]; | ||
activeCalls[lineId] = []; | ||
Object.keys(allCalls).forEach((correlationId) => { | ||
if (allCalls[correlationId].getLineId() === lineId) { |
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 am little confused with the logic here ,
Why does someone want to receive all active calls in all line ?
if that's the intention do you think we need to maintain the keys of those calls in a array when ever the call gets active , any thoughts
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.
@arun3528 So the structure this API will return is in the form of key-value where the key is the lineId and the value is an array of the calls active on that line.
The intention here is to just return that data back to the user if they want to fetch the information of all the calls that are active. When we say active here, it just means call is present but it can be in any state.
/** | ||
* | ||
*/ | ||
public getActiveCalls(): Record<string, ICall[]> { |
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.
needs some description for the function
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.
Added.
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.
@Kesari3008 Can we have an optional parameter lineId
which will only return calls from a a single line?
public getActiveCalls(): Record<string, ICall[]> { | |
public getActiveCalls(lineId?: string): Record<string, ICall[]> { |
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.
Yeah, we can do that I guess. Let's discuss on it Monday
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.
We will do this as part of separate PR and discuss the approach for the same
/** | ||
* | ||
*/ | ||
public getConnectedCall(): ICall | undefined { |
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.
same here need comments
do you think its better to take line id as a parameter
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.
@arun3528 The purpose of creating this API was that if the user wants to fetch the information regarding which call is in a connected state at any point in time, they can call this API and get the call object which will have lineId as well.
Now they have this information on which line which call is in the connected state. Hence we need not provide lineId as a parameter here.
If we take lineId as a parameter here then the user has to keep providing each lineId one by one, calling this API multiple times and find which call is in the connected state.
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.
Added description
f3e448f
to
ae7eb2f
Compare
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 can see unused import in few files, please check and remove them
let connectCall; | ||
const allCalls = this.callManager.getActiveCalls(); | ||
Object.keys(allCalls).forEach((correlationId) => { | ||
if (allCalls[correlationId].isConnected() && !allCalls[correlationId].isHeld()) { |
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.
Do we really need to specify a second condition here too? For a call which is on hold state, isConnected should return false for that call so just one condition should suffice here. Let's discuss on this if needed
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.
For a held call, isConnected returns true and isHeld returns false. That's why both the conditions are required.
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 am not sure if we should keep it like that, ideally isConnected should be false if the call is put on hold
ae7eb2f
to
6a52910
Compare
const {lineId} = this.lineDict[deviceId]; | ||
activeCalls[lineId] = []; | ||
Object.keys(calls).forEach((correlationId) => { | ||
if (calls[correlationId].lineId === lineId) { |
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.
Don't we have a getter on lineId
? Is lineId
a public attribute?
if (calls[correlationId].lineId === lineId) { | |
if (calls[correlationId].getLineId() === lineId) { |
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.
We dont have a getter for lineId. Yes, lineId is a public attribute.
@@ -2659,5 +2663,6 @@ export const createCall = ( | |||
dir: CallDirection, | |||
deviceId: string, | |||
deleteCb: DeleteRecordCallBack, | |||
indicator: ServiceIndicator | |||
): ICall => new Call(activeUrl, webex, dest, dir, deviceId, deleteCb, indicator); | |||
indicator: ServiceIndicator, |
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.
Please add lineId in the description
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.
Added
/** | ||
* | ||
*/ | ||
public getActiveCalls(): Record<string, ICall[]> { |
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.
Yeah, we can do that I guess. Let's discuss on it Monday
let connectCall; | ||
const allCalls = this.callManager.getActiveCalls(); | ||
Object.keys(allCalls).forEach((correlationId) => { | ||
if (allCalls[correlationId].isConnected() && !allCalls[correlationId].isHeld()) { |
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 am not sure if we should keep it like that, ideally isConnected should be false if the call is put on hold
472b7a0
to
eeb0204
Compare
mockCall2['connected'] = true; | ||
mockCall2['held'] = true; | ||
mockCall2['earlyMedia'] = false; | ||
mockCall2['callStateMachine'].state.value = 'S_CALL_ESTABLISHED'; |
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.
Shouldn't the state here be S_CALL_HOLD ?
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.
Yes, it should be S_CALL_HOLD. Changed
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.
Please take care of below points:
- One minor comment in UT file.
- isConnected state needs to be corrected so let's make a note of it.
- Ensure all the conflicts are resolved before merge and all UT's are passing.
- Remove extra imports if there are any present.
- Found one UT in callManager.test.ts file showing error for localAudioTrack being passed to call.answer(). Please fix that before merge.
Please take care of Priya's approval comments. |
eeb0204
to
a3ca42d
Compare
a3ca42d
to
701551b
Compare
…x#3073) Co-authored-by: Shreyas Sharma <[email protected]>
…x#3073) Co-authored-by: Shreyas Sharma <[email protected]>
COMPLETES #SPARK-428389
This pull request addresses
Required changes for line class.
Move below from callingClient to line:
Add below new APIs in calling client and line:
CallingClient:
- getActiveCalls()
- getConnectedCall()
Line:
- getCall()
Change Type
The following scenarios where tested
< ENUMERATE TESTS PERFORMED, WHETHER MANUAL OR AUTOMATED >
I certified that
I have read and followed contributing guidelines
I discussed changes with code owners prior to submitting this pull request
I have not skipped any automated checks
All existing and new tests passed
I have updated the documentation accordingly
Make sure to have followed the contributing guidelines before submitting.