|
@@ -391,33 +391,37 @@ public class CallTask implements Runnable {
|
|
|
// network_busy - 网络忙(网络拥塞)
|
|
// network_busy - 网络忙(网络拥塞)
|
|
|
// line_error - 线路故障(SIP线路异常:404/503/480/408)
|
|
// line_error - 线路故障(SIP线路异常:404/503/480/408)
|
|
|
// unknown - 未知原因
|
|
// 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"; // 未知原因
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ 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);
|
|
|
|
|
+ } catch (Throwable e) {
|
|
|
|
|
+ log.error("{} failed to set unconnected reason: {} {}", getTraceId(), e.toString(), CommonUtils.getStackTraceString(e.getStackTrace()));
|
|
|
}
|
|
}
|
|
|
- phoneInfo.setUnconnectedReason(reason);
|
|
|
|
|
- log.info("{} unconnected reason: {}", getTraceId(), reason);
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (emptyNumberDetectionCode > 0) {
|
|
if (emptyNumberDetectionCode > 0) {
|