Skip to content
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

fix(plugin-cc): event emission fix for different disconnect flows #4036

Merged
merged 4 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion docs/samples/contact-center/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,13 @@ function registerTaskListeners(task) {
task.on('task:media', (track) => {
document.getElementById('remote-audio').srcObject = new MediaStream([track]);
});
task.on('task:end', (task) => {
task.on('task:end', (wrapupData) => {
if (!wrapupData.wrapupRequired) {
answerElm.disabled = true;
declineElm.disabled = true;
console.log('Call ended without call being answered');
}
incomingDetailsElm.innerText = '';
sreenara marked this conversation as resolved.
Show resolved Hide resolved
if (!endElm.disabled) {
console.info('Call ended successfully by the external user');
updateButtonsPostEndCall();
Expand Down
1 change: 1 addition & 0 deletions packages/@webex/plugin-cc/src/services/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const CC_EVENTS = {
AGENT_OFFER_CONTACT: 'AgentOfferContact',
AGENT_CONTACT_ASSIGNED: 'AgentContactAssigned',
AGENT_CONTACT_ASSIGN_FAILED: 'AgentContactAssignFailed',
AGENT_CONTACT_OFFER_RONA: 'AgentOfferContactRona',
AGENT_CONTACT_HELD: 'AgentContactHeld',
AGENT_CONTACT_HOLD_FAILED: 'AgentContactHoldFailed',
AGENT_CONTACT_UNHELD: 'AgentContactUnheld',
Expand Down
14 changes: 9 additions & 5 deletions packages/@webex/plugin-cc/src/services/task/TaskManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,20 @@ export default class TaskManager extends EventEmitter {
this.currentTask = this.currentTask.updateTaskData(payload.data);
this.currentTask.emit(TASK_EVENTS.TASK_ASSIGNED, this.currentTask);
break;
case CC_EVENTS.AGENT_CONTACT_OFFER_RONA:
case CC_EVENTS.CONTACT_ENDED:
this.emit(TASK_EVENTS.TASK_UNASSIGNED, this.currentTask);
if (this.webCallingService.loginOption === LoginOption.BROWSER) {
this.currentTask.unregisterWebCallListeners();
this.webCallingService.unregisterCallListeners();
if (this.currentTask.data.interaction.state === 'new') {
sreenara marked this conversation as resolved.
Show resolved Hide resolved
this.currentTask.emit(TASK_EVENTS.TASK_END, {wrapupRequired: false});
if (this.webCallingService.loginOption === LoginOption.BROWSER) {
this.currentTask.unregisterWebCallListeners();
this.webCallingService.unregisterCallListeners();
}
this.removeCurrentTaskFromCollection();
}
break;
case CC_EVENTS.AGENT_WRAPUP:
this.currentTask = this.currentTask.updateTaskData(payload.data);
this.currentTask.emit(TASK_EVENTS.TASK_END, this.currentTask);
this.currentTask.emit(TASK_EVENTS.TASK_END, {wrapupRequired: true});
break;
case CC_EVENTS.AGENT_WRAPPEDUP:
this.removeCurrentTaskFromCollection();
Expand Down
Loading