How sipsorcery-org/sipsorcery works
Main Components
• Core Library Modules:
– SIP Protocol stack, including SIP message construction, SIP channels (UDP, TCP, TLS, WebSocket), SIP transactions (invite/non-invite), and SIP events (dialog, presence, CDR, etc.)
– Media Handling and Codecs: Modules in “src/app/Media”, “src/net” (e.g., RTP, RTCP, video depacketisation, and DSP like G711/G722/G729 codecs), along with details for additional media sources and sinks.
• Networking & Transport Subsystems:
– Core networking layers in “src/net” such as ICE, STUN, DTLS/SRTP, RTP, RTCP, SCTP, RTSP, SDP, WebRTC signaling (WebSocket-based, as shown in the WebRTC examples)
– DNS integration and SIP endpoint management.
• Application-Level and SIP User Agents:
– Components in “src/app/SIPUserAgents” that implement SIP client and server behaviors, SIP call management and SIP request authentication.
• Examples and Demonstrations:
– A multitude of example projects (in the “examples” folder) demonstrate both VoIP and WebRTC scenarios using different media back ends (e.g., Windows audio capture, FFmpeg integration, Unity, etc.) and platforms.
• Test and Integration Suites:
– A comprehensive test suite in “test” shows integration and unit tests covering SIP, media, transport, and network protocol components.
Relationships and Interactions
• At the center is the SIPSorcery core library, which provides the backbone for SIP signaling (using SIP request/response handling and SIP transactions) and media stream management (via RTP/RTCP sessions).
• The SIP User Agent components build on the core stack to manage calls, authentication, and session control. They interact with the transport layer (using SIP Channels for UDP/TCP/TLS/WebSocket).
• The media side interfaces with codec implementations, media sources/sinks, and test-pattern generators. This includes interaction with external media libraries (e.g., SIPSorceryMedia.Encoders, SIPSorceryMedia.Windows) that encapsulate platform-specific audio/video capture and rendering.
• For WebRTC support, the library’s RTC components (in “src/net/WebRTC”) work in conjunction with external signaling components (e.g., simple JSON messages over WebSockets as shown in the WebRTC examples) and the video track/source components.
• Additional protocols like ICE, STUN, DTLS/SRTP provide connectivity and security, wiring external network interfaces to the real-time media streams.
• The examples (both VoIP and WebRTC) act as client applications that initialize these subsystems, while testing infrastructure verifies that each integration point behaves correctly.
Architectural Patterns and Design Principles
• Layered Architecture:
– At the lowest level, you have protocol implementations (RTCP, RTP, SCTP, STUN, ICE in “src/net”/“src/core”) which provide network communication and media transport.
– Above this, application-logic layers (SIP User Agents, SIP Request Authorisers) leverage these protocols.
• Separation of Concerns:
– The library is separated into discrete domains (protocol handling, media processing, application services) which makes it easier to swap in alternate implementations (for example, different media device back ends).
• Extensibility:
– The multiple example projects each demonstrate different integration scenarios, showing a design that favors plug‐in extensibility for media endpoints and signaling.
Technologies, Frameworks, and External Dependencies
• .NET (Framework and Core variants): The entire project is written in C# for .NET Framework 4.6.1 and later.
• External Media/Codec Libraries: Examples include integration with FFmpeg, SDL2, native VP8 via SIPSorceryMedia.Encoders, etc.
• GitHub Actions workflows and Dockerfiles indicate CI/CD and containerization aspects that can be noted as deployment/configuration artifacts.