SIPSorcery 8.0.23

dotnet add package SIPSorcery --version 8.0.23
                    
NuGet\Install-Package SIPSorcery -Version 8.0.23
                    
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.23" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SIPSorcery" Version="8.0.23" />
                    
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.23
                    
#r "nuget: SIPSorcery, 8.0.23"
                    
#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.
#:package SIPSorcery@8.0.23
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SIPSorcery&version=8.0.23
                    
Install as a Cake Addin
#tool nuget:?package=SIPSorcery&version=8.0.23
                    
Install 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.

ivrToolkit.Plugin.SipSorcery

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

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.

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.23 0 7/15/2025
8.0.22 6,504 6/4/2025
8.0.21-pre 153 6/3/2025
8.0.20-pre 183 6/1/2025
8.0.15-pre 161 5/17/2025
8.0.14 6,497 5/8/2025
8.0.13 1,163 5/1/2025
8.0.12 1,533 4/24/2025
8.0.11 7,341 3/13/2025
8.0.10 1,520 3/9/2025
8.0.9 19,671 2/4/2025
8.0.7 14,299 1/4/2025
8.0.6 24,480 11/15/2024
8.0.5 280 11/15/2024
8.0.4 394 11/15/2024
8.0.3 4,692 11/8/2024
8.0.1 4,676 10/26/2024
8.0.0 15,553 9/27/2024
6.2.4 45,265 4/24/2024
6.2.3 1,537 4/16/2024
6.2.1 9,545 2/24/2024
6.2.0 26,872 1/14/2024
6.1.1-pre 2,008 12/13/2023
6.1.0-pre 1,315 12/10/2023
6.0.12 136,936 3/4/2023
6.0.11 66,323 9/12/2022
6.0.9 43,723 7/15/2022
6.0.8 4,908 6/14/2022
6.0.7 18,803 4/30/2022
6.0.6 8,729 2/11/2022
6.0.4 16,081 1/3/2022
6.0.3 7,813 11/28/2021
6.0.2 1,097 11/28/2021
6.0.1-pre 2,557 11/11/2021
5.3.3-pre 700 10/5/2021
5.3.0-pre 3,180 7/30/2021
5.2.3 21,756 6/26/2021
5.2.0 27,198 4/28/2021
5.1.8-pre 917 4/15/2021
5.1.7-pre 369 4/15/2021
5.1.6-pre 2,045 4/10/2021
5.1.5-pre 831 3/26/2021
5.1.4-pre 351 3/26/2021
5.1.2 8,349 3/11/2021
5.1.1 1,019 3/5/2021
5.1.0 3,013 2/17/2021
5.0.32-pre 361 2/14/2021
5.0.31-pre 281 2/13/2021
5.0.27-pre 480 2/8/2021
5.0.26-pre 346 2/7/2021
5.0.20-pre 316 2/4/2021
5.0.19-pre 305 2/4/2021
5.0.18-pre 315 2/2/2021
5.0.14-pre 441 1/28/2021
5.0.13-pre 304 1/27/2021
5.0.12-pre 449 1/21/2021
5.0.11-pre 657 1/19/2021
5.0.10-pre 301 1/15/2021
5.0.9-pre 297 1/13/2021
5.0.8-pre 316 1/10/2021
5.0.7-pre 834 12/27/2020
5.0.6-pre 321 12/26/2020
5.0.5-pre 404 12/21/2020
5.0.4-pre 351 12/21/2020
5.0.3 12,983 12/17/2020
5.0.2 794 12/13/2020
5.0.0 12,083 12/4/2020
4.0.91-pre 690 11/19/2020
4.0.90-pre 496 11/18/2020
4.0.89-pre 348 11/17/2020
4.0.88-pre 777 11/5/2020
4.0.87-pre 346 11/2/2020
4.0.86-pre 577 11/1/2020
4.0.85-pre 1,197 10/21/2020
4.0.84-pre 656 10/20/2020
4.0.83-pre 583 10/14/2020
4.0.82-pre 841 10/12/2020
4.0.81-pre 33,255 10/2/2020
4.0.80-pre 446 10/1/2020
4.0.79-pre 504 9/23/2020
4.0.78-pre 320 9/23/2020
4.0.77-pre 454 9/20/2020
4.0.76-pre 468 9/20/2020
4.0.75-pre 621 9/15/2020
4.0.74-pre 1,288 9/14/2020
4.0.71-pre 583 9/13/2020
4.0.70-pre 3,124 9/10/2020
4.0.69-pre 1,419 9/10/2020
4.0.67-pre 1,456 9/5/2020
4.0.61-pre 486 9/2/2020
4.0.60-pre 3,160 7/28/2020
4.0.59-pre 855 7/22/2020
4.0.58-pre 1,266 7/7/2020
4.0.55-pre 1,053 6/26/2020
4.0.51-pre 5,407 6/3/2020
4.0.50-pre 1,053 6/2/2020
4.0.49-pre 3,550 5/16/2020
4.0.47-pre 1,580 5/10/2020
4.0.46-pre 1,102 5/6/2020
4.0.45-pre 650 5/5/2020
4.0.44-pre 686 4/29/2020
4.0.43-pre 927 4/22/2020
4.0.42-pre 4,957 4/21/2020
4.0.41-pre 831 4/4/2020
4.0.40-pre 984 4/3/2020
4.0.35-pre 899 3/26/2020
4.0.34-pre 512 3/26/2020
4.0.33-pre 509 3/25/2020
4.0.32-pre 500 3/25/2020
4.0.31-pre 515 3/24/2020
4.0.30-pre 512 3/24/2020
4.0.29-pre 1,038 3/14/2020
4.0.28-pre 947 2/28/2020
4.0.13-pre 1,149 2/7/2020
4.0.8-rc 934 2/1/2020
4.0.7-rc 23,597 12/31/2019
4.0.4-rc 684 12/15/2019
4.0.3-rc 625 12/10/2019
4.0.2-rc 671 12/2/2019
4.0.1-rc 8,202 11/27/2019
4.0.0-rc 572 11/25/2019
3.6.0 5,036 11/14/2019
3.5.0 856 11/13/2019
3.4.0 787 11/7/2019
3.3.0 872 10/31/2019
3.2.0 8,003 10/26/2019
3.1.0 879 10/16/2019
3.0.4 808 10/13/2019
3.0.3 711 10/12/2019
3.0.2 738 10/8/2019
3.0.1 1,441 9/23/2019
3.0.0 898 9/22/2019
2.0.1 940 9/12/2019
2.0.0 849 9/12/2019
1.6.2 939 8/25/2019
1.6.1 3,879 4/15/2018
1.6.0 1,575 4/14/2018
1.5.6 3,457 4/21/2017
1.5.5 3,074 3/4/2016
1.5.3 1,552 2/29/2016
1.5.2 1,727 2/28/2016
1.5.0 1,875 2/24/2016
1.4.1 1,453 2/21/2016
1.4.0 2,167 10/29/2015
1.3.1 2,778 11/21/2014

-v8.0.23: Bug fixes.
-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.