通过FreeSWITCH,Linphone呼叫WebRTC的视频不通问题解决

账号A(Linphone的IOS客户端)呼叫账号B,相同的呼叫操作操作。

如果账号B通过linphone的TCP注册到FS,FS作为B-leg会发送过来的INVITE消息中的SDP为:

2017-07-05 10:18:53.313008 [DEBUG] mod_sofia.c:90 sofia/internal/3001@172.18.8.14:5060 SOFIA INIT
2017-07-05 10:18:53.313008 [DEBUG] sofia_glue.c:1253 sip:3001@223.93.174.216:48983;transport=tcp Setting proxy route to sofia/internal/3001@172.18.8.14:5060
2017-07-05 10:18:53.313008 [DEBUG] sofia_glue.c:1282 sofia/internal/3001@172.18.8.14:5060 sending invite version: 1.6.12  64bit
Local SDP:
v=0
o=FreeSWITCH 1499189835 1499189836 IN IP4 120.27.248.33
s=FreeSWITCH
c=IN IP4 120.27.248.33
t=0 0
m=audio 31298 RTP/AVP 102 0 8 103 101
a=rtpmap:102 opus/48000/2
a=fmtp:102 useinbandfec=1; maxaveragebitrate=30000; maxplaybackrate=48000; ptime=20; minptime=10; maxptime=40; stereo=1
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:103 telephone-event/48000
a=fmtp:103 0-16
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv
m=video 28250 RTP/AVP 96
b=AS:256
a=rtpmap:96 VP8/90000
a=rtcp-fb:96 ccm fir
a=rtcp-fb:96 ccm tmmbr
a=rtcp-fb:96 nack
a=rtcp-fb:96 nack pli

 

账户B使用sipML的WebSocket注册到FS时,收到的FS发送过来的INVITE消息中SDP为:

 

2017-07-05 10:18:00.433013 [DEBUG] sofia_glue.c:1282 sofia/internal/3006@df7jal23ls0d.invalid 	 invite version: 1.6.12  64bit
Local SDP:
v=0
o=FreeSWITCH 1499193706 1499193707 IN IP4 120.27.248.33
s=FreeSWITCH
c=IN IP4 120.27.248.33
t=0 0
a=msid-semantic: WMS um09FCvgZw0FRK8COZAZEknMMgVkJrC3
m=audio 27374 RTP/SAVPF 102 0 8 103 101
a=rtpmap:102 opus/48000/2
a=fmtp:102 useinbandfec=1; maxaveragebitrate=30000; maxplaybackrate=48000; ptime=20; minptime=10; maxptime=40; stereo=1
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:103 telephone-event/48000
a=rtpmap:101 telephone-event/8000
a=fingerprint:sha-256 F1:00:B2:56:60:59:61:BF:27:B3:1C:CE:AF:E6:AB:79:CF:E1:04:36:CC:01:28:47:D5:F4:64:E6:6C:42:96:34
a=setup:actpass
a=rtcp-mux
a=rtcp:27374 IN IP4 120.27.248.33
a=ssrc:291447064 cname:Es39VogLL7gtHfVm
a=ssrc:291447064 msid:um09FCvgZw0FRK8COZAZEknMMgVkJrC3 a0
a=ssrc:291447064 mslabel:um09FCvgZw0FRK8COZAZEknMMgVkJrC3
a=ssrc:291447064 label:um09FCvgZw0FRK8COZAZEknMMgVkJrC3a0
a=ice-ufrag:4mczwqc9wXj5fLZJ
a=ice-pwd:4SIP7PqIMx2jCOwx0yXmOZla
a=candidate:5447911826 1 udp 659136 120.27.248.33 27374 typ host generation 0
a=candidate:5447911826 2 udp 659136 120.27.248.33 27374 typ host generation 0
a=ptime:20
a=sendrecv
m=video 16960 RTP/SAVPF 96
b=AS:256
a=rtpmap:96 VP8/90000
a=fingerprint:sha-256 F1:00:B2:56:60:59:61:BF:27:B3:1C:CE:AF:E6:AB:79:CF:E1:04:36:CC:01:28:47:D5:F4:64:E6:6C:42:96:34
a=setup:actpass
a=rtcp-mux
a=rtcp:16960 IN IP4 120.27.248.33
a=rtcp-fb:96 ccm fir
a=rtcp-fb:96 ccm tmmbr
a=rtcp-fb:96 nack
a=rtcp-fb:96 nack pli
a=ssrc:3836824708 cname:Es39VogLL7gtHfVm
a=ssrc:3836824708 msid:um09FCvgZw0FRK8COZAZEknMMgVkJrC3 v0
a=ssrc:3836824708 mslabel:um09FCvgZw0FRK8COZAZEknMMgVkJrC3
a=ssrc:3836824708 label:um09FCvgZw0FRK8COZAZEknMMgVkJrC3v0
a=ice-ufrag:PYA2DLzBmNZZPqwR
a=ice-pwd:mQ5PCkDyTZVUmZq2NQVhskJE
a=candidate:5820208970 1 udp 659136 120.27.248.33 16960 typ host generation 0
a=candidate:5820208970 2 udp 659135 120.27.248.33 16960 typ host generation 0
a=end-of-candidates

 

 

