sipsorcery-org / sipsorcery

A WebRTC, SIP and VoIP library for C# and .NET. Designed for real-time communications apps.
https://sipsorcery-org.github.io/sipsorcery
Other
1.42k stars 431 forks source link

Latest version (6.2..1) introduced a bug #1079

Open nganju98 opened 6 months ago

nganju98 commented 6 months ago

src/net/RTP/RTPSession.cs has a bug where lower case codecs won't map with Enum.Parse, because all the enums are upper case (PCMU vs pcmu). This bug was introduced by line 1032 in RTPSession.cs, where it says currentMediaStream.LocalTrack.Capabilities = capabilities;

Steps to reproduce: just run the SIPCallServer example, and call the server with a SIP Invite that wants pcmu (lower case) as the audio codec. You'll get a bunch of errors that say "Can't encode to unknown codec" because the AudioFormat is unknown because it failed to map "pcmu" to the enum PCMU.

ChristopheI commented 6 months ago

I don't think the line 1032 in RTPSession.cs is the cause. But the way to check codec is somewhere incorrect. I don't use SIP neither PCMU ... So could you try to find where the test is incorrect ?

By the way SDPAudioVideoMediaFormat.AreMatch() is correct.