package isapi import ( "encoding/xml" "github.com/sirupsen/logrus" ) type SIPServerList struct { SIPServer []struct { ID string `xml:"id" yaml:"ID"` LocalPort string `xml:"localPort" yaml:"localPort"` StreamID string `xml:"streamID" yaml:"streamID"` Standard struct { RegisterStatus string `xml:"registerStatus" yaml:"registerStatus"` Enabled string `xml:"enabled" yaml:"enabled"` Registrar string `xml:"registrar" yaml:"registrar"` RegistrarPort string `xml:"registrarPort" yaml:"registrarPort"` Proxy string `xml:"proxy" yaml:"proxy"` ProxyPort string `xml:"proxyPort" yaml:"proxyPort"` DisplayName string `xml:"displayName" yaml:"displayName"` UserName string `xml:"userName" yaml:"userName"` AuthID string `xml:"authID" yaml:"authID"` Password string `xml:"password" yaml:"password"` Expires string `xml:"expires" yaml:"expires"` } `xml:"Standard" yaml:"Standard"` GB28181 struct { RegisterStatus string `xml:"registerStatus" yaml:"registerStatus"` Enabled string `xml:"enabled" yaml:"enabled"` Registrar string `xml:"registrar" yaml:"registrar"` RegistrarPort string `xml:"registrarPort" yaml:"registrarPort"` ServerId string `xml:"serverId" yaml:"serverId"` ServerDomain string `xml:"serverDomain" yaml:"serverDomain"` UserName string `xml:"userName" yaml:"userName"` AuthID string `xml:"authID" yaml:"authID"` Expires string `xml:"expires" yaml:"expires"` Password string `xml:"password" yaml:"password"` LiveTime string `xml:"liveTime" yaml:"liveTime"` HeartbeatTime string `xml:"heartbeatTime" yaml:"heartbeatTime"` HeartbeatCount string `xml:"heartbeatCount" yaml:"heartbeatCount"` TransportType string `xml:"transportType" yaml:"transportType"` RegisterInterval string `xml:"registerInterval" yaml:"registerInterval"` ProtocolVersion string `xml:"protocolVersion" yaml:"protocolVersion"` PlatformNo string `xml:"platformNo" yaml:"platformNo"` LocalPort string `xml:"localPort" yaml:"localPort"` UnidirectionEnabled string `xml:"unidirectionEnabled" yaml:"unidirectionEnabled"` VoiceBroadcastEnabled string `xml:"voiceBroadcastEnabled" yaml:"voiceBroadcastEnabled"` } `xml:"GB28181" yaml:"GB28181"` } `xml:"SIPServer"` } func (c *Client) PutSip(data []byte) (resp ResponseStatus, err error) { bytes, err := c.CommonPut(data, "/ISAPI/System/Network/SIP") if err != nil { logrus.Error("请求出错", err) return } err = xml.Unmarshal(bytes, &resp) return } func (c *Client) PutSipInfo(data []byte) (resp ResponseStatus, err error) { bytes, err := c.CommonPut(data, "/ISAPI/System/Network/SIP/1/SIPInfo") if err != nil { logrus.Error("请求出错", err) return } err = xml.Unmarshal(bytes, &resp) return } type SIPInfo struct { VideoID string `xml:"videoID"` AlarmInList []string `xml:"AlarmInList"` VideoInputList []struct { VideoInput struct { ID string `xml:"id"` VideoInputID string `xml:"videoInputID"` } `xml:"VideoInput"` } `xml:"VideoInputList"` AudioOutputList []struct { AudioOutput struct { ID string `xml:"id"` AudioOutputID string `xml:"audioOutputID"` } `xml:"AudioOutput"` } `xml:"AudioOutputList"` }