FS 主动发起挂断 —— EMS 通话识别「通话中」触发

排查方向:==CMS 日志搜 hangupDisposition,值为 send_bye → BYE 由 FS 主动发出 → 拿挂断leg的 connId 去 FS 日志 grep → 本例同毫秒出现 mod_em「识别结果: 通话中[5]」+ Hangup,即 EMS 通话识别判定「通话中」后 FS 发起挂断==

涉及日志

项目 值
通话时间 2026-10-23 09:30:56 ~ 09:31:00(全程 4s,answer=null)
callId d89f96b9-03b5-4770-8e84-99accf6c0ddb(A腿/坐席侧 uuid)
connId 97bbf40c-42bb-45d5-92d9-f495726006aa(B腿/客户侧 channel uuid,查 FS 日志用这个)
坐席 10000001(坐席A,示例租户,agent00000001)
客户 13900000004(示例客户公司)
domain tenant.example
呼叫类型 Outbound(CPA 外呼,sdata cpa=60)
挂断信息 NORMAL_CLEARING / reason=UserDrop / cause=CPA / failedCode=9(通话中)
CMS 节点 cms-58f8c7bf67-4t5qc,mediaServer=192.168.200.28
日志来源 CMS:trace_2026-10-23-09.1.log.zip;FS:freeswitch.log.3

① CMS 挂断事件(定位 send_bye)

1
23/09:31:00.666 INFO (FSHangupEventHandler) [] - Handle FSHangupCompleteEvent event eventName- CHANNEL_HANGUP_COMPLETE| domain- tenant.example| caller- 10000001| callee- 913900000004| deviceId- 10000001| callDirection-outbound| callId- d89f96b9-03b5-4770-8e84-99accf6c0ddb | connId-d89f96b9-03b5-4770-8e84-99accf6c0ddb -- NORMAL_CLEARING; callCause=MakeCall,hangupDisposition=send_bye,wellcloudCallee=null,callMode=null,mos=4.50,audioQuality=100.00,action=null,sipFailureStatus=null,sipFailurePhrase=null,cause=null,redirectedTo=null,calleeDomain=tenant.example,sipTermStatus=null   ★ hangupDisposition=send_bye → BYE 由 FS 主动发出,排查方向转到 FS 侧

② CMS 呼叫信息(对账用)

1
23/09:31:00.667 INFO (FSHangupEventHandler) [] - 呼叫已经结束,3秒后清除呼叫信息 callId=d89f96b9-03b5-4770-8e84-99accf6c0ddb,callInfo=… type=Outbound,domain=tenant.example,start=Fri Oct 23 09:30:56 CST 2026,end=Fri Oct 23 09:31:00 CST 2026,reason=UserDrop … sdata={branchId=…, agentId=agent00000001@tenant.example, displayDest=13900000004, cpa=60, prefix=9, …} … customer=[id=…,device=913900000004@tenant.example,phone=13900000004,pos=1,start=Fri Oct 23 09:30:56 CST 2026,ring=Fri Oct 23 09:30:58 CST 2026,answer=null,end=Fri Oct 23 09:31:00 CST 2026,reason=UserDrop,result=HoldOn,trunk=prod-vos-tenant01-null,…]   ← 客户腿 answer=null:从未应答,只有振铃(09:30:58 起,2 秒后被挂)
1
23/09:31:00.667 DEBUG (JMQEventDispatcher) [] - >>>>> 开始发送事件 … topic=…extension_event_prd1, body={…"eventName":"failed","callType":"Outbound","calledDevice":"913900000004@tenant.example","cause":"CPA","failedCode":"9","failedMsg":"通话中","localState":"Fail",…}   ← failed 事件带 cause=CPA、failedCode=9(通话中),与 FS 侧识别结果对得上

③ FS 侧日志(connId 97bbf40c 定位,爆点)

