signalwire / freeswitch

FreeSWITCH is a Software Defined Telecom Stack enabling the digital transformation from proprietary telecom switches to a versatile software implementation that runs on any commodity hardware. From a Raspberry PI to a multi-core server, FreeSWITCH can unlock the telecommunications potential of any device.
https://freeswitch.com/#getting-started
Other
3.59k stars 1.42k forks source link

When freeswitch is running on the public network, sip can be connected, and ext-rtp-ip is configured as the public ip address, but the video and voice cannot be connected #2229

Open zhangaijing opened 1 year ago

zhangaijing commented 1 year ago

Our freeswitch uses docker to run on a server with fixed IP mapping, and uses web and android to connect freeswitch through the public network. web and android are in the same LAN. We have configured ext-rtp-ip and ext-sip-ip public ip addresses in freeswitch. Now, you can call android from the web side, but there is no video and sound. The debugging logs of freeswitch show that sdp information uses public ip addresses. We use tcpdump on the server to capture udp packets and find that the data is sent from freeswitch's LAN ip address to the Intranet ip address of the web end. The captured packet logs are as follows :(192.168.2.202 is freeswitch's Intranet ip address, 192.168.201.19 is the Intranet ip address of the web side).

tcpdump: listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
16:15:15.392172 IP (tos 0x0, ttl 64, id 43423, offset 0, flags [DF], proto UDP (17), length 184)
    192.168.2.202.30620 > 192.168.201.19.55024: UDP, length 156
16:15:16.392174 IP (tos 0x0, ttl 64, id 43607, offset 0, flags [DF], proto UDP (17), length 184)
    192.168.2.202.30620 > 192.168.201.19.55024: UDP, length 156
16:15:17.412172 IP (tos 0x0, ttl 64, id 43808, offset 0, flags [DF], proto UDP (17), length 184)
    192.168.2.202.30620 > 192.168.201.19.55024: UDP, length 156
16:15:18.412186 IP (tos 0x0, ttl 64, id 44006, offset 0, flags [DF], proto UDP (17), length 184)
    192.168.2.202.30620 > 192.168.201.19.55024: UDP, length 156
16:15:19.432172 IP (tos 0x0, ttl 64, id 44198, offset 0, flags [DF], proto UDP (17), length 184)
    192.168.2.202.30620 > 192.168.201.19.55024: UDP, length 156
16:15:20.432178 IP (tos 0x0, ttl 64, id 44417, offset 0, flags [DF], proto UDP (17), length 184)
    192.168.2.202.30620 > 192.168.201.19.55024: UDP, length 156
16:15:21.432173 IP (tos 0x0, ttl 64, id 44484, offset 0, flags [DF], proto UDP (17), length 184)
    192.168.2.202.30620 > 192.168.201.19.55024: UDP, length 156
16:15:22.452172 IP (tos 0x0, ttl 64, id 44606, offset 0, flags [DF], proto UDP (17), length 184)
    192.168.2.202.30620 > 192.168.201.19.55024: UDP, length 156
16:15:23.452172 IP (tos 0x0, ttl 64, id 44686, offset 0, flags [DF], proto UDP (17), length 184)
    192.168.2.202.30620 > 192.168.201.19.55024: UDP, length 156
16:15:24.452172 IP (tos 0x0, ttl 64, id 44868, offset 0, flags [DF], proto UDP (17), length 184)
    192.168.2.202.30620 > 192.168.201.19.55024: UDP, length 156
16:15:25.472174 IP (tos 0x0, ttl 64, id 45025, offset 0, flags [DF], proto UDP (17), length 184)
    192.168.2.202.30620 > 192.168.201.19.55024: UDP, length 156
16:15:26.492176 IP (tos 0x0, ttl 64, id 45074, offset 0, flags [DF], proto UDP (17), length 184)
    192.168.2.202.30620 > 192.168.201.19.55024: UDP, length 156
16:15:27.512170 IP (tos 0x0, ttl 64, id 45140, offset 0, flags [DF], proto UDP (17), length 184)
    192.168.2.202.30620 > 192.168.201.19.55024: UDP, length 156
16:15:28.512171 IP (tos 0x0, ttl 64, id 45243, offset 0, flags [DF], proto UDP (17), length 184)
    192.168.2.202.30620 > 192.168.201.19.55024: UDP, length 156
16:15:29.532169 IP (tos 0x0, ttl 64, id 45381, offset 0, flags [DF], proto UDP (17), length 184)
    192.168.2.202.30620 > 192.168.201.19.55024: UDP, length 156

sdp information sent by the web end:

2023-09-07 16:14:54.996874 94.20% [DEBUG] sofia.c:7509 Remote SDP:
v=0
o=- 7293919135199983576 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE 0 1
a=extmap-allow-mixed
a=msid-semantic: WMS IJwo1Yjh5jGKs6vDHaLoBtuAvXt0VirpTj3R
m=audio 55024 UDP/TLS/RTP/SAVPF 111 63 103 104 9 0 8 106 105 13 110 112 113 126
c=IN IP4 182.127.166.148
a=rtpmap:111 opus/48000/2
a=fmtp:111 minptime=10;useinbandfec=1
a=rtpmap:63 red/48000/2
a=fmtp:63 111/111
a=rtpmap:103 ISAC/16000
a=rtpmap:104 ISAC/32000
a=rtpmap:9 G722/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:106 CN/32000
a=rtpmap:105 CN/16000
a=rtpmap:13 CN/8000
a=rtpmap:110 telephone-event/48000
a=rtpmap:112 telephone-event/32000
a=rtpmap:113 telephone-event/16000
a=rtpmap:126 telephone-event/8000
a=rtcp:9 IN IP4 0.0.0.0
a=candidate:3983693318 1 udp 2122260223 192.168.201.19 55024 typ host generation 0 network-id 1
a=candidate:438629258 1 udp 2122189567 2001::201:f8ce:537d:fbad:85e 55025 typ host generation 0 network-id 2
a=candidate:1712315636 1 udp 2122124031 2001::201:1de2:6dba:c06:3a5b 55026 typ host generation 0 network-id 3
a=candidate:332956306 1 tcp 1518280447 192.168.201.19 9 typ host tcptype active generation 0 network-id 1
a=candidate:3834521374 1 tcp 1518209791 2001::201:f8ce:537d:fbad:85e 9 typ host tcptype active generation 0 network-id 2
a=candidate:2560952416 1 tcp 1518144255 2001::201:1de2:6dba:c06:3a5b 9 typ host tcptype active generation 0 network-id 3
a=candidate:2426913842 1 udp 1686052607 182.127.166.148 55024 typ srflx raddr 192.168.201.19 rport 55024 generation 0 network-id 1
a=ice-ufrag:cjAJ
a=ice-pwd:u0OarJ8SAqJZdbhUYDrF4og2
a=ice-options:trickle
a=fingerprint:sha-256 C8:95:06:90:82:73:91:9E:3B:BF:A8:26:60:09:67:06:BC:7B:AD:5B:D0:19:58:A5:16:E4:77:C8:65:23:04:CF
a=setup:actpass
a=mid:0
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid
a=msid:IJwo1Yjh5jGKs6vDHaLoBtuAvXt0VirpTj3R b708786d-4a5b-47ae-a805-e9379ff97945
a=rtcp-mux
a=rtcp-fb:111 transport-cc
a=ssrc:3440780071 cname:jzr72L6qSaOVUVb4
a=ssrc:3440780071 msid:IJwo1Yjh5jGKs6vDHaLoBtuAvXt0VirpTj3R b708786d-4a5b-47ae-a805-e9379ff97945
m=video 55027 UDP/TLS/RTP/SAVPF 96 97 98 99 100 101 35 36 37 38 102 122 127 121 125 107 108 109 124 120 39 40 41 42 43 44 45 46 47 48 123 119 114 115 116 49

sdp information about freeswitch:

