freeswitch/mod_mosquitto

Events are not a valid json messages

antonwantstosleep opened this issue · 2 comments

Describe the bug

The mod is sending messages to the topic with an \x00 addition in the end:

2021-09-05 13:48:36 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on pbx/presence: b'{"Event-Name":"PRESENCE_PROBE","Core-UUID":"4be8dfd0-9f92-4262-b63f-4215d4919aba","FreeSWITCH-Hostname":"pbx.corp.loc","FreeSWITCH-Switchname":"pbx.corp.loc","FreeSWITCH-IPv4":"192.168.60.24","FreeSWITCH-IPv6":"::1","Event-Date-Local":"2021-09-05 13:48:36","Event-Date-GMT":"Sun, 05 Sep 2021 08:48:36 GMT","Event-Date-Timestamp":"1630831716485659","Event-Calling-File":"sofia_reg.c","Event-Calling-Function":"sofia_reg_handle_register_token","Event-Calling-Line-Number":"2130","Event-Sequence":"2644","proto":"sip","login":"internal","from":"1031@mc-vd.corp.loc","to":"1031@mc-vd.corp.loc","event_type":"presence","presence-source":"register","alt_event_type":"dialog"}\x00'

So JSON-parser can not parse it.

Maybe there is a need to trim / sanitize?

Sorry I can`t help with PR - I do not write in C++.

NormB commented
NormB commented

Thank you for the report. Fix has been commited.