Merge pull request #22 from duiniuluantanqin/main

Add command-line
This commit is contained in:
Haibo Chen(陈海博)
2025-04-30 11:19:35 +08:00
committed by GitHub
2 changed files with 18 additions and 2 deletions

View File

@ -21,7 +21,7 @@ If on Windows
Run the program:
```
./objs/srs-sip
./objs/srs-sip -c conf/config.yaml
```
Use docker
@ -29,6 +29,12 @@ 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. 注册流程

View File

@ -2,6 +2,7 @@ package main
import (
"context"
"flag"
"net/http"
"os"
"os/signal"
@ -28,9 +29,18 @@ func WaitTerminationSignal(cancel context.CancelFunc) {
}
func main() {
// 定义配置文件路径参数
configPath := flag.String("c", "", "配置文件路径")
flag.Parse()
if *configPath == "" {
logger.E(nil, "错误: 通过 -c 参数指定配置文件路径,比如:./srs-sip -c conf/config.yaml")
return
}
ctx, cancel := context.WithCancel(context.Background())
conf, err := config.LoadConfig("conf/config.yaml")
conf, err := config.LoadConfig(*configPath)
if err != nil {
logger.E(nil, "load config failed: %v", err)
return