SIP (VoIP) Monitoring for incoming calls using MQTT

Thanks at lot @derdude41065. But my skills are not good enough to change this file in a container. I could change it in a backup, if it is a editable file, and load the backup. I just searched for sip2mqtt.py, but could not find it. I guess it is a compiled file in the backup. Could you send me your relevant file so I can exchange it in the backup?

Or could you @MartyTremblay make this a configurable element?
acc_cfg.allow_contact_rewrite = False or True

This seems to finally solve my door bell problem. Great work!

I ran into the same problem (plus more). To fix it for me, I forked the original add-on repository and applied the fixes there. You could give it a try: GitHub - manutoky/hassio-addons: some Hass.IO Addons

Fixes:

  • allow_contact_rewrite=True
  • enable build on aarch64 by using option --disable-libwebrtc

Great work! Thanks a lot! It is working perfectly and really fast.

@MartyTremblay: I can now confirm that the change allow_contact_rewrite=True fixes the problem of sip2mqtt not recognizing calls in my configuration with a Fritz!Box. Maybe you can change that in your script for the future.

Maybe it helps others: I had to change the MQTT sensor in configuration.yaml a bit to get it to work:

sensor:
  - platform: mqtt
    name: Tuerklingel SIP2MQTT
    unique_id: tuerklingel_sip2mqtt
    state_topic: "home/sip"
    icon: "mdi:bell"
    #value_template: '{{ value_json.verb }}'  # does not work
    value_template: '{{ value_json["verb"] }}'
    json_attributes_topic: "home/sip"

I’ve tried to install @raphii 's addon but I’m getting the following error:

Traceback (most recent call last):
File “sip2mqtt.py”, line 216, in
main(sys.argv[1:])
File “sip2mqtt.py”, line 164, in main
broker.connect(args.mqtt_domain, args.mqtt_port, args.mqtt_keepalive)
File “/usr/lib/python2.7/site-packages/paho/mqtt/client.py”, line 839, in connect
return self.reconnect()
File “/usr/lib/python2.7/site-packages/paho/mqtt/client.py”, line 962, in reconnect
sock = socket.create_connection((self._host, self._port), source_address=(self._bind_address, 0))
File “/usr/lib/python2.7/socket.py”, line 557, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
socket.gaierror: [Errno -2] Name does not resolve

I’m using the standard core_mosquitto broker with domain of core_mosquitto and default port of 1883.

Any thoughts on what I’m missing?

I figured out the issue. The domain only seems to work with IP addresses and not names like homeassistant.local.

Did this ever get released for the RPi?

I’m getting the following install error

The command '/bin/ash -o pipefail -c apk add --no-cache python2 py2-paho-mqtt && python -m ensurepip && rm -r /usr/lib/python*/ensurepip && pip install --upgrade pip setuptools && rm -r /root/.cache && apk add --no-cache --virtual .build4pjsip alpine-sdk && apk add --no-cache libsrtp-dev python2-dev openssl-dev linux-headers && curl -L -s -S https://raw.githubusercontent.com/MartyTremblay/sip2mqtt/master/sip2mqtt.py -O && cd && curl -L -s -S "https://github.com/pjsip/pjproject/archive/${VERSION_PJSIP}.tar.gz" | tar -xz && cd "pjproject-${VERSION_PJSIP}" && ./configure --with-external-srtp --enable-shared --disable-sound --disable-sdl --disable-speex-aec --disable-video --prefix=/usr/local > /dev/null && make dep && make && make install && cd pjsip-apps/src/python && make && make install && cd && rm -rf "pjproject-${VERSION_PJSIP}" && apk del .build4pjsip' returned a non-zero code: 2

I’ve got raphii’s version installed using the repo - GitHub - raph2i/hassio-addons: some Hass.IO Addons
I’d like to get the version with VCF support that @ntuseracc did per GitHub - sonicnkt/sip2mqtt: A SIP monitoring script that publishes incoming calls with CallerID to an MQTT channel
Is there an easy way to switch? I can’t seem to add that second URL as a repo

Otherwise, has anyone else a method of doing a number lookup?

I installed the SIP2MQTT addon and for whatever reason, it doesn’t show up in MQTT.
The logs doesn’t show anything abnormal… Any idea?

Hi, I just installed this addon and with sipgate credentials it works fine.
My main line, however, is Deutsche Telekom with the SIP server sip.t-online.de
If I enter the Telekom credentials that are working with my SIP phones, and start up sip2mqtt the log file throws a 502 bad gateway error.
Did someone have success in connecting with a SIP line from Deutsche Telekom?

sipdomain: tel.t-online.de
sipuser: +49myphonenumber
sippass: SecretTelekomSIPpassword

Perhaps I just have to enter some data in a different format?

did you solve this problem?