Local SDP:
v=0
o=FreeSWITCH 1694053053 1694053054 IN IP4 202.108.245.149
s=FreeSWITCH
c=IN IP4 202.108.245.149
t=0 0
m=audio 21442 RTP/AVP 102 9 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:9 G722/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:103 telephone-event/48000
a=fmtp:103 0-15
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=ptime:20
a=sendrecv
m=video 20440 RTP/AVP 96 102 127 125 108 124 123
b=AS:3072
a=rtpmap:96 VP8/90000
a=rtpmap:102 H264/90000
a=fmtp:102 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f
a=rtpmap:127 H264/90000
a=fmtp:127 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42001f
a=rtpmap:125 H264/90000
a=fmtp:125 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f
a=rtpmap:108 H264/90000
a=fmtp:108 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42e01f
a=rtpmap:124 H264/90000
a=fmtp:124 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=4d001f
a=rtpmap:123 H264/90000
a=fmtp:123 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=64001f
a=sendrecv
a=rtcp-fb:96 ccm fir
a=rtcp-fb:96 ccm tmmbr
a=rtcp-fb:96 nack
a=rtcp-fb:96 nack pli
a=rtcp-fb:102 ccm fir
a=rtcp-fb:102 ccm tmmbr
a=rtcp-fb:102 nack
a=rtcp-fb:102 nack pli
a=rtcp-fb:127 ccm fir
a=rtcp-fb:127 ccm tmmbr
a=rtcp-fb:127 nack
a=rtcp-fb:127 nack pli
a=rtcp-fb:125 ccm fir
a=rtcp-fb:125 ccm tmmbr
a=rtcp-fb:125 nack
a=rtcp-fb:125 nack pli
a=rtcp-fb:108 ccm fir
a=rtcp-fb:108 ccm tmmbr
a=rtcp-fb:108 nack
a=rtcp-fb:108 nack pli
a=rtcp-fb:124 ccm fir
a=rtcp-fb:124 ccm tmmbr
a=rtcp-fb:124 nack
a=rtcp-fb:124 nack pli
a=rtcp-fb:123 ccm fir
a=rtcp-fb:123 ccm tmmbr
a=rtcp-fb:123 nack
a=rtcp-fb:123 nack pli

sdp information sent by android:

v=0
o=386001 485 2147 IN IP4 192.168.201.230
s=Talk
c=IN IP4 192.168.201.230
t=0 0
m=audio 20000 RTP/AVP 0 101
a=rtpmap:101 telephone-event/8000
m=video 25001 RTP/AVP 102
a=rtpmap:102 H264/90000
a=fmtp:102 profile-level-id=42801F; packetization-mode=1
a=rtcp-fb:* trr-int 1000
a=rtcp-fb:* nack
a=rtcp-fb:* ccm tmmbr
a=rtcp-fb:102 nack pli
a=rtcp-fb:102 ccm fir

sdp information about freeswitch:

2023-09-07 16:14:55.197213 93.77% [DEBUG] mod_sofia.c:913 Local SDP sofia/internal/386311@202.108.245.149:5060:
v=0
o=FreeSWITCH 1694043875 1694043876 IN IP4 202.108.245.149
s=FreeSWITCH
c=IN IP4 202.108.245.149
t=0 0
a=msid-semantic: WMS j2Fb6VDxYgugsJPMJXnX083M4ADb6Wyg
m=audio 30620 UDP/TLS/RTP/SAVPF 111 110
a=rtpmap:111 opus/48000/2
a=fmtp:111 useinbandfec=1; minptime=10
a=rtpmap:110 telephone-event/48000
a=ptime:20
a=sendrecv
a=fingerprint:sha-256 CD:7D:19:53:CF:FE:AF:EB:F8:C8:97:FC:E3:1C:DA:4A:5D:94:E4:92:0B:99:46:12:69:8B:BC:E0:D4:79:85:BF
a=setup:active
a=rtcp-mux
a=rtcp:30620 IN IP4 202.108.245.149
a=ice-ufrag:cZq3XjFSK9UGWiMB
a=ice-pwd:cUcRvclcwUcp9OScD85riBaS
a=candidate:1778417684 1 udp 2130706431 202.108.245.149 30620 typ host generation 0
a=end-of-candidates
a=ssrc:2902462790 cname:O3hLPL9DRuJ93pLD
a=ssrc:2902462790 msid:j2Fb6VDxYgugsJPMJXnX083M4ADb6Wyg a0
a=ssrc:2902462790 mslabel:j2Fb6VDxYgugsJPMJXnX083M4ADb6Wyg
a=ssrc:2902462790 label:j2Fb6VDxYgugsJPMJXnX083M4ADb6Wyga0
m=video 20146 UDP/TLS/RTP/SAVPF 102
b=AS:3072
a=rtpmap:102 H264/90000
a=fmtp:102 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f
a=sendonly
a=fingerprint:sha-256 CD:7D:19:53:CF:FE:AF:EB:F8:C8:97:FC:E3:1C:DA:4A:5D:94:E4:92:0B:99:46:12:69:8B:BC:E0:D4:79:85:BF
a=setup:active
a=rtcp-mux
a=rtcp:20146 IN IP4 202.108.245.149
a=rtcp-fb:102 ccm fir
a=rtcp-fb:102 nack
a=rtcp-fb:102 nack pli
a=ssrc:2055447295 cname:O3hLPL9DRuJ93pLD
a=ssrc:2055447295 msid:j2Fb6VDxYgugsJPMJXnX083M4ADb6Wyg v0
a=ssrc:2055447295 mslabel:j2Fb6VDxYgugsJPMJXnX083M4ADb6Wyg
a=ssrc:2055447295 label:j2Fb6VDxYgugsJPMJXnX083M4ADb6Wygv0
a=ice-ufrag:OvgOhHOEqoBffJot
a=ice-pwd:L46D2BNPy2pUWkTAF0fMyTgO
a=candidate:4691532201 1 udp 2130706431 202.108.245.149 20146 typ host generation 0
a=end-of-candidates

