homer7-docker icon indicating copy to clipboard operation
homer7-docker copied to clipboard

Correct syntax for docker-compose.yml DiscardMethod

Open lukeescude opened this issue 3 years ago • 20 comments

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):

  • "HEPLIFYSERVER_DISCARDMETHOD=['OPTIONS','NOTIFY','SUBSCRIBE']"

Thanks!

lukeescude avatar Oct 02 '21 15:10 lukeescude

According to the docs that should be correct indeed:

DiscardMethod = ["OPTIONS","NOTIFY"]

lmangani avatar Oct 02 '21 16:10 lmangani

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

lukeescude avatar Oct 02 '21 16:10 lukeescude

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

lmangani avatar Oct 02 '21 16:10 lmangani

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

lukeescude avatar Oct 02 '21 16:10 lukeescude

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

lukeescude avatar Oct 02 '21 20:10 lukeescude

Ok, will try reproduce.

lmangani avatar Oct 02 '21 20:10 lmangani

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

adubovikov avatar Oct 02 '21 21:10 adubovikov

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

lukeescude avatar Oct 03 '21 16:10 lukeescude

I have learned more:

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

lukeescude avatar Oct 04 '21 15:10 lukeescude

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

lmangani avatar Oct 04 '21 15:10 lmangani

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

lukeescude avatar Oct 04 '21 15:10 lukeescude

let me check it

adubovikov avatar Oct 04 '21 16:10 adubovikov

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 ?

adubovikov avatar Oct 04 '21 16:10 adubovikov

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

lukeescude avatar Oct 04 '21 19:10 lukeescude

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

why ?

adubovikov avatar Oct 04 '21 20:10 adubovikov

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)

lukeescude avatar Oct 04 '21 20:10 lukeescude

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

adubovikov avatar Oct 04 '21 20:10 adubovikov

Okay the order is the problem.

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

lukeescude avatar Oct 04 '21 22:10 lukeescude

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

adubovikov avatar Oct 04 '21 22:10 adubovikov

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

lukeescude avatar Jun 21 '22 20:06 lukeescude