I am trying to handle SIP MESSAGE communication with a Snom IP phone.
I am running into the exact same issue as has been described before:
The Snom phone has the possibility of sending a MESSAGE packet when a button configured accordingly is pressed.
However, in the SIP MESSAGE sent by the Snom to the Asterisk server, the To header contains a random tag.
I tried this with a more recent firmware version, and the behavior was the same, so it is unlikely that this was just a bug in one firmware version or so that has been fixed in the meantime.
Since I am not a Snom partner, I am not able to file a bug request. Apart from that, I think it’s unlikely that this bug would receive high priority, since they seem pretty busy and focused on fixing all kinds on bugs in their “new generation” models (D862/D865).
My question instead is: Is there a reasonably low-threshold (i.e. not by patching PJSIP sources) way to build a workaround for this problem on the Asterisk side?
For example: Is it possible to register some kind of interceptor/filter in PJSIP that could, for example, manipulate MESSAGE packets appropriately?
It may be possible on the asterisk side depending on how far the messages gets. The fact that the message gets printed by pjsip set logger is a good sign. pjsip_message_filter.c can catch things early but you have to think about how you’d control this. If it’s a “global” “ignore” setting then that could work but if you need to set it on an endpoint-by-endpoint basis then that’s more complicated because the determination of endpoint may not happen until after successful authentication which may be too late.
Which message are you referring to?
The message DEBUG[1328061]: pjproject: <?>: sip_ua_layer.c .Unable to find dialogset for Request msg MESSAGE/cseq=1 (rdata0x7ffeec023958), answering with 481
is not printed by pjsip set logger.
I have not been able to reproduce it so far. The author states he enabled debug logging, I’m not sure whether the debug switch in pjsip.conf is that (I still need to try that) or if he even did a change to the PJSIP source before compiling it.
I was able to reproduce the logging, but I need to set the log level to trace via pjproject.conf. So to me it seems at if the whole case resides and is completely handled inside the guts of pjproject, not touching Asterisk.
[Aug 3 10:42:53] ERROR[653633]: pjproject: <?>: sip_endpoint.c Distributing rdata to modules: Request msg MESSAGE/cseq=1 (rdata0x7f7c0257f8)
[Aug 3 10:42:53] ERROR[653633]: pjproject: <?>: sip_ua_layer.c .Unable to find dialogset for Request msg MESSAGE/cseq=1 (rdata0x7f7c0257f8), answering with 481
[Aug 3 10:42:53] ERROR[653633]: pjproject: <?>: sip_util.c .Response msg 481/MESSAGE/cseq=1 (tdta0x7f340402e8) created