百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
R

rsipstack

> 编程语言
开源

用于构建 SIP 应用程序的 SIP 堆栈 Rust 库

199 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

用于构建 SIP 应用程序的 SIP 堆栈 Rust 库

rsipstack - A SIP Stack written in Rust

A RFC 3261/3262 compliant SIP stack written in Rust. The goal of this project is to provide a high-performance, reliable, and easy-to-use SIP stack that can be used in various scenarios.

Features

  • RFC 3261/3262 Compliant: Full compliance with SIP specification
  • Multiple Transport Support: UDP, TCP, TLS, WebSocket (TLS/WebSocket require the rustls and websocket features, enabled by default)
  • Transaction Layer: Complete SIP transaction state machine
  • Dialog Layer: SIP dialog management
  • Reliable Provisionals: PRACK (RFC 3262 / 100rel) support
  • Digest Authentication: Built-in authentication support
  • High Performance: Built with Rust for maximum performance
  • Easy to Use: Simple and intuitive API design

TODO

  • Transport support
    • UDP
    • TCP
    • TLS
    • WebSocket
  • Digest Authentication
  • Transaction Layer
  • Dialog Layer
  • WASM target

Use Cases

This SIP stack can be used in various scenarios, including but not limited to:

  • Integration with WebRTC for browser-based communication, such as WebRTC SBC.
  • Building custom SIP proxies or registrars
  • Building custom SIP user agents (SIP.js alternative)

Why Rust?

We are a group of developers who are passionate about SIP and Rust. We believe that Rust is a great language for building high-performance network applications, and we want to bring the power of Rust to the SIP/WebRTC/SFU world.

Quick Start Examples

SIP Proxy Server

A stateful SIP proxy that routes calls between registered users:

bash
# Run proxy server
cargo run --example proxy -- --port 25060 --addr 127.0.0.1

# Run with external IP
cargo run --example proxy -- --port 25060 --external-ip 1.2.3.4

This example demonstrates:

  • SIP user registration and location service
  • Call routing between registered users
  • Transaction forwarding and response handling
  • Session management for active calls
  • Handling INVITE, BYE, REGISTER, and ACK methods

SIP User Agent Client

A complete SIP client with registration, calling, and media support:

bash
# Local demo proxy
cargo run --example client -- --port 25061 --sip-server 127.0.0.1:25060 --auto-answer

# Register with a SIP server
cargo run --example client -- --sip-server sip.example.com --user alice --password secret --auto-answer

API Usage Guide

1. Simple SIP Connection

…

2. Using Transport Listeners

rust
use rsipstack::transport::{
    TcpListenerConnection, TransportLayer,
};
use tokio_util::sync::CancellationToken;

// Build a transport layer and register listeners
let cancel_token = CancellationToken::new();
let transport_layer = TransportLayer::new(cancel_token.clone());

let tcp_listener = TcpListenerConnection::new(
    "0.0.0.0:5060".parse()?,
    None,
)
.await?;
transport_layer.add_transport(tcp_listener.into());

To add TLS or WebSocket listeners, construct a TlsListenerConnection or WebSocketListenerConnection and register it with transport_layer.add_transport(...).

The raw TransportEvent stream is an internal API consumed by Endpoint::serve. To process incoming SIP messages, build an Endpoint around the transport layer and drive it with endpoint.serve() while consuming transactions via endpoint.incoming_transactions() (see the next section).

3. Using Endpoint and Transactions

…

4. Creating a User Agent Client

…

5. Implementing a Proxy

…

This is a simplified sketch: User, users and incoming are types/values you define yourself (incoming comes from endpoint.incoming_transactions()?, and User is a struct you implement that holds the registered user's username and destination SipAddr). A complete, working proxy is provided in examples/proxy.rs.

Running Tests

Unit Tests

bash
cargo test

Benchmark Tests

bash
# Run server
cargo run -r --bin bench_ua  -- -m server -p 5060

# Run client with 1000 calls
cargo run -r  --bin bench_ua  -- -m client -p 5061 -s 127.0.0.1:5060 -c 1000

The test monitor:

bash
=== SIP Benchmark UA Stats ===
Dialogs: 9992
Active Calls: 9983
Rejected Calls: 0
Failed Calls: 0
Total Calls: 250276
Calls/Second: 1501
============================

Documentation

  • API Documentation
  • Examples

Contributing

We welcome contributions! Please see our Contributing Guide for details.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rustfreeswitchrtpsipwebrtc

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言