sipcapture / homer7-docker

HOMER 7 Docker Images
93 stars 84 forks source link

Correct syntax for docker-compose.yml DiscardMethod #107

Open lukeescude opened 2 years ago

lukeescude commented 2 years ago

Hello, what is the correct syntax to supply HeplifyServer with DiscardMethod?

I am using the following, and I don't believe it works (I can still look at OPTIONS packets inside Homer):

Thanks!

lmangani commented 2 years ago

According to the docs that should be correct indeed:

DiscardMethod = ["OPTIONS","NOTIFY"]

lukeescude commented 2 years ago

That makes sense for normal heplify server, but for docker compose file I’m not sure how it wants an array of strings?

lmangani commented 2 years ago

There is no translation, heplify-server looks for the same settings in ENV so they are equivalent/transparent (escaping excluded which might perhaps be the issue here) the compose file just passes everything forward

lukeescude commented 2 years ago

Okay I will play around with escaping and let you know!

lukeescude commented 2 years ago

Yes unfortunately it seems the docker image is not paying attention to DiscardMethod... OPTIONS, NOTIFY, and SUBSCRIBE packets are still being logged in homer-app

lmangani commented 2 years ago

Ok, will try reproduce.

adubovikov commented 2 years ago

for docker you should not escape it DiscardMethod = [OPTIONS,NOTIFY]

lukeescude commented 2 years ago

I have tried that as well, still OPTIONS packets are logged in Homer.

lukeescude commented 2 years ago

I have learned more:

DiscardMethod works for NOTIFY packets, but it is not working for SUBSCRIBE or OPTIONS it seems.

lmangani commented 2 years ago

Are those inband OPTIONS (within a call-flow) or out-of-band in the generic partition?

lukeescude commented 2 years ago

I believe out-of-band, used just for devices to qualify or "ping" the server. (and for the server to qualify or "ping" devices)

adubovikov commented 2 years ago

let me check it

adubovikov commented 2 years ago

nop, it should discard it - look at the code

https://github.com/sipcapture/heplify-server/blob/master/decoder/decoder.go#L143-L148


if len(config.Setting.DiscardMethod) > 0 {
            for k := range config.Setting.DiscardMethod {
                if config.Setting.DiscardMethod[k] == h.SIP.CseqMethod {
                    h.ProtoType = 0
                    return nil
                }
            }
        }

what if you add switch positions OPTIONS and NOTIFY in the DiscardMethod ? Will it change something ?

lukeescude commented 2 years ago

Out of curiosity, would it be a good idea to use both CseqMethod and FirstMethod for discarding?

I will try reordering and let you know

adubovikov commented 2 years ago

Out of curiosity, would it be a good idea to use both CseqMethod and FirstMethod for discarding?

why ?

lukeescude commented 2 years ago

It looks like they should both work, but maybe the issue is that CseqMethod is not populating for OPTIONS packets because they are out-of-band (stateless)

adubovikov commented 2 years ago

no, because CSeq always includes the method to build a transaction flow and doesn't matter if it stateless or state full

lukeescude commented 2 years ago

Okay the order is the problem.

Switched OPTIONS and NOTIFY, now OPTIONS are being discarded but NOTIFY is back.

adubovikov commented 2 years ago

aha, so, lets add it twice as a workaround and i will recheck why it happens during next days...

lukeescude commented 2 years ago

Do you have an update on this? The discard methods not being read properly (order)