Add "version" to dialin sessions.

This commit is contained in:
Joachim Bauch 2025-03-06 09:15:49 +01:00
commit 957d930613
No known key found for this signature in database
GPG key ID: 77C1D22D53E15F02
3 changed files with 13 additions and 1 deletions

View file

@ -525,6 +525,7 @@ type BackendServerInfoDialout struct {
Connected bool `json:"connected"`
Address string `json:"address,omitempty"`
UserAgent string `json:"useragent,omitempty"`
Version string `json:"version,omitempty"`
Features []string `json:"features,omitempty"`
}

View file

@ -1023,7 +1023,17 @@ func (b *BackendServer) serverinfoHandler(w http.ResponseWriter, r *http.Request
if client := session.GetClient(); client != nil && client.IsConnected() {
dialout.Connected = true
dialout.Address = client.RemoteAddr()
dialout.UserAgent = client.UserAgent()
if ua := client.UserAgent(); ua != "" {
dialout.UserAgent = ua
// Extract version from user-agent, expects "software/version".
if pos := strings.IndexByte(ua, '/'); pos != -1 {
version := ua[pos+1:]
if pos = strings.IndexByte(version, ' '); pos != -1 {
version = version[:pos]
}
dialout.Version = version
}
}
dialout.Features = session.GetFeatures()
}
info.Dialout = append(info.Dialout, dialout)

View file

@ -1549,6 +1549,7 @@ will contain an additional property `dialout` with the following contents:
"connected": true,
"address": "192.168.1.0",
"useragent": "spreed-webrtc-sip-bridge/1.2.3",
"version": "1.2.3",
"features": [
"start-dialout",
"datachannels",