NextGB, web demo powerd by vue

This commit is contained in:
chenhaibo
2025-02-03 16:27:46 +08:00
parent 0b7126b12b
commit c80247286e
113 changed files with 16731 additions and 9944 deletions

View File

@ -1,44 +1,10 @@
package utils
import (
"context"
"crypto/rand"
"flag"
"math/big"
"os"
"github.com/ossrs/srs-sip/pkg/config"
)
func Parse(ctx context.Context) interface{} {
fl := flag.NewFlagSet(os.Args[0], flag.ContinueOnError)
var conf config.MainConfig
fl.StringVar(&conf.Serial, "serial", "34020000002000000001", "The serial number")
fl.StringVar(&conf.Realm, "realm", "3402000000", "The realm")
fl.StringVar(&conf.SipHost, "sip-host", "0.0.0.0", "The SIP host")
fl.IntVar(&conf.SipPort, "sip-port", 5060, "The SIP port")
fl.StringVar(&conf.MediaAddr, "media-addr", "127.0.0.1:1985", "The api address of media server. like: 127.0.0.1:1985")
fl.IntVar(&conf.HttpServerPort, "http-server-port", 8888, "The port of http server")
fl.IntVar(&conf.APIPort, "api-port", 2020, "The port of http api server")
fl.Usage = func() {
fl.PrintDefaults()
}
if err := fl.Parse(os.Args[1:]); err == flag.ErrHelp {
os.Exit(0)
}
showHelp := conf.MediaAddr == ""
if showHelp {
fl.Usage()
os.Exit(-1)
}
return &conf
}
func GenRandomNumber(n int) string {
var result string
for i := 0; i < n; i++ {
@ -64,3 +30,17 @@ func IsVideoChannel(channelID string) bool {
deviceType := channelID[10:13]
return deviceType == "131" || deviceType == "132"
}
// GetSessionName 根据播放类型返回会话名称
func GetSessionName(playType int) string {
switch playType {
case 1:
return "Playback"
case 2:
return "Download"
case 3:
return "Talk"
default:
return "Play"
}
}