Skip to content

SIP not working when running homeassistant without host networking #10

Open
@mattkasa

Description

@mattkasa
Logger: voip_utils.sip
Source: /usr/local/lib/python3.10/site-packages/voip_utils/sip.py:134
First occurred: 12:37:10 PM (3 occurrences)
Last logged: 1:54:58 PM

Unexpected error handling SIP INVITE
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/voip_utils/sip.py", line 123, in datagram_received
    self.on_call(
  File "/usr/local/lib/python3.10/site-packages/voip_utils/voip.py", line 53, in on_call
    sock.bind((call_info.server_ip, 0))
OSError: [Errno 99] Address not available

I think this is happening because the address (call_info.server_ip) is taken from the INVITE, which looks like this:

INVITE sip:192.168.1.10:5060 SIP/2.0

Without host networking, the homeassistant container has an IP like 172.26.0.20 and cannot bind to 192.168.1.10.

To fix this, maybe we could bind to INADDR_ANY instead of trusting the IP from the INVITE which will not be correct in a lot of networking scenarios?

Something like:

sock.bind(('', 0))

sock.bind((call_info.server_ip, 0))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions