# RTCP-mux for Plain Transport RTP IN

**URL:** <https://mediasoup.discourse.group/t/rtcp-mux-for-plain-transport-rtp-in/861>\
**Category:** mediasoup libraries\
**Created:** [April 23, 2020, 8:22pm UTC](https://mediasoup.discourse.group/t/rtcp-mux-for-plain-transport-rtp-in/861 "2020-04-23T20:22:39Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![friksa](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/friksa/32/869_2.png) [@friksa](https://mediasoup.discourse.group/u/friksa)\
**Post date:** [April 23, 2020, 8:22pm UTC](https://mediasoup.discourse.group/t/rtcp-mux-for-plain-transport-rtp-in/861/1 "2020-04-23T20:22:39Z")

</div>

Using FreeSwitch to bring a phone into a media-soup meeting.

Almost everything is working and the phone can hear the participants in the meeting. However, trying to get RTP feed from FreeSwitch into Mediasoup server, I have one question on this:

> **[mediasoup :: Communication Between Client and Server](https://mediasoup.org/documentation/v3/communication-between-client-and-server/#producing-media-from-an-external-endpoint)**
>
> Cutting Edge WebRTC Video Conferencing

Since FreeSwitch supports / uses RTCP-MUX, how can I create the RtpSendParameters in a way that it gets it from RTCP-mux? I am not sure how to obtain the SSRC otherwise and stuck at this point.

Thanks for a great project!! Love it.

---

<div class="post-metadata">

**Author:** ![ibc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/ibc/32/1540_2.png) [@ibc](https://mediasoup.discourse.group/u/ibc)\
**Post date:** [April 23, 2020, 8:54pm UTC](https://mediasoup.discourse.group/t/rtcp-mux-for-plain-transport-rtp-in/861/2 "2020-04-23T20:54:17Z")

</div>

I don’t understand. rtcpMux is enabled by default in router.createPlainTransport(). You need nothing in RtpSendParameters to indicate that.

---

<div class="post-metadata">

**Author:** ![friksa](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/friksa/32/869_2.png) [@friksa](https://mediasoup.discourse.group/u/friksa)\
**Post date:** [April 23, 2020, 9:11pm UTC](https://mediasoup.discourse.group/t/rtcp-mux-for-plain-transport-rtp-in/861/3 "2020-04-23T21:11:40Z")

</div>

Correct. Then I have to call produce() on PlainTransport and provide the RTCPParameters for the FreeSwitch audio stream. “codecs” is required, but I don’t know the SSRC… so I get this error

```auto
(node:20642) UnhandledPromiseRejectionWarning: TypeError: wrong entry in rtpMapping.encodings (missing ssrc or rid, or rtpParameters.mid)
    at Channel._processMessage (/opt/gw-server/node_modules/mediasoup/lib/Channel.js:203:37)
    at Socket.Channel._consumerSocket.on (/opt/gw-server/node_modules/mediasoup/lib/Channel.js:68:34)
    at Socket.emit (events.js:198:13)
    at addChunk (_stream_readable.js:288:12)
    at readableAddChunk (_stream_readable.js:269:11)
    at Socket.Readable.push (_stream_readable.js:224:10)
    at Pipe.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)

```

This is my code

```auto
        //let's send the receive audio to mediasoup client
        const options: ProducerOptions = {
          kind: 'audio',
          paused: false,
          rtpParameters: {
            rtcp: {
              mux: true
            },
            codecs: [{
              mimeType: 'audio/opus',
              payloadType: session.remotePayloadType,
              clockRate: 48000,
              channels: 2
            }]
          }
        };
        transportToFs.produce(options).then(producerForMs => {
          // let mediasoup client know to consume this
          console.log('producerForMs', producerForMs);
        });

```

---

<div class="post-metadata">

**Author:** ![ibc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/ibc/32/1540_2.png) [@ibc](https://mediasoup.discourse.group/u/ibc)\
**Post date:** [April 23, 2020, 9:34pm UTC](https://mediasoup.discourse.group/t/rtcp-mux-for-plain-transport-rtp-in/861/4 "2020-04-23T21:34:51Z")

</div>

> [@friksa](#):
>
> Correct. Then I have to call produce() on PlainTransport and provide the RTCPParameters for the FreeSwitch audio stream. “codecs” is required, but I don’t know the SSRC… so I get this error

What does it mean “I don’t know the SSRC”? I hope FreeSwitch adds `a=ssrc` line into its generated SDP offer, right?

---

<div class="post-metadata">

**Author:** ![ibc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/ibc/32/1540_2.png) [@ibc](https://mediasoup.discourse.group/u/ibc)\
**Post date:** [April 23, 2020, 9:47pm UTC](https://mediasoup.discourse.group/t/rtcp-mux-for-plain-transport-rtp-in/861/5 "2020-04-23T21:47:03Z")

</div>

If that’s true (FreeSwitch does not add `a=ssrc` in to its SDP offer) then there is nothing we can do.

mediasoup is ready for handling multiple streams (multiple `Producers`) over the same transport (WebRTC, plain or pipe transport), so it needs some minimal info to match received RTP and its corresponding `Producer`. So, in `SendRtpParameters` you need to signal at least one of these fields:

1. An entry in `encodings` with `ssrc`.
2. An entry in `encodings` with `rid`.
3. `mid`.

If FreeSwitch adds none of them, then please blame FreeSwitch because we are in 2020.

Said that, AFAIK FreeSwitch supports WebRTC, and it **does** generate WebRTC SDPs with `a=ssrc` lines:

- [https://github.com/signalwire/freeswitch/issues/58](https://github.com/signalwire/freeswitch/issues/58)

So, somehow, it must be ready to send `a=ssrc` when using regular unencrypted plain UDP transport for RTP.

---

<div class="post-metadata">

**Author:** ![friksa](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/friksa/32/869_2.png) [@friksa](https://mediasoup.discourse.group/u/friksa)\
**Post date:** [April 23, 2020, 9:54pm UTC](https://mediasoup.discourse.group/t/rtcp-mux-for-plain-transport-rtp-in/861/6 "2020-04-23T21:54:12Z")

</div>

Can I make a donation to get MediaSoup to pull it from RTCP-mux?

I am setting this up as SIP connection.

This is the SDP from FreeSwitch with the IP masked out.

```auto
v=0
o=FreeSWITCH 1587654382 1587654383 IN IP4 xxxx
s=FreeSWITCH
c=IN IP4 xxxx
t=0 0
m=audio 22296 RTP/AVP 100 101
a=rtpmap:100 opus/48000/2
a=fmtp:100 useinbandfec=1; stereo=1
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=rtcp-mux
a=rtcp:22296 IN IP4 xxxx

```

Using:  
FreeSWITCH Version 1.10.2-release+git~20191231T140119Z~f7bdd3845a~64bit (git f7bdd38 2019-12-31 14:01:19Z 64bit)

---

<div class="post-metadata">

**Author:** ![ibc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/ibc/32/1540_2.png) [@ibc](https://mediasoup.discourse.group/u/ibc)\
**Post date:** [April 23, 2020, 10:17pm UTC](https://mediasoup.discourse.group/t/rtcp-mux-for-plain-transport-rtp-in/861/7 "2020-04-23T22:17:29Z")

</div>

> [@friksa](#):
>
> Using:  
> FreeSWITCH Version 1.10.2-release+git~20191231T140119Z~f7bdd3845a~64bit (git f7bdd38 2019-12-31 14:01:19Z 64bit)

Just to be clear, I have no idea about FreeSwitch, so the version tells nothing to me.

> [@friksa](#):
>
> Can I make a donation to get MediaSoup to pull it from RTCP-mux?

First, please ask in the FreeSwitch forum whether there is a way to signal `a=ssrc`. If the answer is “no”, come back to us next week and we’ll see, but I cannot promise anything (specially busy nowadays).

---

<div class="post-metadata">

**Author:** ![friksa](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/friksa/32/869_2.png) [@friksa](https://mediasoup.discourse.group/u/friksa)\
**Post date:** [April 23, 2020, 10:20pm UTC](https://mediasoup.discourse.group/t/rtcp-mux-for-plain-transport-rtp-in/861/8 "2020-04-23T22:20:10Z")

</div>

It is the current version of FreeSwitch as 2019-12-31.

Opened a ticket with them, but they are not very responsive and my project is at a standstill at this point and I am out of ideas.

Thanks for considering.

---

<div class="post-metadata">

**Author:** ![friksa](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/friksa/32/869_2.png) [@friksa](https://mediasoup.discourse.group/u/friksa)\
**Post date:** [April 23, 2020, 11:09pm UTC](https://mediasoup.discourse.group/t/rtcp-mux-for-plain-transport-rtp-in/861/9 "2020-04-23T23:09:58Z")

</div>

Making progress here and hoping it would help others…

When making the SDP offer, if I change RTP/AVP to RTP/AVPF, FreeSwitch sends the SSRC: m=audio {mport} RTP/AVPF {payloadType}

```auto
v=0
o=FreeSWITCH 1587659473 1587659474 IN IP4 xxxx
s=FreeSWITCH
c=IN IP4 xxxx
t=0 0
a=msid-semantic: WMS klNy6C0zPnF1GHimljgWwJ6uh2YZVTN5
m=audio 23548 RTP/AVPF 100 101
a=rtpmap:100 opus/48000/2
a=fmtp:100 useinbandfec=1; stereo=1
a=rtpmap:101 telephone-event/8000
a=ptime:20
a=rtcp-mux
a=rtcp:23548 IN IP4 xxxx
a=ice-ufrag:Jos5Xoq5hfU3YyYU
a=ice-pwd:PjLzv2ZUQgPaGXGgbYbZdsUl
a=candidate:9347119714 1 udp 659136 xxxx 23548 typ host generation 0
a=end-of-candidates
a=ssrc:1460839061 cname:5ru1UlrAzXr5uzhG
a=ssrc:1460839061 msid:klNy6C0zPnF1GHimljgWwJ6uh2YZVTN5 a0
a=ssrc:1460839061 mslabel:klNy6C0zPnF1GHimljgWwJ6uh2YZVTN5
a=ssrc:1460839061 label:klNy6C0zPnF1GHimljgWwJ6uh2YZVTN5a0

```

Will continue after dinner

---

<div class="post-metadata">

**Author:** ![ibc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/ibc/32/1540_2.png) [@ibc](https://mediasoup.discourse.group/u/ibc)\
**Post date:** [April 23, 2020, 11:11pm UTC](https://mediasoup.discourse.group/t/rtcp-mux-for-plain-transport-rtp-in/861/10 "2020-04-23T23:11:27Z")

</div>

Good catch. However note that such a SDP also has ICE candidates. I hope FS is ready to work even if the remote (the mediasoup `PlainTransport`) does NOT support ICE.

---

<div class="post-metadata">

**Author:** ![friksa](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/friksa/32/869_2.png) [@friksa](https://mediasoup.discourse.group/u/friksa)\
**Post date:** [April 23, 2020, 11:45pm UTC](https://mediasoup.discourse.group/t/rtcp-mux-for-plain-transport-rtp-in/861/11 "2020-04-23T23:45:52Z")

</div>

Good observation… thanks. Looks like it should be easy enough to disable ICE/STUN for FreeSwitch. Will post an update once everything is working. Suspect that it might be interesting for others to allow regular phones to join a mediasoup meeting. I know there are some prototypes around other media servers, but FreeSwitch seems like the right answer for a production solution with support for gateways from Signalwire and others.

---

<div class="post-metadata">

**Author:** ![ibc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/ibc/32/1540_2.png) [@ibc](https://mediasoup.discourse.group/u/ibc)\
**Post date:** [April 23, 2020, 11:55pm UTC](https://mediasoup.discourse.group/t/rtcp-mux-for-plain-transport-rtp-in/861/12 "2020-04-23T23:55:14Z")

</div>

Upon custom policy, if FS sends a SDP offer with ICE and receives a SDP answer without ICE, it should discard ICE and switch to regular/legacy procedures (trust the remote IP:port in the `c=` and `m=` lines and so on). I hope.

---

<div class="post-metadata">

**Author:** ![friksa](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/friksa/32/869_2.png) [@friksa](https://mediasoup.discourse.group/u/friksa)\
**Post date:** [April 25, 2020, 3:18pm UTC](https://mediasoup.discourse.group/t/rtcp-mux-for-plain-transport-rtp-in/861/13 "2020-04-25T15:18:18Z")

</div>

Just FYI: the ICE offer does not seem to affect behavior. However, sendonly and recvonly SDP offers works, but then are disconnected by FreeSwitch with a timeout after a few seconds. Using sendrecv on all offers resolve the timeout issue. This seems to be an issue with FreeSwitch, but the workaround seems to work for now.

---

<div class="post-metadata">

**Author:** ![ibc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/ibc/32/1540_2.png) [@ibc](https://mediasoup.discourse.group/u/ibc)\
**Post date:** [April 25, 2020, 3:28pm UTC](https://mediasoup.discourse.group/t/rtcp-mux-for-plain-transport-rtp-in/861/14 "2020-04-25T15:28:43Z")

</div>

mediasoup does not generate SDPs, so it knows nothing about sendonly and recvonly. The SDP is up to you 🙂
