{"id":19233772,"url":"https://github.com/ossrs/srs-sip","last_synced_at":"2025-04-21T04:33:28.787Z","repository":{"id":44428727,"uuid":"461103784","full_name":"ossrs/srs-sip","owner":"ossrs","description":"The SIP demo application for SRS GB28181.","archived":false,"fork":false,"pushed_at":"2024-05-22T02:52:58.000Z","size":125,"stargazers_count":22,"open_issues_count":0,"forks_count":12,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-05-22T03:43:51.287Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://ossrs.net/lts/zh-cn/docs/v5/doc/gb28181","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ossrs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-19T06:11:27.000Z","updated_at":"2024-06-06T08:43:16.511Z","dependencies_parsed_at":"2024-06-06T08:43:13.658Z","dependency_job_id":"3edce0a2-8811-4a3c-9ae7-357c04a1ae76","html_url":"https://github.com/ossrs/srs-sip","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ossrs%2Fsrs-sip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ossrs%2Fsrs-sip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ossrs%2Fsrs-sip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ossrs%2Fsrs-sip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ossrs","download_url":"https://codeload.github.com/ossrs/srs-sip/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249996261,"owners_count":21358098,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T16:11:48.337Z","updated_at":"2025-04-21T04:33:28.781Z","avatar_url":"https://github.com/ossrs.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SRS-SIP\r\n\r\n## Usage\r\n\r\nPre-requisites:\r\n- Go 1.23+\r\n- Node 20+\r\n\r\nThen run\r\n```\r\ngit clone https://github.com/ossrs/srs-sip\r\ncd srs-sip\r\n./build.sh\r\n```\r\n\r\nIf on Windows\r\n```\r\n./build.bat\r\n```\r\n\r\nRun the program:\r\n\r\n```\r\n./objs/srs-sip\r\n```\r\n\r\nUse docker\r\n```\r\ndocker 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\r\n```\r\n\r\n## Sequence\r\n\r\n1. 注册流程\r\n```mermaid\r\nsequenceDiagram\r\n    Device -\u003e\u003e SRS-SIP : 1. Register\r\n    SRS-SIP -\u003e\u003e Device : 2. 401\r\n    Device -\u003e\u003e SRS-SIP : 3. Register\r\n    SRS-SIP -\u003e\u003e Device : 4. 200 OK\r\n```\r\n\r\n2. 播放视频流程\r\nPlayer、SRS-SIP、SRS Server和GB28181 Device的交互图如下：\r\n\r\n```mermaid\r\nsequenceDiagram\r\n    Player -\u003e\u003e SRS-SIP : 1. Play Request(with id)\r\n    SRS-SIP -\u003e\u003e  SRS : 2. Publish Request(with ssrc and id)\r\n    SRS -\u003e\u003e SRS-SIP : 3. Response(with port)\r\n    SRS-SIP -\u003e\u003e  Device : 4. Invite(with port)\r\n    Device -\u003e\u003e SRS-SIP : 5. 200 OK\r\n    SRS-SIP -\u003e\u003e Player : 6. 200 OK(with url)\r\n    Device --\u003e\u003e SRS : Media Stream\r\n    Player -\u003e\u003e SRS : 7. Play\r\n    SRS --\u003e\u003e Player : Media Stream\r\n    Player -\u003e\u003e SRS-SIP : 8. Stop Request\r\n    SRS-SIP -\u003e\u003e SRS : 9. Unpublish Request\r\n    SRS-SIP -\u003e\u003e Device : 10. Bye\r\n```\r\n\r\n1. 通过SRS-SIP提供的API接口`/srs-sip/v1/invite`，Player主动发起播放请求，携带设备的通道ID\r\n2. SRS-SIP向SRS发起推流请求，携带SSRC和ID，SSRC是设备推流时RTP里的字段\r\n3. SRS响应推流请求，并返回收流端口。目前SRS仅支持TCP单端口模式，在配置文件`stream_caster.listen`中配置\r\n4. SRS-SIP通过GB28181协议向设备发起`Invite`请求，携带SRS的收流端口及SSRC\r\n5. 设备响应成功\r\n6. SRS-SIP响应成功，携带URL，用于播放\r\n7. Player通过返回的URL进行拉流播放\r\n8. Player停止播放\r\n9. SRS-SIP通知SRS停止收流\r\n10. SRS-SIP通过设备停止推流\r\n\r\n\r\n## API 接口\r\n\r\n- 请求与响应数据格式为JSON\r\n- 所有响应的统一结构为：\r\n```json\r\n{\r\n  \"code\": 0,\r\n  \"data\": {}\r\n}\r\n```\r\n\r\n错误响应示例：\r\n```\r\n{\r\n  \"code\": 500,\r\n  \"data\": {\r\n    \"msg\": \"error message\"\r\n  }\r\n}\r\n```\r\n\r\n### 接口列表\r\n\r\n暂无，请参考demo。\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fossrs%2Fsrs-sip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fossrs%2Fsrs-sip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fossrs%2Fsrs-sip/lists"}