freeswitch透传带SDP的180

 

概述

freeswitch是一款简单好用的VOIP开源软交换平台。

freeswitch对于180/183的消息处理有默认的规则,但是在3GPP的标准中,消息流程会更加复杂,场景更多变。

这样就需要我们根据实际环境中的场景定制消息流程。

本文只讨论带SDP的183/180消息。

环境

centos:CentOS  release 7.0 (Final)或以上版本

freeswitch:v1.10.7

GCC:4.8.5

fs中183/180的默认处理

fs收到183(SDP)的时候,会透传183(SDP)到A路。

fs收到180(SDP)的时候,默认将180(SDP)转换为183(SDP)传给A路。

在设置了参数“early_use_180”的场景下,fs会把183(SDP)和180(SDP)都转换为180(SDP)传给A路。

期望的183/180处理流程。

fs收到183(SDP)的时候,会透传183(SDP)到A路。

fs收到180(SDP)的时候,会透传180(SDP)到A路。

修改方案

修改方案,在B路处理180(SDP)消息的流程中,设置通道变量“180withsdp=true”,在A路响应183/180消息的流程中,检查通道变量“180withsdp”的值并设置响应的消息码。

修改 src\mod\endpoints\mod_sofia\sofia.c,7537行

if (status == 180 && r_sdp) {

       status = 183;

       if (switch_true(switch_channel_get_variable(channel, "passthrough180")))

       {

              //设置通道变量,标记B路的180+SDP,在A路响应时,处理send_sip_code为180+SDP

              if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS)

              {

                     other_channel = switch_core_session_get_channel(other_session);

                     switch_channel_set_variable(other_channel, "180withsdp", "true");

                     switch_core_session_rwunlock(other_session);

              }

       }

}

修改 src\mod\endpoints\mod_sofia\mod_sofia.c,2548行

if (switch_true(switch_channel_get_variable(channel, "passthrough180")) &&

       switch_true(switch_channel_get_variable(channel, "180withsdp")) )

{

       send_sip_code = 180;

       p_send_sip_msg = sip_180_Ringing;

}

重新编译安装mod_sofia模块。

修改拨号计划如下。

<include>

       <context name="out2in">

              <extension name="sbc-out2in" continue="true">

                     <condition field="destination_number" expression="^(\d+)$">

                            <action application="export" data="passthrough180=true" />

                            <action application="bridge" data="{sip_invite_call_id=${sip_call_id}

                                   }sofia/external/sip:${destination_number}@10.55.55.138:5555"/>

                     </condition>

              </extension>

       </context>

</include>

测试

搭建测试环境,B路响应180(SDP)。

 

总结

常见的消息处理流程都可以在mod_sofia中找到,但是对于AB路之间的消息透传,以及涉及到codec媒体协商的流程会比较复杂。

空空如常

求真得真

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值