Update ONVIF discovery request #397
This commit is contained in:
+13
-3
@@ -6,6 +6,7 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -30,17 +31,19 @@ func DiscoveryStreamingHosts() ([]string, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://www.onvif.org/wp-content/uploads/2016/12/ONVIF_Feature_Discovery_Specification_16.07.pdf
|
||||||
|
// 5.3 Discovery Procedure:
|
||||||
msg := `<?xml version="1.0" ?>
|
msg := `<?xml version="1.0" ?>
|
||||||
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
|
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
|
||||||
<s:Header xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing">
|
<s:Header xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing">
|
||||||
<a:Action>http://schemas.xmlsoap.org/ws/2005/04/discovery/Probe</a:Action>
|
<a:Action>http://schemas.xmlsoap.org/ws/2005/04/discovery/Probe</a:Action>
|
||||||
<a:MessageID>uuid:` + UUID() + `</a:MessageID>
|
<a:MessageID>urn:uuid:` + UUID() + `</a:MessageID>
|
||||||
<a:To>urn:schemas-xmlsoap-org:ws:2005:04:discovery</a:To>
|
<a:To>urn:schemas-xmlsoap-org:ws:2005:04:discovery</a:To>
|
||||||
</s:Header>
|
</s:Header>
|
||||||
<s:Body>
|
<s:Body>
|
||||||
<d:Probe xmlns:d="http://schemas.xmlsoap.org/ws/2005/04/discovery">
|
<d:Probe xmlns:d="http://schemas.xmlsoap.org/ws/2005/04/discovery">
|
||||||
<d:Types>tds:Device</d:Types>
|
<d:Types />
|
||||||
<d:Scopes>onvif://www.onvif.org/Profile/Streaming</d:Scopes>
|
<d:Scopes />
|
||||||
</d:Probe>
|
</d:Probe>
|
||||||
</s:Body>
|
</s:Body>
|
||||||
</s:Envelope>`
|
</s:Envelope>`
|
||||||
@@ -67,6 +70,13 @@ func DiscoveryStreamingHosts() ([]string, error) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ignore printers, etc
|
||||||
|
if !strings.Contains(string(b[:n]), "onvif") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
//log.Printf("[onvif] discovery response:\n%s", b[:n])
|
||||||
|
|
||||||
rawURL := FindTagValue(b[:n], "XAddrs")
|
rawURL := FindTagValue(b[:n], "XAddrs")
|
||||||
if rawURL == "" {
|
if rawURL == "" {
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user