1
2
3
4
5
6
97bbf40c-42bb-45d5-92d9-f495726006aa 2026-10-23 09:30:58.239667 [DEBUG] switch_rtp.c:1982 rtcp_stats_init: audio ssrc[1794213225] base_seq[65042]
97bbf40c-42bb-45d5-92d9-f495726006aa 2026-10-23 09:30:58.259671 [DEBUG] switch_rtp.c:7934 Correct audio ip/port confirmed. ← early media 已建立(未应答先有媒体),EMS 分析的就是这段音频
97bbf40c-42bb-45d5-92d9-f495726006aa 2026-10-23 09:31:00.619669 [WARNING] mod_em.c:320 failed to send data to ems: 32 ← 停止识别时的伴随告警,不是根因
97bbf40c-42bb-45d5-92d9-f495726006aa 2026-10-23 09:31:00.619669 [DEBUG] mod_em.c:245 停止识别
97bbf40c-42bb-45d5-92d9-f495726006aa 2026-10-23 09:31:00.619669 [NOTICE] mod_em.c:164 识别结果: 通话中[5], 0, music: false ★ EMS 通话识别判定「通话中」
97bbf40c-42bb-45d5-92d9-f495726006aa 2026-10-23 09:31:00.619669 [NOTICE] mod_em.c:276 Hangup sofia/external/913900000004@192.168.200.181:18627 [CS_EXCHANGE_MEDIA] [NORMAL_CLEARING] ★ 紧接上一行,FS 发起挂断(主动发 BYE)

关键观察

  1. hangupDisposition=send_bye:BYE 由 FS 主动发出,触发挂断的逻辑在 FS 侧,去 FS 日志找原因,不要去查对端/线路
  2. 查 FS 日志用挂断腿的 connId(97bbf40c-…,B腿/客户侧 channel uuid),不是 callId(A腿 uuid);两条腿的 uuid 不同
  3. FS 侧 09:31:00.619 同一毫秒内依次打印:停止识别 → 识别结果: 通话中[5] → Hangup [NORMAL_CLEARING],识别结果紧贴在 Hangup 之前,挂断是识别结果的直接动作
  4. CMS 侧 cause=CPA、failedCode=9(通话中)与 FS 侧 mod_em 识别结果一致,两端对得上
  5. 客户腿 answer=null(未应答,仅 early media),呼出 2 秒多即被识别挂断;该判读是否符合业务预期,见 0.3 的 EMS 复核建议

0. 原因分析

0.1 hangupDisposition 怎么读

CMS 的 FSHangupCompleteEvent 处理日志里,hangupDisposition 标记 BYE 的发起方向:

取值 含义 排查方向
send_bye FS 主动发出 BYE 去 FS 日志查是什么逻辑触发挂断(本文场景)
非 send_bye(收到对端 BYE / 失败响应) 对端或线路侧先挂 排查方向转向对端设备、运营商线路

0.2 时间线

时刻 侧 事件
09:30:56 CMS MakeCall 发起外呼:坐席 10000001 → 客户 13900000004,type=Outbound(CPA)
09:30:58 CMS/FS 客户腿振铃(ring);FS B腿 early media 建立(Correct audio ip/port confirmed)
09:31:00.619 FS mod_em 停止识别,识别结果:通话中[5], 0, music: false
09:31:00.619 FS mod_em.c:276 Hangup … [CS_EXCHANGE_MEDIA] [NORMAL_CLEARING] ← FS 主动发 BYE
09:31:00.666 CMS 收 CHANNEL_HANGUP_COMPLETE,hangupDisposition=send_bye
09:31:00.667 CMS 发 failed 事件(cause=CPA、failedCode=9 通话中),reason=UserDrop,呼叫清理

0.3 根因

本通是 CPA 外呼(sdata cpa=60):B 腿呼出后由 FS 的 mod_em 模块把媒体流送 EMS 做通话识别(区分回铃/彩铃/通话中等状态)。客户腿实际未应答(answer=null),只有 early media 在流动;early media 建立约 2.4 秒后(09:30:58.259 → 09:31:00.619),EMS 将音频判定为「通话中[5]」(music: false),mod_em 随即对该腿执行挂断(mod_em.c:276 Hangup … NORMAL_CLEARING),FS 发出 BYE。CMS 收到挂断事件(send_bye)后按识别结果上报 failed(cause=CPA、failedCode=9 通话中)。

结论:这通电话不是坐席或客户挂的。EMS 把未应答阶段的音频判成「通话中」,FS 的 mod_em 据此主动挂断并发 BYE。

  • failed to send data to ems: 32(WARNING)出现在停止识别同一毫秒,是挂断时停止发送的伴随告警,不是根因
  • 若业务上此时不该判「通话中」(未接听的回铃阶段被判成通话中),属于 EMS 侧误判:需 EMS 侧复核判定音频(是否把回铃/彩铃误判),并核对 CPA 参数与 EMS 识别配置

