首页 > 其他分享 >freeswitch如何判断挂机方

freeswitch如何判断挂机方

时间:2022-11-16 17:56:44浏览次数:51  
标签:判断 send hangup sip disposition freeswitch bye 挂机

 

 

概述

freeswitch作为VOIP的软交换平台,需要对呼叫的信息做判断和归类。

常见的呼叫信息中,挂机方向的信息对于话单统计有很大的用处。

但是fs的原始话单和日志中并没有挂机方向的信息。

环境

centos:CentOS7

freeswitch:v1.10.7

GCC:4.8.5

测试方案

启动freeswitch之后,通过fs_cli查看打印信息,在命令行输入挂机事件监听命令。

[email protected]> /event plain CHANNEL_HANGUP_COMPLETE

RECV EVENT

Event-Name: CHANNEL_HANGUP_COMPLETE

Call-Direction: inbound

variable_sip_hangup_disposition: send_bye

 

RECV EVENT

Event-Name: CHANNEL_HANGUP_COMPLETE

Call-Direction: outbound

variable_sip_hangup_disposition: recv_bye

 

从console打印信息中,可以看到挂机事件有两路,inbound(aleg)和outbound(bleg)。

inbound(aleg)的“variable_sip_hangup_disposition”是“send_bye”,表示fs对A路发送了bye消息。

outbound(bleg)的“variable_sip_hangup_disposition”是“recv_bye”,表示fs从B路接收了bye消息。

从A路和B路的“variable_sip_hangup_disposition”可以得出该通呼叫的挂机方是被叫B路。

源码信息

通过“sip_hangup_disposition”搜索源代码,可以查找到该字段所有值的列表。

recv_bye

recv_cancel

recv_refuse

 

send_bye

send_cancel

send_refuse

 

我们以bleg的挂机事件中“sip_hangup_disposition”字段为例。

未接通的场景。

outbound(bleg)为send_cancel,A路挂机。

outbound(bleg)为recv_refuse,B路挂机。

 

接通的场景。

outbound(bleg)为send_bye,A路挂机。

outbound(bleg)为recv_bye,B路挂机。

总结

freeswitch作为软交换的场景下,不考虑fs自身挂断的情况,通过对挂机事件中的“sip_hangup_disposition”字段分析,可以得出呼叫的挂机方向。

如果fs作为业务服务器,业务流程中有拒绝呼叫的情况下,挂机方向的判断会更复杂。

可以在cdr_csv的配置中加入“${sip_hangup_disposition}”字段,辅助判断挂机方向。

 

空空如常

求真得真

标签:判断,send,hangup,sip,disposition,freeswitch,bye,挂机
From: https://www.cnblogs.com/qiuzhendezhen/p/16896823.html

相关文章