home-assistant-libs / voip-utils

Apache License 2.0
1 stars 5 forks source link

Linphone fixes #13

Open glance- opened 1 year ago

glance- commented 1 year ago

This fixes two issues I found when testing linphone against voip-utils in home-assistant.

glance- commented 1 year ago

With these 3 fixes, I have gotten as far as I hear the "There's a problem with the current voice assistant settings"... which is a completely different issue on my side.

I think this gets us far enough to make the linphone softphone usable.

glance- commented 1 year ago

Any news on this one?

2m commented 1 year ago

@glance- glad to see you put effort into making linphone work with voip-utils. What would be the easiest way for me to test these changes on my HA setup?

glance- commented 1 year ago

Depends quite heavily on what your HA setup is, but generally, just applying the changes to the relevant files in your virtual-env or container, is the quickest and dirtiest approach. Cloning the repo, checking out the pr and installing it in your venv or extending the base container "upgraded" with this package is another one.

2m commented 1 year ago

Thank you for the hints!

I am running HA OS and have successfully installed your patched version with:

docker exec -it homeassistant bash
pip install git+https://github.com/glance-/voip-utils.git@linphone-fixes

However I still get the same error when trying to make a call from linphone:

Unexpected error handling SIP INVITE

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/voip_utils/sip.py", line 63, in datagram_received
    method, ruri, headers, body = self._parse_sip(message)
                                  ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/voip_utils/sip.py", line 224, in _parse_sip
    method = line_parts[0]
             ~~~~~~~~~~^^^
IndexError: list index out of range
2m commented 1 year ago

Aha! I needed to disable media encryption in linphone. And now it works! But it works with both, latest code from home-assistant-libs/voip-utils and also with this fix from your branch.

All in all I did the following in linphone to make it work:

  1. Settings -> Audio -> Codecs -> Disabled all and left only opus on
  2. Settings -> Call -> Media Encryption -> None
  3. Settings -> Click on the SIP account -> Outbound proxy -> Disabled
balloob commented 5 months ago

@glance- sorry this PR got stuck. We are not looking that much into voip right now. Have you tested this with a grandstream ht801 to ensure that this keeps working?

Also, since I have some VoIP enthusiasts in this PR: I've opened a bounty to make outbound calls work.

glance- commented 5 months ago

I don't have access to any grandstream ht801, but i doubt that these changes would break anything. It's basically just more actual sip compatibility.