SIPSorcery 8.0.22

dotnet add package SIPSorcery --version 8.0.22
                    
NuGet\Install-Package SIPSorcery -Version 8.0.22
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SIPSorcery" Version="8.0.22" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SIPSorcery" Version="8.0.22" />
                    
Directory.Packages.props
<PackageReference Include="SIPSorcery" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SIPSorcery --version 8.0.22
                    
#r "nuget: SIPSorcery, 8.0.22"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=SIPSorcery&version=8.0.22
                    
Install SIPSorcery as a Cake Addin
#tool nuget:?package=SIPSorcery&version=8.0.22
                    
Install SIPSorcery as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

License

⚠️ License Update (May 18, 2025)
This project is now dual-licensed under the BSD 3-Clause “New” or “Revised” License and the additional BDS BY-NC-SA restriction (see LICENSE § 2).

Key points of the BDS restriction:

  • No use inside Israel or the Occupied Territories until the 1967 occupation ends, equality for Arab-Palestinians is enshrined, and the right of return for Palestinian refugees is honored.
  • Everywhere else, the BSD 3-Clause terms apply, provided that any redistribution retains this BDS restriction and complies with Attribution-NonCommercial-ShareAlike.
  • In case of conflict, the BDS terms in Section 2 take precedence over Section 1.

Read the full text in LICENSE.

What Is It?

This fully C# library can be used to add Real-time Communications, typically audio and video calls, to .NET applications.

The diagram below is a high level overview of a Real-time audio and video call between Alice and Bob. It illustrates where the SIPSorcery and associated libraries can help.

Real-time Communications Overview

Supports both VoIP (get started) and WebRTC (get started).

Some of the protocols supported:

  • Session Initiation Protocol (SIP),
  • Real-time Transport Protocol (RTP),
  • Web Real-time Communications (WebRTC), as of 26 Jan 2021 now an official IETF and W3C specification,
  • Interactive Connectivity Establishment (ICE),
  • SCTP, SDP, STUN and more.

Media End Points - Audio/Video Sinks and Sources:

  • The main SIPSorcery library does not provide access to audio and video devices or native codecs. Providing cross platform access to to these features on top of .NET is a large undertaking. A number of separate demonstration libraries show some different approaches to accessing audio/video devices and wrapping codecs with .NET.

  • This library provides only a small number of audio and video codecs (G711, G722 and G729). OPUS is available via Concentus. Additional codecs, particularly video ones, require C or C++ libraries. An effort is underway to port the VP8 video codec to C# see VP8.Net.

Installation

The library is should work with .NET Framework >= 4.6.1 and all .NET Core and .NET versions. The demo applications initially targetted .NET Core 3.1 and are updated to later .NET versions as time and interest permit. The library is available via NuGet.

dotnet add package SIPSorcery

With Visual Studio Package Manager Console (or search for SIPSorcery on NuGet):

Install-Package SIPSorcery

Documentation

Class reference documentation and articles explaining common usage are available at https://sipsorcery-org.github.io/sipsorcery/.

Getting Started VoIP

The simplest possible example to place an audio-only SIP call is shown below. This example relies on the Windows specific SIPSorceryMedia.Windows library to play the received audio and only works on Windows (due to lack of .NET audio device support on non-Windows platforms).

dotnet new console --name SIPGetStarted --framework net8.0 --target-framework-override net8.0-windows10.0.17763.0
cd SIPGetStarted
dotnet add package SIPSorcery
dotnet add package SIPSorceryMedia.Windows
# Paste the code below into Program.cs.
dotnet run
# If successful you will hear a "Hello World" announcement.
string DESTINATION = "music@iptel.org";
        
Console.WriteLine("SIP Get Started");

var userAgent = new SIPSorcery.SIP.App.SIPUserAgent();
var winAudio = new SIPSorceryMedia.Windows.WindowsAudioEndPoint(new SIPSorcery.Media.AudioEncoder());
var voipMediaSession = new SIPSorcery.Media.VoIPMediaSession(winAudio.ToMediaEndPoints());

// Place the call and wait for the result.
bool callResult = await userAgent.Call(DESTINATION, null, null, voipMediaSession);
Console.WriteLine($"Call result {(callResult ? "success" : "failure")}.");

Console.WriteLine("Press any key to hangup and exit.");
Console.ReadLine();

The GetStarted example contains the full source and project file for the example above.

The three key classes in the above example are described in dedicated articles:

The examples folder contains sample code to demonstrate other common SIP/VoIP cases.

Getting Started WebRTC

