fcc-core
Version:
Fusion communication center.
271 lines (268 loc) • 7.36 kB
JavaScript
export default {
/**
* 保持成功
* @param eventname
* @constructor
*/
OnHoldSuccess (eventname) {
this.modifyFlag({
isHolding: true
})
if (!this.isHold) {
console.log('不是手动点击保持按钮触发的保持成功事件都屏蔽按钮变化')
return
}
this.addLog({
AGENT_OPT_TYPE: '44',
REMARK: '保持成功',
eventname
})
return 'OnHoldSuccess'
},
/**
* 取保持成功
* @param eventname
* @constructor
*/
OnGetHoldSuccess (eventname) {
this.modifyFlag({
isHolding: false,
isHold: false
})
this.updateLog(eventname)
return 'OnGetHoldSuccess'
},
/**
*静音成功
* @param eventname
* @constructor
*/
OnBeginMuteUserSuccess (eventname) {
this.addLog({
AGENT_OPT_TYPE: '21',
REMARK: '静音成功',
eventname
})
return 'OnBeginMuteUserSuccess'
},
/**
* 取消静音成功
* @param eventname
* @returns {string}
* @constructor
*/
OnEndMuteUserSuccess (eventname) {
this.updateLog(eventname)
return 'OnEndMuteUserSuccess'
},
/**
* 话机振铃
* @param event
* @constructor
*/
OnPhoneAlerting (eventdata) {
if (['15', '16'].indexOf(this.transType) > -1) {
return 'OnPhoneAlerting'
}
const { transType, FORWARD_SNO } = this.getEventData('OnPhoneAlerting')
// 不是转移相关的来电 也不是 外呼则需要更新转接流水里面的排队时长
if (!transType) {
this.updateCallForward({
FORWARD_SNO,
QUEUE_DURATION: this.getWaitTime(eventdata.eventname)
})
}
return 'OnPhoneAlerting'
},
/**
* 座席来电提醒,提醒用户需要手工应答呼叫。
* @param eventname
* @constructor
*/
OnAnswerRequest (eventname) {
const { caller } = this.getEventData('OnAnswerRequest')
return 'OnAnswerRequest'
},
/**
* 呼出
* @param eventname
*/
OnCustomerAlerting (eventname) {
const { caller } = this.getEventData('OnCustomerAlerting')
return 'OnCustomerAlerting'
},
/**
* 应答成功
* @constructor
*/
OnAnswerSuccess (eventdata) {
/**
* 写通话流水
* 场景包括
* 1.普通呼入
* 2.队列释放转移过来的来电
* 3.咨询过程中咨询方挂机--被咨询方收到的来电(队列,坐席)
* 4.队列或者坐席三方通话时收到的来电事件
*/
this.addAgentCallRecord('OnAnswerSuccess')
const { transType, callType, caller, callId } = this.getEventData('OnAnswerSuccess')
if ((transType === '2' || transType === '5') && !this.consoultFirst) {
this.consoultFirst = true
return 'OnAnswerSuccess'
}
const params = {}
// 转队列 或者转坐席过来的电话 不需要更新等待时长 等待时长只针对客户呼入
if (!transType) {
params.WAIT_DURATION = this.getWaitTime(eventdata.eventType)
}
this.updateCallForward(params)
return 'OnAnswerSuccess'
},
/**
* 三方成功
* 1.需要更新转接流水
* 2.需要写咨询方 被咨询方的话务操作流水
* 因为三方成功 被咨询方不会收到事件 所以根据事件里面返回的agentid
* 给被咨询方写一通话务操作流水
* @returns {null}
*/
onThreeCallSuccess () {
this.isJoinSuccess = true
// 转外线不需要更新转接流水
if (this.transType === '12') {
return
}
const partner = this.getEventData('onThreeCallSuccess', 'partner')
let agentid = ''
if (partner) {
agentid = partner.split(',')[0]
}
this.sendNote({
agentIds: [agentid],
content: {
type: 2,
text: '三方'
}
})
this.updateCallForward({
FORWARD_SNO: this.forwardSno,
FORWARD_USER: agentid,
IS_SUCCESS: 1
})
this.forwardSno = 0
return null
},
/**
* 录音成功
* @param eventname
* @returns {null}
* @constructor
*/
OnRecordSuccess (eventname) {
const { fileName } = this.getEventData(eventname)
// 保持中外呼成功之后单存存一份录音id
if (this.transType === '16') {
this.callOutData.fileName = fileName
return
}
this.fileName = fileName
return null
},
/**
* 外呼成功之后 再保持外呼 需要写通话流水
* @param eventname
* @constructor
*/
OnCallOutSuccess (eventname) {
const { callid } = this.getEventData(eventname)
this.callOutData.callid = callid
this.addAgentCallRecord(eventname)
return 'OnCallOutSuccess'
},
/**
* 外呼失败后,需要记录外呼流水,呼叫标识是失败的
* @param eventname
* @constructor
*/
OnCallOutFailure (eventname) {
const callid1 = this.getEventData(eventname, 'content')
this.callOutData.callid = callid1
this.addAgentCallRecord(eventname)
return 'OnCallOutFailure'
},
/**
* 客户释放事件
* @constructor
*/
OnCustomerRelease () {
// 三方成功 会收到客户 退出呼叫的事件 此时屏蔽该事件
if (this.isJoinSuccess === true) {
this.isJoinSuccess = false
return
}
this.modifyFlag({
transMode: []
})
const callid1 = this.getEventData('OnCustomerRelease', 'callid')
// 保持中外呼
if (this.transType === '16') {
if (this.callOutData.callid === callid1) {
this.updAgentCallRecord('OnCallOutSuccess', {
CALL_DURATION: this.getTime('OnCallOutSuccess'),
VOICE_FILE: this.callOutData.fileName,
CALL_SNO: this.callOutData.calloutSno,
HANGUP_TIME: 1
})
this.transType = '15'
// 保持中客户客户挂机成功
return 'OnCustomerRelease'
} else {
this.transType = '16'
this.updAgentCallRecord('OnAnswerSuccess', {
HANGUP_TIME: 1
})
}
}
const index = this.callids.indexOf(callid1)
index > -1 && this.callids.splice(index, 1)
// 三方通话过程中收到客户挂机事件
if (['4', '7'].indexOf(this.transType) > -1 && !this.isClickHangup) {
const callid2 = this.getEventData('OnAnswerSuccess', 'callid')
// 三方过程中客户挂机 则坐席自己主动将自己释放掉
if (callid1 === callid2) {
this.release()
}
}
},
/**
* 收到挂机事件
*/
onReceiveRelease () {
const type = this.transType || this.getEventData('OnAnswerSuccess', 'transType')
if (type === '4' || type === 7) {
this.transToIvr = true
}
return 'onReceiveRelease'
},
/**
*物理话机挂机 判断坐席是否真的挂机的标准
* @constructor
*/
OnReleaseSuccess () {
this.updAgentCallRecord('OnReleaseSuccess', {
HANGUP_TIME: 1
})
this.modifyFlag({
transType: 0,
isClickHangup: false,
callTime: 0,
isHolding: false,
transData: null,
isHold: false,
callSno: 0,
transToIvr: false,
callids: []
})
return 'OnReleaseSuccess'
}
}