Closed ekutner closed 2 years ago
There is something weird here. As mentioned above, the card is not working even on a clean install. That install was of the full HA OS running in a VM, as is my original setup. However, I then noticed that when I tested in a dev build than I'm working on the card was working just fine. So I tested with a container based install and it's working there as well. So I narrowed down the scenario in which the card is not working to be only when using the full HA OS, with the supervisor (I only tested it inside a VM but I don't believe that could have anything to do with it).
Just to be clear, all these setups where just for the sip card, the asterisk server used was always the same one, using the add-on on my original box, so it's definitely a client side and not a server side issue.
Further update. I enabled debug logging for jsSIP and there is a warning message that shows up on setups where it's not working which doesn't show up when it does work. This attached log files show the log traces for successful and failed out going calls. The failed one has a warning coming from jsSIP and then it just stops. successful-call.txt failed-call.txt
Getting here has exhausted my JS abilities so I'm afraid I won't be able to get to the bottom of it by myself.
I'm going to close this now because I figured out what was the problem. After a log debugging session I discovered that the navigator.mediaDevices was null. That caused an exception inside jsSIP that broke the call initialization process. The reason for that was that I've only setup asterisk to use TLS but not HA itself. Apparently that is required for the browser to allow access to the media devices. It worked for setups where I accessed HA under localhost, because that is also allowed by the browser.
Bottom line, HA itself has to be accessed over HTTPS in order for the card to work. I didn't realize that from the documentation and it would have been nice to get a clear error that it wasn't configured properly.
hi @ekutner,
Sorry for the late reply, was away for a couple days.
Thanks for the detailed issue, good that you found it. If I remember correctly it did use to work without HTTPS. But we did switch to jsSIP a little while ago, so that could be the problem.
I will update the docs with a warning for this. Thanks.
Hi @TECH7Fox
for local use is need to configure HA to use https ?
Yes HTTPS is always needed for the WSS connection. I don't remember which but browsers or Asterisk made it required for security reasons or something. No option to turn it off. so even when you only use it locally, you still need to setup HTTPS.
@fernac03 You can read about it here: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia#security
The getUserMedia() method is only available in secure contexts. A secure context is one the browser is reasonably confident contains a document which was loaded securely, using HTTPS/TLS, and has limited exposure to insecure contexts. If a document isn't loaded in a secure context, the navigator.mediaDevices property is undefined, making access to getUserMedia() impossible.
https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts
Locally-delivered resources such as those with http://127.0.0.1 URLs, http://localhost and http://*.localhost URLs (e.g. http://dev.whatever.localhost/), and file:// URLs are also considered to have been delivered securely.
Resources that are not local, to be considered secure, must meet the following criteria:
- must be served over https:// or wss:// URLs
- the security properties of the network channel used to deliver the resource must not be considered deprecated
i cant make this work,
when use http for home assistant when i receive a call on sip card show camera and i can't click to answer only on hangup is possible to click when use https for home assistant call ring once than dropped .
after install webrtc from has. i can answer call but get this error on f12 console when i answer call
sipjs-card.ts:776 Call: newRTCSession: Originator: remote sipjs-card.ts:843 ICE gathering timeout: 5 seconds sipjs-card.ts:928 Call: peerconnection(incoming) sipjs-card.ts:805 Call failed. Originator: system sipjs-card.ts:797 setRemoteDescription() failed: OperationError: Failed to execute 'setRemoteDescription' on 'RTCPeerConnection': Failed to parse SessionDescription. a=fingerprint:SHA-256 Failed to create fingerprint from the digest.
Hi, I also have a clean install of HA OS. My up button doesn't work. Error "Uncaught (in promise) INVALID_STATE_ERROR: Invalid status: 5"
In another case, I saw a problem with WebSocketInterface and it is only on HA OS
I changed server IP to FQDN: Call: peerconnection(incoming) sipjs-card.ts:928:28 Call failed. Originator: system sipjs-card.ts:805:24 setRemoteDescription() failed: InvalidAccessError: Invalid description, no ice-ufrag attribute at level 0
now I need to enable ICE on the local network
@pavelrusiyan can you make a screenshot of the card and error?
Also, any errors in the asterisk logs?
My call from card 108 > 104 getUserMedia() failed: NotFoundError: The object can not be found here.
asterisk : res_pjsip/pjsip_options.c:758 sip_options_contact_status_notify_task: Contact 108/sip:ka6l7cpq@192.168.0.99:64634;transport=ws;x-ast-orig-host=68ip51celdu3.invalid:0 status didn't change: Reachable, RTT: 19.623 msec [Aug 31 06:49:29] DEBUG[725]: res_pjsip/pjsip_options.c:778 sip_options_contact_status_notify_task: AOR '108' now has 1 available contacts
using https works
i`m usage https and fqdn. Sertificate Let’s Encrypt.
I'm trying to get the card to work together with the add-on with no success. The add-on is working fine but not the card. When receiving a call the card shows the incoming call but trying to answer doesn't do anything. Hanging up works. When initiating an outgoing call the UI changes to a "call" UI but nothing else happens. Even the request to allow microphone access is not displayed (it's not enabled yet). The browser console for outgoing calls shows:
The browser console log for incoming calls:
The last row is added when I press the answer button. Since nothing happens, if I press it again I get the following exception:
My card config:
While troubleshooting I tried the following: