feat(call): integrate LiveKit for voice and video calling
Replace the manual WebRTC signaling implementation with LiveKit SFU. This includes: - Adding LiveKit service, handler, and configuration. - Updating Docker Compose to include LiveKit server, Redis, and PostgreSQL. - Refactoring `CallService` and `WSHandler` to support LiveKit room readiness instead of raw SDP/ICE relaying. - Adding new API endpoints for LiveKit token generation and webhooks. - Removing deprecated WebRTC configuration and manual signaling DTOs.
This commit is contained in:
@@ -27,7 +27,7 @@ type Config struct {
|
||||
Casbin CasbinConfig `mapstructure:"casbin"`
|
||||
Encryption EncryptionConfig `mapstructure:"encryption"`
|
||||
HotRank HotRankConfig `mapstructure:"hot_rank"`
|
||||
WebRTC WebRTCConfig `mapstructure:"webrtc"`
|
||||
LiveKit LiveKitConfig `mapstructure:"livekit"`
|
||||
Report ReportConfig `mapstructure:"report"`
|
||||
Sensitive SensitiveConfig `mapstructure:"sensitive"`
|
||||
JPush JPushConfig `mapstructure:"jpush"`
|
||||
@@ -168,10 +168,6 @@ func Load(configPath string) (*Config, error) {
|
||||
viper.SetDefault("hot_rank.recent_window_hours", 168)
|
||||
viper.SetDefault("hot_rank.recent_fetch_limit", 500)
|
||||
viper.SetDefault("hot_rank.candidate_cap", 800)
|
||||
// WebRTC 默认值(Google 公共 STUN 服务器)
|
||||
viper.SetDefault("webrtc.ice_servers", []map[string]any{
|
||||
{"urls": []string{"stun:stun.l.google.com:19302"}},
|
||||
})
|
||||
// Report 默认值
|
||||
viper.SetDefault("report.auto_hide_threshold", 3)
|
||||
viper.SetDefault("jpush.enabled", false)
|
||||
@@ -213,6 +209,13 @@ func Load(configPath string) (*Config, error) {
|
||||
viper.SetDefault("push_worker.max_retries", 3)
|
||||
viper.SetDefault("push_worker.max_stream_len", 100000)
|
||||
viper.SetDefault("push_worker.idle_timeout_ms", 30000)
|
||||
// LiveKit 默认值
|
||||
viper.SetDefault("livekit.enabled", false)
|
||||
viper.SetDefault("livekit.url", "http://localhost:7880")
|
||||
viper.SetDefault("livekit.api_key", "devkey")
|
||||
viper.SetDefault("livekit.api_secret", "")
|
||||
viper.SetDefault("livekit.token_ttl", 600)
|
||||
viper.SetDefault("livekit.webhook_secret", "")
|
||||
|
||||
if err := viper.ReadInConfig(); err != nil {
|
||||
return nil, fmt.Errorf("failed to read config: %w", err)
|
||||
|
||||
11
internal/config/livekit.go
Normal file
11
internal/config/livekit.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package config
|
||||
|
||||
// LiveKitConfig LiveKit SFU 配置
|
||||
type LiveKitConfig struct {
|
||||
Enabled bool `mapstructure:"enabled"`
|
||||
URL string `mapstructure:"url"`
|
||||
APIKey string `mapstructure:"api_key"`
|
||||
APISecret string `mapstructure:"api_secret"`
|
||||
TokenTTL int `mapstructure:"token_ttl"`
|
||||
WebhookSecret string `mapstructure:"webhook_secret"`
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package config
|
||||
|
||||
// WebRTCConfig WebRTC ICE 服务器配置
|
||||
type WebRTCConfig struct {
|
||||
ICEServers []ICEServerConfig `mapstructure:"ice_servers"`
|
||||
}
|
||||
|
||||
// ICEServerConfig ICE 服务器配置
|
||||
type ICEServerConfig struct {
|
||||
URLs []string `mapstructure:"urls"`
|
||||
Username string `mapstructure:"username"`
|
||||
Credential string `mapstructure:"credential"`
|
||||
}
|
||||
Reference in New Issue
Block a user