非WS注册到FreeSWITCH上,呼叫时,需要指定"media_webrtc=true",才会产生ICE相关的信息

    <action application="export" data="media_webrtc=true"/>                                                                                                                                                                                 
    <!--action application="export" data="add_ice_candidates=true"/-->
    <action application="bridge" data="user/${dialed_extension}@${domain_name}"/>

 

FreeSwitch源码中src/switch_rtp.c中, 默认webrtc相关的媒体流时加密的DTLS方式的,如果你建立的UDP不是加密的,FS不会进行转发到另一端。这个逻辑判断是根据WebRTC的W3C标准来的。我们自己不需要加密,所以,我把这个逻辑判断给屏蔽了。

static int rtp_write_ready(switch_rtp_t *rtp_session, uint32_t bytes, int line)
{
    if (!rtp_session) return 0;
 
    if (rtp_session->ice.ice_user && !(rtp_session->ice.rready || rtp_session->ice.ready)) {
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG3, "Skip sending %s packet %ld bytes (ice not ready @ line %d!)\n",
                          rtp_type(rtp_session), (long)bytes, line);
        return 0;
    }
 
#if 0//wangweichao add for support pjsip with webrtc --20170706---                                                                                                                                                                          
 
    if (rtp_session->dtls && rtp_session->dtls->state != DS_READY) {
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG3, "Skip sending %s packet %ld bytes (dtls not ready @ line %d!)\n",
                          rtp_type(rtp_session), (long)bytes, line);
 
        return 0;
    }
#endif
    return 1;
}

转载于:https://my.oschina.net/andywang1988/blog/1186669

  • 1
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
#0 Homer::RtpSessionState::deprovisionAtDestruction (this=0x7f1fe00e7650) at ../components/mos/state/session_state/src/rtp_session_state.cpp:886 886 ../components/mos/state/session_state/src/rtp_session_state.cpp: No such file or directory. [Current thread is 1 (Thread 0x7f1ffffff700 (LWP 372))] (gdb) bt #0 Homer::RtpSessionState::deprovisionAtDestruction (this=0x7f1fe00e7650) at ../components/mos/state/session_state/src/rtp_session_state.cpp:886 #1 0x00005653759a8e33 in Homer::DeviceState::~DeviceState (this=0x7f1fe00ecf50) at ../components/mos/state/device_state/src/device_state.cpp:87 #2 0x0000565375c4229e in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release (this=0x7f1fe00ecf40) at /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/shared_ptr_base.h:155 #3 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count (this=0x7f1fe00bbb08) at /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/shared_ptr_base.h:730 #4 std::__shared_ptr<Homer::DeviceStateBase, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr (this=0x7f1fe00bbb00) at /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/shared_ptr_base.h:1169 #5 Homer::Device::~Device (this=0x7f1fe00bb070) at ../components/mos/device/src/device.cpp:94 #6 0x0000565375c3c08a in Homer::WebsocketDevice::~WebsocketDevice (this=0x7f1fe00bb070) at ../components/mos/device/src/websocket_device.h:31 #7 Homer::WebsocketClientDevice::~WebsocketClientDevice (this=0x7f1fe00bb070) at ../components/mos/device/src/websocket_client_device.cpp:20
06-13

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值