0


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媒体协商的流程会比较复杂。

空空如常

求真得真

标签: 开发语言 voip

本文转载自: https://blog.csdn.net/qiuzhendezhen/article/details/131112738
版权归原作者 求真得真 所有, 如有侵权,请联系我们删除。

“freeswitch透传带SDP的180”的评论:

还没有评论