|
|
@@ -377,6 +377,47 @@ public class CallTask implements Runnable {
|
|
|
} else {
|
|
|
phoneInfo.setCallstatus(30);
|
|
|
}
|
|
|
+
|
|
|
+ // 判断未接通原因,优先使用ASR空号识别结果,其次根据SIP状态码推断
|
|
|
+ // reason 取值说明:
|
|
|
+ // empty_number - 空号(号码不存在或未分配)
|
|
|
+ // busy - 忙线(用户正在通话中)
|
|
|
+ // no_answer - 未接听(响铃后无人接听或拒接)
|
|
|
+ // suspended - 停机(号码已停机或暂停服务)
|
|
|
+ // off - 关机(用户已关机)
|
|
|
+ // assistant - 语音助手(语音信箱/秘书台/来电提醒)
|
|
|
+ // unavailable - 无法接通(暂时无法接通/不在服务区)
|
|
|
+ // call_restriction - 呼入限制(号码设置了呼入限制)
|
|
|
+ // network_busy - 网络忙(网络拥塞)
|
|
|
+ // line_error - 线路故障(SIP线路异常:404/503/480/408)
|
|
|
+ // unknown - 未知原因
|
|
|
+ String reason = "";
|
|
|
+
|
|
|
+ // 第一优先级:ASR空号识别结果(通过识别运营商提示音判断)
|
|
|
+ // emptyNumberDetectionCode 对应 cc_call_phone.callstatus 的状态码定义
|
|
|
+ if (emptyNumberDetectionCode == 33) reason = "empty_number"; // 空号
|
|
|
+ else if (emptyNumberDetectionCode == 31) reason = "busy"; // 忙线
|
|
|
+ else if (emptyNumberDetectionCode == 34) reason = "no_answer"; // 未接听
|
|
|
+ else if (emptyNumberDetectionCode == 35) reason = "suspended"; // 停机
|
|
|
+ else if (emptyNumberDetectionCode == 32) reason = "off"; // 关机
|
|
|
+ else if (emptyNumberDetectionCode == 37) reason = "assistant"; // 语音助手
|
|
|
+ else if (emptyNumberDetectionCode == 38) reason = "unavailable"; // 无法接通
|
|
|
+ else if (emptyNumberDetectionCode == 39) reason = "call_restriction"; // 呼入限制
|
|
|
+ else if (emptyNumberDetectionCode == 36) reason = "network_busy"; // 网络忙
|
|
|
+
|
|
|
+ // 第二优先级:ASR未命中时,根据FreeSWITCH返回的SIP状态码推断
|
|
|
+ // hangupCause 格式示例:"USER_BUSY:sip:486"、"DESTINATION_OUT_OF_ORDER:null"
|
|
|
+ if (reason.isEmpty()) {
|
|
|
+ if (hangupCause.contains("USER_BUSY") || hangupCause.contains("486")) reason = "busy"; // SIP 486 用户忙
|
|
|
+ else if (hangupCause.contains("NO_ANSWER") || hangupCause.contains("NO_USER_RESPONSE")) reason = "no_answer"; // 无应答
|
|
|
+ else if (hangupCause.contains("UNALLOCATED_NUMBER") || hangupCause.contains("DOES_NOT_EXIST_ANYWHERE") || hangupCause.contains("604")) reason = "empty_number"; // SIP 604 号码不存在
|
|
|
+ else if (hangupCause.contains("SUBSCRIBER_ABSENT")) reason = "suspended"; // 用户不在服务区/停机
|
|
|
+ else if (hangupCause.contains("CALL_REJECTED") || hangupCause.contains("603")) reason = "no_answer"; // SIP 603 拒接
|
|
|
+ else if (hitLineError) reason = "line_error"; // 线路故障(404/503/480/408)
|
|
|
+ else reason = "unknown"; // 未知原因
|
|
|
+ }
|
|
|
+ phoneInfo.setUnconnectedReason(reason);
|
|
|
+ log.info("{} unconnected reason: {}", getTraceId(), reason);
|
|
|
}
|
|
|
|
|
|
if (emptyNumberDetectionCode > 0) {
|