Participant drop functionality and tests - #5174
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9fe344435c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| data: { | ||
| type: CC_EVENTS.PARTICIPANT_LEFT_CONFERENCE, | ||
| interactionId: p.interactionId, | ||
| }, |
There was a problem hiding this comment.
Bind drop completion to the requested participant
When any other participant leaves the same conference while this request is pending, this bind also matches that ParticipantLeftConference event because it checks only the interaction ID. AqmReqs then resolves and clears the drop request even if the requested target remains or later produces a failure, so callers receive a false success. Include the requested participant ID in the success correlation bind, and likewise correlate the failure bind where supported.
AGENTS.md reference: packages/@webex/contact-center/AGENTS.md:L51-L51
Useful? React with 👍 / 👎.
| const customerNumber = hasActiveCustomer ? getCustomerNumber(interaction) : ''; | ||
| const customer = customerNumber | ||
| ? { | ||
| participantId: customerNumber, | ||
| displayName: customerNumber, |
There was a problem hiding this comment.
Send the customer's roster identifier to the drop API
When a conference includes a customer and another participant, the Drop customer action uses ANI/DNIS as participantId, although the SDK endpoint expects the backend participant identifier from the task roster. Clicking the button therefore targets the phone number rather than the customer's participant record and can reject or time out; retain the customer's resolved roster ID for participantId and use the number only as displayName.
Useful? React with 👍 / 👎.
|
This pull request is automatically being deployed by Amplify Hosting (learn more). |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2564fe942c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const consultMedia = Object.values(task?.data?.interaction?.media || {}).find( | ||
| (media) => media?.mType?.toLowerCase() === 'consult' | ||
| ); |
There was a problem hiding this comment.
Check the current consult leg before enabling Drop
When the interaction retains more than one consult-media entry, this selects the first entry even though getCurrentConsultMedia() immediately above resolves the configured or latest consult leg. If an older leg is held but the current leg is active and unheld, hasActiveNonHeldConsult() returns false and enables participant Drop during the active consult; the inverse ordering incorrectly disables it. Use the current consult-media selection here so the roster reflects the leg the agent is actually controlling.
Useful? React with 👍 / 👎.
Kesari3008
left a comment
There was a problem hiding this comment.
Except test files and .md files, reviewed the code
| "contracts": { | ||
| "provides": [ | ||
| "Published @webex/contact-center package; ContactCenter WebexPlugin; public SDK methods, events, types, Task, AddressBook, ApiAIAssistant, UserPreference, cc.userPreference, exported user-preference request/response types, and preview-campaign methods acceptPreviewContact/skipPreviewContact/removePreviewContact" | ||
| "Published @webex/contact-center package; ContactCenter WebexPlugin; public SDK methods, events, types, Task, AddressBook, ApiAIAssistant, UserPreference, cc.userPreference, exported user-preference request/response types, preview-campaign methods acceptPreviewContact/skipPreviewContact/removePreviewContact, and DropConferenceParticipantPayload/task.dropConferenceParticipant" |
There was a problem hiding this comment.
Why are we adding specifically about this feature in the manifest file. I dont consult, tranfer or conference flows explicitly mentioned here so why only this feature
| method: METHODS.CREATE_PROMISE, | ||
| }); | ||
| } | ||
| const eerr = new Err.Details(notifFail.errId, msg as any); |
There was a problem hiding this comment.
There is a typo here for this error variable, we can fix it. Also why do we need to add this condition ?
| actions: ['updateTaskData', 'clearConsultState', 'emitTaskConsultEnd'], | ||
| }, | ||
| ], | ||
| [TaskEvent.PARTICIPANT_LEAVE]: [ |
There was a problem hiding this comment.
This state transition is not following the definition of state machine. target and actions are the property it takes which is missing here. Why is a new event being introduced like this ?
| public async dropConferenceParticipant( | ||
| payload: DropConferenceParticipantPayload | ||
| ): Promise<TaskResponse> { | ||
| const participantId = payload?.participantId; |
There was a problem hiding this comment.
payload is mandatory param in the method definition so why is ? present marking it optionally being present
| * @returns Promise<TaskResponse> | ||
| */ | ||
| public async dropConferenceParticipant( | ||
| payload: DropConferenceParticipantPayload |
There was a problem hiding this comment.
This payload seems to be be having just one property, why have created new type for it. We can directly say in the definition participantId: string and also if we are specifically defining it to be string why is the string check in the if block needed
| }, | ||
| ]; | ||
|
|
||
| const survivingParticipantLeaveTransition = { |
There was a problem hiding this comment.
This optimization is unncessary
| actions: ['updateTaskData', 'clearConsultState', 'emitTaskConsultEnd'], | ||
| }, | ||
| ], | ||
| [TaskEvent.PARTICIPANT_LEAVE]: [ |
There was a problem hiding this comment.
Why would be any Agent in Connected state if they are in conference. Connected state is only for 1:1 call with customer. And when a participant leave happens, it can only happen in conference state. This transition may not be valid
| target: TaskState.CONNECTED, | ||
| actions: ['updateTaskData'], | ||
| }, | ||
| [TaskEvent.PARTICIPANT_LEAVE]: [ |
There was a problem hiding this comment.
Same comment here. We will have to evaluate if drop is something being attempted in HOLD_INITIATING state or RESUME_INITIATING state
| handleConferenceStarted: assign({consultInitiator: false}), | ||
|
|
||
| setConsultDestination: assign(({event}: TaskActionArgs) => { | ||
| setConsultDestination: assign(({context, event}: TaskActionArgs) => { |
There was a problem hiding this comment.
Why have we introduced this change ?
| // agent is absent from the updated participants, they have left. | ||
| const participants = taskData?.interaction?.participants; | ||
| if (participants && !(selfAgentId in participants)) { | ||
| const currentParticipant = taskData?.interaction?.participants?.[selfAgentId]; |
There was a problem hiding this comment.
Would like to discuss this change ?
|
Update Jira description with JIRA link, changes done and vidcast link for testing done in SDK |
COMPLETES #< INSERT LINK TO ISSUE >
This pull request addresses
< DESCRIBE THE CONTEXT OF THE ISSUE >
by making the following changes
< DESCRIBE YOUR CHANGES >
Change Type
The following scenarios were tested
< ENUMERATE TESTS PERFORMED, WHETHER MANUAL OR AUTOMATED >
The GAI Coding Policy And Copyright Annotation Best Practices
I certified that
Make sure to have followed the contributing guidelines before submitting.