Other log information:

2023-09-07 16:14:55.176880 93.77% [DEBUG] switch_core_media.c:3675 Set VIDEO Codec sofia/internal/386311@202.108.245.149:5060 H264/90000 0 ms
2023-09-07 16:14:55.176880 93.77% [DEBUG] switch_core_media.c:4344 Save video Candidate cid: 1 proto: udp type: host addr: 192.168.201.19:55027
2023-09-07 16:14:55.176880 93.77% [DEBUG] switch_core_media.c:4338 Drop video Candidate cid: 1 proto: udp type: host addr: 2001::201:f8ce:537d:fbad:85e:55028 (no network path)
2023-09-07 16:14:55.176880 93.77% [DEBUG] switch_core_media.c:4338 Drop video Candidate cid: 1 proto: udp type: host addr: 2001::201:1de2:6dba:c06:3a5b:55029 (no network path)
2023-09-07 16:14:55.176880 93.77% [DEBUG] switch_core_media.c:4344 Save video Candidate cid: 1 proto: udp type: srflx addr: 182.127.166.148:55027
2023-09-07 16:14:55.176880 93.77% [DEBUG] switch_core_media.c:4389 Searching for rtp candidate.
2023-09-07 16:14:55.176880 93.77% [DEBUG] switch_core_media.c:4398 Choose rtp candidate, index 0, 192.168.201.19:55027
2023-09-07 16:14:55.176880 93.77% [DEBUG] switch_core_media.c:4138 sofia/internal/386311@202.108.245.149:5060 choosing family v4
2023-09-07 16:14:55.176880 93.77% [DEBUG] switch_core_media.c:4409 Choose same candidate, index 0, for rtcp based on rtcp-mux attribute 192.168.201.19:55027
2023-09-07 16:14:55.176880 93.77% [DEBUG] switch_core_media.c:4461 setting remote video ice addr to index 0 192.168.201.19:55027 based on candidate
2023-09-07 16:14:55.176880 93.77% [DEBUG] switch_core_media.c:4496 Setting remote rtcp video addr to 192.168.201.19:55027 based on candidate
2023-09-07 16:14:55.176880 93.77% [DEBUG] switch_core_media.c:8777 AUDIO RTP [sofia/internal/386311@202.108.245.149:5060] 192.168.2.202 port 30620 -> 192.168.201.19 port 55024 codec: 111 ms: 20
2023-09-07 16:14:55.176880 93.77% [DEBUG] switch_rtp.c:4619 Starting timer [soft] 960 bytes per 20ms
2023-09-07 16:14:55.176880 93.77% [INFO] switch_core_media.c:8957 Activating Audio ICE
2023-09-07 16:14:55.197213 93.77% [NOTICE] switch_rtp.c:5122 Activating RTP audio ICE: cjAJ:cZq3XjFSK9UGWiMB 192.168.201.19:55024
2023-09-07 16:14:55.197213 93.77% [DEBUG] switch_core_media.c:8997 Activating RTCP PORT 55024
2023-09-07 16:14:55.197213 93.77% [DEBUG] switch_rtp.c:5017 RTCP send rate is: 1000 and packet rate is: 20000 Remote Port: 55024
2023-09-07 16:14:55.197213 93.77% [INFO] switch_core_media.c:9008 Skipping RTCP ICE (Same as RTP)
2023-09-07 16:14:55.197213 93.77% [INFO] switch_rtp.c:3913 Activate RTP/RTCP audio DTLS client
2023-09-07 16:14:55.197213 93.77% [INFO] switch_rtp.c:4096 Changing audio DTLS state from OFF to HANDSHAKE
### Tasks
wang-wenfang commented 1 year ago

Both "ext-rtp-ip" and "ext-sip-ip" are public ip in internal.xml and external.xml. Modify "rtp-start-port" and "rtp-end-port" in switch.conf.xml,open this port range on the firewall.