1. 排障步骤

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# ① CMS 日志确认谁发起的挂断:搜挂断事件,看 hangupDisposition
zgrep "callId- d89f96b9-03b5-4770-8e84-99accf6c0ddb" trace_2026-10-23-09*.log.zip | grep hangupDisposition
# hangupDisposition=send_bye → FS 主动发 BYE,继续②;不是 send_bye → 转查对端/线路

# ② 拿挂断腿的 connId(B腿 channel uuid)去对应 mediaServer 的 FS 日志定位
grep "97bbf40c-42bb-45d5-92d9-f495726006aa" freeswitch.log*

# ③ 看挂断时刻(Hangup NOTICE)之前的最后一屏日志,找触发源。常见 FS 主动挂断触发关键字:
# mod_em / mod_unimrcp → 识别结果触发(本文场景)
# sched_hangup → 定时/超时挂断
# originate_timeout / bridge 超时
# Audio Timeout / RTP Timeout → 媒体超时
# Hangup … [CS_…] [cause] → cause 对照 FS 挂断原因表
# 本例命中:识别结果: 通话中[5] → 同毫秒 Hangup → EMS 通话识别触发

# ④ 回 CMS 对账:callInfo 里 answer/cause/failedCode 与 FS 侧结论互证
# 本例:answer=null + cause=CPA + failedCode=9(通话中)↔ FS 侧「识别结果: 通话中[5]」

2. 验证结论

1
2
3
4
5
6
7
8
9
10
11
12
# ① 时序验证:识别结果必须早于/同毫秒于 Hangup(同一 connId)
grep "97bbf40c-42bb-45d5-92d9-f495726006aa" freeswitch.log* | grep -E "识别结果|停止识别|Hangup"
# 期望输出(同一时间戳 09:31:00.619669,打印顺序固定):
# mod_em.c:245 停止识别
# mod_em.c:164 识别结果: 通话中[5], 0, music: false
# mod_em.c:276 Hangup … [CS_EXCHANGE_MEDIA] [NORMAL_CLEARING]

# ② CMS 侧验证:send_bye + CPA 失败码
zgrep "d89f96b9-03b5-4770-8e84-99accf6c0ddb" trace_2026-10-23-09*.log.zip | grep -E "send_bye|failedCode"
# 期望输出:
# hangupDisposition=send_bye
# "cause":"CPA","failedCode":"9","failedMsg":"通话中"

两端结论对上(FS:识别在先、挂断在后;CMS:send_bye + cause=CPA/通话中),即可坐实挂断是 EMS 通话识别触发的。

3. RFC 与参考文档

3.1 会话终止(BYE)

  • RFC 3261 §15 Terminating a Session:BYE 用于主动结束已建立的会话,由挂断发起方作为 UAC 发出。send_bye 即 FS 侧主动构造并发送 BYE;收到对端 BYE 则是相反方向
  • RFC 3326 The Session Initiation Protocol (SIP) Reason Header:BYE 可携带 Reason 头表达释放原因(对应 FS 的 hangup cause 传递,如 NORMAL_CLEARING=16)

3.2 实现层

  • FreeSWITCH sofia.c 的 Hangup … [CS_…] [cause] NOTICE 日志:channel 状态机进入 CS_HANGUP 的统一入口,cause 见 FS switch_types.h 的 SWITCH_CAUSE 表(NORMAL_CLEARING=16)
  • mod_em:平台自研 EMS 通话识别(CPA)模块,负责把媒体送 EMS 分类(回铃/彩铃/通话中等)并按识别结果执行动作(本例为挂断),属内部实现,无公开 RFC

4. 附录

4.1 日志锚点

来源 关键行 说明
trace_2026-10-23-09.1.log.zip hangupDisposition=send_bye BYE 由 FS 主动发出,排查入口
trace_2026-10-23-09.1.log.zip answer=null … reason=UserDrop 客户腿从未应答,全程 4s
trace_2026-10-23-09.1.log.zip "cause":"CPA","failedCode":"9","failedMsg":"通话中" CMS 上报的 CPA 识别结果
freeswitch.log.3 mod_em.c:164 识别结果: 通话中[5], 0, music: false EMS 通话识别判定
freeswitch.log.3 mod_em.c:276 Hangup … [NORMAL_CLEARING] FS 主动挂断动作(爆点)
freeswitch.log.3 mod_em.c:320 failed to send data to ems: 32 停止识别的伴随 WARNING,非根因

4.2 相关文档


© 2018–2026 小周周 · 使用 Stellar 构建

站内搜索

没有找到内容!