The WebRTC specifications do not include directions about how signaling should be done (for VoIP the signaling protocol is SIP; WebRTC has no equivalent). The example below uses a simple JSON message exchange over web sockets for signaling. Part of the reason the Getting Started WebRTC is longer than the Getting Started VoIP example is the need for custom signaling.

The example requires two steps:

  • Run the dotnet console application,
  • Open an HTML page in a browser on the same machine.

The full project file and code are available at WebRTC Get Started.

The example relies on the Windows specific SIPSorceryMedia.Encoders package, which is mainly a wrapper around libvpx. Hopefully in the future there will be equivalent packages for other platforms.

Step 1:

dotnet new console --name WebRTCGetStarted
cd WebRTCGetStarted
dotnet add package SIPSorcery
dotnet add package SIPSorceryMedia.Encoders
# Paste the code below into Program.cs.
dotnet run
using System;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using SIPSorcery.Media;
using SIPSorcery.Net;
using SIPSorceryMedia.Encoders;
using WebSocketSharp.Server;

namespace demo
{
    class Program
    {
        private const int WEBSOCKET_PORT = 8081;

        static void Main()
        {
            Console.WriteLine("WebRTC Get Started");

            // Start web socket.
            Console.WriteLine("Starting web socket server...");
            var webSocketServer = new WebSocketServer(IPAddress.Any, WEBSOCKET_PORT);
            webSocketServer.AddWebSocketService<WebRTCWebSocketPeer>("/", (peer) => peer.CreatePeerConnection = () => CreatePeerConnection());
            webSocketServer.Start();

            Console.WriteLine($"Waiting for web socket connections on {webSocketServer.Address}:{webSocketServer.Port}...");
            
            Console.WriteLine("Press any key exit.");
            Console.ReadLine();
        }

        private static Task<RTCPeerConnection> CreatePeerConnection()
        {
            var pc = new RTCPeerConnection(null);

            var testPatternSource = new VideoTestPatternSource(new VpxVideoEncoder());

            MediaStreamTrack videoTrack = new MediaStreamTrack(testPatternSource.GetVideoSourceFormats(), MediaStreamStatusEnum.SendOnly);
            pc.addTrack(videoTrack);

            testPatternSource.OnVideoSourceEncodedSample += pc.SendVideo;
            pc.OnVideoFormatsNegotiated += (formats) => testPatternSource.SetVideoSourceFormat(formats.First());

            pc.onconnectionstatechange += async (state) =>
            {
                Console.WriteLine($"Peer connection state change to {state}.");

                switch(state)
                {
                    case RTCPeerConnectionState.connected:
                        await testPatternSource.StartVideo();
                        break;
                    case RTCPeerConnectionState.failed:
                        pc.Close("ice disconnection");
                        break;
                    case RTCPeerConnectionState.closed:
                        await testPatternSource.CloseVideo();
                        testPatternSource.Dispose();
                        break;
                }
            };

            return Task.FromResult(pc);
        }
    }
}

Step 2:

Create an HTML file, paste the contents below into it, open it in a browser that supports WebRTC and finally press the start button.

<!DOCTYPE html>
<head>
    <script type="text/javascript">
        const WEBSOCKET_URL = "ws://127.0.0.1:8081/"

        var pc, ws;

        async function start() {
            pc = new RTCPeerConnection();

            pc.ontrack = evt => document.querySelector('#videoCtl').srcObject = evt.streams[0];
            pc.onicecandidate = evt => evt.candidate && ws.send(JSON.stringify(evt.candidate));

            ws = new WebSocket(document.querySelector('#websockurl').value, []);
            ws.onmessage = async function (evt) {
                var obj = JSON.parse(evt.data);
                if (obj?.candidate) {
                    pc.addIceCandidate(obj);
                }
                else if (obj?.sdp) {
                    await pc.setRemoteDescription(new RTCSessionDescription(obj));
                    pc.createAnswer()
                        .then((answer) => pc.setLocalDescription(answer))
                        .then(() => ws.send(JSON.stringify(pc.localDescription)));
                }
            };
        };

        async function closePeer() {
            await pc?.close();
            await ws?.close();
        };

    </script>
</head>
<body>

    <video controls autoplay="autoplay" id="videoCtl" width="640" height="480"></video>

    <div>
        <input type="text" id="websockurl" size="40" />
        <button type="button" class="btn btn-success" onclick="start();">Start</button>
        <button type="button" class="btn btn-success" onclick="closePeer();">Close</button>
    </div>

</body>

<script>
    document.querySelector('#websockurl').value = WEBSOCKET_URL;
</script>

Result:

If successful the browser should display a test pattern image.

