sipcapture / heplify

Portable and Lightweight HEP Capture Agent for HOMER
https://sipcapture.org
GNU Affero General Public License v3.0
181 stars 65 forks source link

HEP Collector mode with discard methods #235

Closed lazedo closed 1 year ago

lazedo commented 1 year ago

When using HEP Collector Mode , discard methods (dim option) are not discarded

using freeswitch sofia capture to send to heplify (HEP Collector mode) which sends to heplify-server, heplify configured with -dim OPTIONS but heplify still sends OPTIONS

lazedo commented 1 year ago

changed decoder ProcessHEPPacket to this, seems to be working.

func (d *Decoder) ProcessHEPPacket(data []byte) {

    if config.Cfg.DiscardMethod != "" {
        h, err := DecodeHEP(data)
        if err == nil {
            c := internal.ParseCSeq([]byte(h.Payload))
            if c != nil {
                for _, v := range d.filter {
                    if string(c) == v {
                        return
                    }
                }
            }
        }
    }

    pkt := &Packet{
        Version: 100,
        Payload: data,
    }
    atomic.AddUint64(&d.hepCount, 1)

    PacketQueue <- pkt
}
lmangani commented 1 year ago

Thanks @lazedo for the report + potential fix. feel free to push a PR if it passes your tests - much appreciated!

kYroL01 commented 1 year ago

Hi @lazedo It's implemented here https://github.com/sipcapture/heplify/commit/acb7e54e991e52cf1c4671edd881cc2f46b16320