Skip to content

Commit

Permalink
Merge pull request #469 from sipcapture/fix_time
Browse files Browse the repository at this point in the history
removed force to local time by time desync
  • Loading branch information
adubovikov authored Apr 30, 2021
2 parents 842d096 + 0325bf5 commit 1071aa4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package config

const Version = "heplify-server 1.54"
const Version = "heplify-server 1.55"

var Setting HeplifyServer

Expand Down
10 changes: 4 additions & 6 deletions decoder/decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,10 @@ func (h *HEP) parse(packet []byte) error {
}
}

t := time.Now()
h.Timestamp = time.Unix(int64(h.Tsec), int64(h.Tmsec*1000))
d := t.Sub(h.Timestamp)
if d < 0 || (h.Tsec == 0 && h.Tmsec == 0) {
logp.Debug("hep", "got timestamp in the future with delta: %d from nodeID %d", d, h.NodeID)
h.Timestamp = t
if h.Tsec == 0 && h.Tmsec == 0 {
logp.Debug("hep", "got null timestamp from nodeID %d", h.NodeID)
h.Timestamp = time.Now()
}

h.normPayload()
Expand All @@ -138,7 +136,7 @@ func (h *HEP) parse(packet []byte) error {
if m == h.SIP.CseqMethod {
lb := len(h.SIP.Body)
h.SIP.Body = strings.Repeat("x", lb)
h.Payload = h.Payload[:len(h.Payload) - lb] + h.SIP.Body
h.Payload = h.Payload[:len(h.Payload)-lb] + h.SIP.Body
}
}

Expand Down

0 comments on commit 1071aa4

Please sign in to comment.