Handling Missed Calls and Call Errors
The base connector automatically sends the HANGUP event in these end call scenarios, so you must not send a HANGUP event to prevent duplicate events from causing softphone issues.
- The rep hangs up the call using the End Call button. The base
connector implementation for this scenario
is:
1case constants.VOICE_MESSAGE_TYPE.END_CALL: 2 try { 3 const telephonyConnector = await vendorConnector.getTelephonyConnector(); 4 const payload = await telephonyConnector.endCall(message.data.call, message.data.agentStatus); 5 Validator.validateClassObject(payload, HangupResult); 6 const activeCallsResult = await telephonyConnector.getActiveCalls(); 7 Validator.validateClassObject(activeCallsResult, ActiveCallsResult); 8 const activeCalls = activeCallsResult.activeCalls; 9 const { calls } = payload; 10 // After end call returns from vendor side, 11 // if the call is a consult, fire HANGUP 12 // else if no more active calls, fire HANGUP, otherwise, fire PARTICIPANT_REMOVED 13 if (calls.length > 0 && calls[0] && calls[0].callType === constants.CALL_TYPE.CONSULT) { 14 dispatchEvent(constants.VOICE_EVENT_TYPE.HANGUP, calls[0]); 15 } else if (activeCalls.length === 0) { 16 dispatchEvent(constants.VOICE_EVENT_TYPE.HANGUP, calls); 17 } else { 18 dispatchEvent(constants.VOICE_EVENT_TYPE.PARTICIPANT_REMOVED, calls.length > 0 && calls[0]); 19 } 20 } catch (e) { 21 if (e instanceof CustomError) { 22 dispatchCustomError(e, constants.VOICE_MESSAGE_TYPE.END_CALL); 23 } else { 24 dispatchError(constants.VOICE_ERROR_TYPE.CAN_NOT_END_THE_CALL, e, constants.VOICE_MESSAGE_TYPE.END_CALL); 25 } 26 } - Rep declines the call. The base connector implementation for this scenario
is:
1case constants.VOICE_MESSAGE_TYPE.DECLINE_CALL: 2 try { 3 const telephonyConnector = await vendorConnector.getTelephonyConnector(); 4 const payload = await telephonyConnector.declineCall(message.data.call); 5 Validator.validateClassObject(payload, CallResult); 6 const { call } = payload; 7 dispatchEvent(constants.VOICE_EVENT_TYPE.HANGUP, call); 8 } catch (e) { 9 if (e instanceof CustomError) { 10 dispatchCustomError(e, constants.VOICE_MESSAGE_TYPE.DECLINE_CALL); 11 } else { 12 dispatchError(constants.VOICE_ERROR_TYPE.CAN_NOT_DECLINE_THE_CALL, e, constants.VOICE_MESSAGE_TYPE.DECLINE_CALL); 13 } 14 } - Rep blind transfers the call. The base connector implementation for this scenario
is:
1case constants.VOICE_MESSAGE_TYPE.ADD_PARTICIPANT: 2 try { 3 const telephonyConnector = await vendorConnector.getTelephonyConnector(); 4 const payload = await telephonyConnector.addParticipant(new Contact(message.data.contact), message.data.call, message.data.isBlindTransfer); 5 publishEvent({ eventType: constants.VOICE_EVENT_TYPE.PARTICIPANT_ADDED, payload }); 6 if (message.data.isBlindTransfer) { 7 dispatchEvent(constants.VOICE_EVENT_TYPE.HANGUP, message.data.call); 8 } 9 }
You must raise a HANGUP event using the publishEvent() method in these scenarios:
- User ends the call: The user disconnects the call from their end in the middle of conversation.
- Missed call: The call rings but the rep doesn't answer before it times out.
- Call error: The call fails due to a network issue, system error, or other failure unrelated to rep action.
For missed, or failed calls, you must configure the connector to:
- Raise a HANGUP event type with call.reason set to error in the Connector API publishEvent() method.
- Set call.closeCallOnError to false to keep the conversation open and leave the voice call in a "new" state. Don't set call.closeCallOnError to true unless you want to close the conversation and mark the voice call as completed.
For the end call scenario in which the user disconnects the call mid-conversation, you must configure the connector to raise a HANGUP event type with call.reason set to ended in the Connector API publishEvent() method to mark the voice call as completed.
For missed, or failed calls, also set the following for inbound or callback calls:
- When a rep misses a call, set call.agentStatus to MissedCallAgent.
- When a call fails due to the rep, set call.agentStatus to FailedConnectAgent.
- When a call fails due to any reason that's unrelated to the rep, set call.agentStatus to FailedConnectCustomer.
To set the rep's status automatically when the call is declined, go to Setup | Presence Configuration Settings | Update Status on Decline, and choose a presence status for when the rep declines a work item.
To set the rep's status automatically when the call is missed or if there's any error that isn't due to call declined, go to Setup | Presence Configuration Settings | Update Status on Push Time-Out and choose a presence status.