crosstyan ffb3fc423e feat: add zoom_in and zoom_out commands to PTZ command map
note: the `API.md` said it's `zoom_in` and `zoom_out` with underscore, while the go ptzCmdMap said it's `zoomin` and `zoomout` with underscore; I choose to support both (or unify them?)
2026-01-13 14:46:57 +08:00
2025-10-15 14:18:47 +08:00
2025-05-09 17:11:47 +08:00
2025-10-15 16:04:35 +08:00
2025-10-15 10:05:52 +08:00
2025-02-04 11:42:50 +08:00
2025-02-03 16:27:46 +08:00
2025-02-03 16:27:46 +08:00
2024-07-28 23:09:22 +08:00
2025-02-04 11:42:50 +08:00
2025-02-03 16:27:46 +08:00
2025-10-15 14:18:47 +08:00

SRS-SIP

CI CodeQL codecov Go Report Card License

Usage

Pre-requisites:

  • Go 1.23+
  • Node 20+

Then run

git clone https://github.com/ossrs/srs-sip
cd srs-sip
./build.sh

If on Windows

./build.bat

Run the program:

./objs/srs-sip -c conf/config.yaml

Testing

Run all tests:

go test -v ./pkg/...

Run tests with coverage:

go test ./pkg/... -coverprofile=coverage.out
go tool cover -func=coverage.out

For more details, see Testing Guide.

Security

This project uses CodeQL for automated security scanning. For more information about security practices and how to report vulnerabilities, see Security Guide.

Docker

Use docker

docker run -id -p 1985:1985 -p 5060:5060 -p 8025:8025 -p 9000:9000 -p 5060:5060/udp -p 8000:8000/udp --name srs-sip --env CANDIDATE=your_ip ossrs/srs-sip:alpha
  • 1985/TCP: SRS监听SRS-SIP通过此端口调用SRS的API
  • 9000/TCP: SRS监听用于接收国标推送的媒体流
  • 8000/UDPSRS监听用于RTC播放
  • 5060/TCPSRS-SIP监听用于国标注册
  • 8025/TCPSRS-SIP监听用于前端页面

Sequence

  1. 注册流程
sequenceDiagram
    Device ->> SRS-SIP : 1. Register
    SRS-SIP ->> Device : 2. 401
    Device ->> SRS-SIP : 3. Register
    SRS-SIP ->> Device : 4. 200 OK
  1. 播放视频流程 Player、SRS-SIP、SRS Server和GB28181 Device的交互图如下
sequenceDiagram
    Player ->> SRS-SIP : 1. Play Request(with id)
    SRS-SIP ->>  SRS : 2. Publish Request(with ssrc and id)
    SRS ->> SRS-SIP : 3. Response(with port)
    SRS-SIP ->>  Device : 4. Invite(with port)
    Device ->> SRS-SIP : 5. 200 OK
    SRS-SIP ->> Player : 6. 200 OK(with url)
    Device -->> SRS : Media Stream
    Player ->> SRS : 7. Play
    SRS -->> Player : Media Stream
    Player ->> SRS-SIP : 8. Stop Request
    SRS-SIP ->> SRS : 9. Unpublish Request
    SRS-SIP ->> Device : 10. Bye
  1. 通过SRS-SIP提供的API接口/srs-sip/v1/invitePlayer主动发起播放请求携带设备的通道ID
  2. SRS-SIP向SRS发起推流请求携带SSRC和IDSSRC是设备推流时RTP里的字段
  3. SRS响应推流请求并返回收流端口。目前SRS仅支持TCP单端口模式在配置文件stream_caster.listen中配置
  4. SRS-SIP通过GB28181协议向设备发起Invite请求携带SRS的收流端口及SSRC
  5. 设备响应成功
  6. SRS-SIP响应成功携带URL用于播放
  7. Player通过返回的URL进行拉流播放
  8. Player停止播放
  9. SRS-SIP通知SRS停止收流
  10. SRS-SIP通过设备停止推流

API 接口

SRS-SIP 提供了完整的 HTTP API 接口用于设备管理、视频流控制、PTZ控制等功能。

详细的API接口文档请参考API接口文档

主要功能

  • 设备管理:获取设备列表、通道信息
  • 视频流控制:发起视频邀请、暂停/恢复、调整播放速度
  • PTZ控制:云台控制(上下左右、缩放)
  • 录像查询:查询历史录像记录
  • 媒体服务器管理:配置和管理媒体服务器

快速开始

# 获取设备列表
curl -X GET "http://localhost:8025/srs-sip/v1/devices"

# 发起视频邀请
curl -X POST "http://localhost:8025/srs-sip/v1/invite" \
  -H "Content-Type: application/json" \
  -d '{
    "device_id": "34020000001320000001",
    "channel_id": "34020000001320000002",
    "media_server_id": 1,
    "play_type": 0
  }'
Description
No description provided
Readme MIT 38 MiB
Languages
Go 44.6%
Vue 40.7%
TypeScript 10.6%
Shell 1.1%
Batchfile 1%
Other 1.9%