The examples folder contains sample code to demonstrate other common WebRTC cases.

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 is compatible. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (16)

Showing the top 5 NuGet packages that depend on SIPSorcery:

Package Downloads
SIPSorceryMedia

The SIPSorcery package for WebRTC plumbing and Windows audio and video capture.

Resonance.WebRTC

WebRTC Adapter for Resonance. Resonance is a high-performance real-time C# communication library with built-in support for several different transcoding and delivery methods. This library provides an intuitive API for asynchronous communication between machines and devices by exposing a set of easy to use, pluggable components.

ivrToolkit.Plugin.SipSorcery

A SipSorcery plugin for the IvrToolkit. For use with ivrToolkit.Core. 100% c# SIP

WebRTC.Healthcheck

Simple healthcheck for WebRTC

WebRTCme

WebRTC library with a single, unified API for .NET MAUI and Blazor middlewares/applications.

GitHub repositories (5)

Showing the top 5 popular GitHub repositories that depend on SIPSorcery:

Repository Stars
odedshimon/BruteShark
Network Analysis Tool
melihercan/WebRTCme
A cross-platform framework for adding WebRTC support to .NET MAUI, Blazor, and Desktop applications by using a single unified .NET/C# API.
friflo/Friflo.Json.Fliox
C# ORM - High Performance, SQL, NoSQL, Messaging, Pub-Sub
jihadkhawaja/Egroo
An open-source, privacy-focused social platform empowering users to connect securely and control their data.
qiuqiuqiu131/SukiChat.Client
Version Downloads Last updated
8.0.22 26 6/4/2025
8.0.21-pre 48 6/3/2025
8.0.20-pre 78 6/1/2025
8.0.15-pre 142 5/17/2025
8.0.14 2,438 5/8/2025
8.0.13 836 5/1/2025
8.0.12 1,402 4/24/2025
8.0.11 6,537 3/13/2025
8.0.10 1,398 3/9/2025
8.0.9 17,395 2/4/2025
8.0.7 13,551 1/4/2025
8.0.6 22,651 11/15/2024
8.0.5 268 11/15/2024
8.0.4 371 11/15/2024
8.0.3 4,519 11/8/2024
8.0.1 4,372 10/26/2024
8.0.0 15,240 9/27/2024
6.2.4 40,902 4/24/2024
6.2.3 1,512 4/16/2024
6.2.1 9,340 2/24/2024
6.2.0 26,769 1/14/2024
6.1.1-pre 1,896 12/13/2023
6.1.0-pre 1,289 12/10/2023
6.0.12 131,739 3/4/2023
6.0.11 65,837 9/12/2022
6.0.9 43,252 7/15/2022
6.0.8 4,885 6/14/2022
6.0.7 18,624 4/30/2022
6.0.6 8,587 2/11/2022
6.0.4 16,010 1/3/2022
6.0.3 7,722 11/28/2021
6.0.2 1,034 11/28/2021
6.0.1-pre 2,537 11/11/2021
5.3.3-pre 651 10/5/2021
5.3.0-pre 3,152 7/30/2021
5.2.3 21,602 6/26/2021
5.2.0 27,044 4/28/2021
5.1.8-pre 862 4/15/2021
5.1.7-pre 348 4/15/2021
5.1.6-pre 2,019 4/10/2021
5.1.5-pre 804 3/26/2021
5.1.4-pre 330 3/26/2021
5.1.2 8,187 3/11/2021
5.1.1 992 3/5/2021
5.1.0 2,956 2/17/2021
5.0.32-pre 339 2/14/2021
5.0.31-pre 258 2/13/2021
5.0.27-pre 458 2/8/2021
5.0.26-pre 321 2/7/2021
5.0.20-pre 289 2/4/2021
5.0.19-pre 282 2/4/2021
5.0.18-pre 290 2/2/2021
5.0.14-pre 420 1/28/2021
5.0.13-pre 280 1/27/2021
5.0.12-pre 421 1/21/2021
5.0.11-pre 629 1/19/2021
5.0.10-pre 281 1/15/2021
5.0.9-pre 278 1/13/2021
5.0.8-pre 297 1/10/2021
5.0.7-pre 810 12/27/2020
5.0.6-pre 299 12/26/2020
5.0.5-pre 377 12/21/2020
5.0.4-pre 324 12/21/2020
5.0.3 12,103 12/17/2020
5.0.2 770 12/13/2020
5.0.0 12,040 12/4/2020
4.0.91-pre 666 11/19/2020
4.0.90-pre 468 11/18/2020
4.0.89-pre 330 11/17/2020
4.0.88-pre 752 11/5/2020
4.0.87-pre 316 11/2/2020
4.0.86-pre 549 11/1/2020
4.0.85-pre 1,173 10/21/2020
4.0.84-pre 630 10/20/2020
4.0.83-pre 559 10/14/2020
4.0.82-pre 811 10/12/2020
4.0.81-pre 33,235 10/2/2020
4.0.80-pre 423 10/1/2020
4.0.79-pre 480 9/23/2020
4.0.78-pre 298 9/23/2020
4.0.77-pre 427 9/20/2020
4.0.76-pre 440 9/20/2020
4.0.75-pre 600 9/15/2020
4.0.74-pre 1,246 9/14/2020
4.0.71-pre 557 9/13/2020
4.0.70-pre 3,089 9/10/2020
4.0.69-pre 1,308 9/10/2020
4.0.67-pre 1,419 9/5/2020
4.0.61-pre 464 9/2/2020
4.0.60-pre 3,130 7/28/2020
4.0.59-pre 836 7/22/2020
4.0.58-pre 1,244 7/7/2020
4.0.55-pre 1,035 6/26/2020
4.0.51-pre 5,389 6/3/2020
4.0.50-pre 1,032 6/2/2020
4.0.49-pre 3,526 5/16/2020
4.0.47-pre 1,549 5/10/2020
4.0.46-pre 1,081 5/6/2020
4.0.45-pre 624 5/5/2020
4.0.44-pre 668 4/29/2020
4.0.43-pre 896 4/22/2020
4.0.42-pre 4,919 4/21/2020
4.0.41-pre 805 4/4/2020
4.0.40-pre 965 4/3/2020
4.0.35-pre 866 3/26/2020
4.0.34-pre 493 3/26/2020
4.0.33-pre 479 3/25/2020
4.0.32-pre 481 3/25/2020
4.0.31-pre 492 3/24/2020
4.0.30-pre 482 3/24/2020
4.0.29-pre 1,017 3/14/2020
4.0.28-pre 921 2/28/2020
4.0.13-pre 1,126 2/7/2020
4.0.8-rc 905 2/1/2020
4.0.7-rc 23,577 12/31/2019
4.0.4-rc 661 12/15/2019
4.0.3-rc 600 12/10/2019
4.0.2-rc 647 12/2/2019
4.0.1-rc 8,180 11/27/2019
4.0.0-rc 547 11/25/2019
3.6.0 4,918 11/14/2019
3.5.0 831 11/13/2019
3.4.0 759 11/7/2019
3.3.0 848 10/31/2019
3.2.0 7,806 10/26/2019
3.1.0 850 10/16/2019
3.0.4 785 10/13/2019
3.0.3 687 10/12/2019
3.0.2 717 10/8/2019
3.0.1 1,416 9/23/2019
3.0.0 866 9/22/2019
2.0.1 912 9/12/2019
2.0.0 809 9/12/2019
1.6.2 915 8/25/2019
1.6.1 3,800 4/15/2018
1.6.0 1,506 4/14/2018
1.5.6 3,413 4/21/2017
1.5.5 3,027 3/4/2016
1.5.3 1,503 2/29/2016
1.5.2 1,675 2/28/2016
1.5.0 1,827 2/24/2016
1.4.1 1,400 2/21/2016
1.4.0 2,117 10/29/2015
1.3.1 2,679 11/21/2014

-v8.0.22: Stable release.
-v8.0.21-pre: Improvements to OPUS encoder wiring.
-v8.0.20-pre: Improvements to the audio pipeline to avoid consumers needing to handle raw RTP packets.
-v8.0.15-pre: BouncyCastle update (thanks to @joaoladeiraext).
-v8.0.14: Fix for OPUS codec using multiple channels.
-v8.0.13: Added ASP.NET web socket signalling option for WebRTC. Bug fixes.
-v8.0.12: Bug fixes.
-v8.0.11: Real-time text (thanks to @xBasov). Bug fixes.
-v8.0.10: H265 and MJEG packetisation (thanks to @Drescher86), RTCP feedback improvements (thanks to @ispysoftware).
-v8.0.9: Minor improvements and bug fixes.
-v8.0.7: Bug fixes and all sipsorcery packages release.
-v8.0.6: Nuget publish.
-v8.0.4: Bug fixes.
-v8.0.3: Bug fixes.
-v8.0.1-pre: Performance improvements (thanks to @weltmeyer). Add ECDSA as default option for WebRTC DTLS.
-v8.0.0: RTP header extension improvements (thanks to @ChristopheI). Major version to 8 to reflect highest .net runtime supported.