feat(call): integrate call handling and WebSocket support
- Added CallHandler and related services for managing call sessions and participants. - Enhanced WSHandler to support call signaling, including invite, answer, reject, and end functionalities. - Updated router to include call-related routes for history and ICE server retrieval. - Introduced WebRTC configuration in the application settings for call management. - Refactored wire generation to include CallService and CallRepository for improved dependency injection.
This commit is contained in:
@@ -29,6 +29,7 @@ type Config struct {
|
||||
Casbin CasbinConfig `mapstructure:"casbin"`
|
||||
Encryption EncryptionConfig `mapstructure:"encryption"`
|
||||
HotRank HotRankConfig `mapstructure:"hot_rank"`
|
||||
WebRTC WebRTCConfig `mapstructure:"webrtc"`
|
||||
}
|
||||
|
||||
// Load 加载配置文件
|
||||
@@ -150,6 +151,10 @@ 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]interface{}{
|
||||
{"urls": []string{"stun:stun.l.google.com:19302"}},
|
||||
})
|
||||
|
||||
if err := viper.ReadInConfig(); err != nil {
|
||||
return nil, fmt.Errorf("failed to read config: %w", err)
|
||||
|
||||
13
internal/config/webrtc.go
Normal file
13
internal/config/webrtc.go
Normal file
@@ -0,0 +1,13 @@
|
||||
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