Hello,
Thanks for your answer.
In fact, my “SSL” setup (for hassio, asterisk,…) was not correct and webrtc seems to be very picky when it comes to connection over unsecured channel. So, once HTTPS, WSS was ok, it when well.
In your doordroid-card.js I have added:
JsSIP.debug.enable('JsSIP:*');
which helped greatly!
I believe that my configuration is OK (SIP extensions, asterisk,…) the only missing bit is incoming audio from the SIP contact. And I believe, I understand why, even if I can’t see what to do…
In my setup the SIP extensions calls the webrtc endpoint. I can accept the call and it can be seen in the debug console:
However, looking at the code, the next event should be:
session.on("addstream", (e) => {
the event addstream AFAIK doesn’t exist any more in the JSSIP 3. It was part of the API in 2.X.
With my (extremely) limited understanding of JS and JSSIP, I can’t figure out what should be the final (?) step to “link” the RTP audio (seen in the wireshark capture) with the audio of my PC.
Thanks !!
Will try that when I am back home.
If I can achieve what I want I will “Share my project” with a lot of credit to you
Next (last ?) episode tonight
GV
Hourrah !! It works. Thank you for your help.
I have (kind of) took some bits of the new version provided yesterday with the previous one. I don’t need the part with the “everywhere” or not
After this first success, I have continued my investigations. When the call is accepted I would like to turn on an input_boolean in hass to do further action.
I thought it would be straightforward. It is not. At least for me.
Here is what I have done:
session.on("peerconnection", () => {
session.connection.addEventListener("addstream", (e) => {
console.log('adding audiostream')
// set remote audio stream (to listen to remote audio)
// remoteAudio is <audio> element on page
const remoteAudio = document.createElement('audio');
//const remoteAudio = droidCard.getElementById('audio-player');
remoteAudio.srcObject = e.stream;
remoteAudio.play();
hass.callservice('input_boolean', 'turn_on', { entity_id: 'input_boolean.portail' });
})
The callservice at the end of the function…
I can’t see the change in lovelace. The input_boolean.portail stays off
Is there something else to do?
How do I debug this? I don’t even know in the developer console if the callservice is called or not.
Hello,
I still have some issues with my setup and I was wondering if you could help!
My (tweaked) version of doodroid.js is running in a view that is not always displayed. Sometimes the tablet falls asleep. As a consequence the webrtc connexion is dropped.
My understanding of javascript gives me the feeling that when the tablet is back on and the doordroid view is displayed, the webrtc connexion is not restarted as it has been Initialized once.
To be on the safe side, wouldn’t it be better to “initialize” again the webrtc phone when the doordroid view is displayed? What would be the best way to do that?
As explained above, JS and I are not the best friends. So, I may miss something here!!
Uncaught TypeError: Cannot read property 'isConnected' of undefined
at HTMLElement.notYetInitialized (doordroid-card.js?v=0.1.14.10:81)
at HTMLElement.set hass [as hass] (doordroid-card.js?v=0.1.14.10:11)
at HTMLElement.value (hui-root.ts:599)
at a (hui-root.ts:437)
In the javascript debug console…
So the idea is (probably) good but the code need something different
If you have an idea. Otherwise, I will start working on this hint.
Would it be possible to adapt this project to allow calling between Lovelace UIs. I would love to be able to be able to answer the front door cam in addition to calling in-between the home assistant tablets mounted in different rooms. Preferably with video but just audio would be ok as well.
I can’t see why it wouldn’t be doable. Not easy though… Create one extension per tablet. Make sure that each tablet only starts its own webrtc (eg. using custom header to mask views based on the client) and tweak the code
GV
The 2N doorphone should be easy to integrate to HA. They have an open API to use.
And if you have the enchanced integration licens you also have the Automation part in 2N which rocks!
I work as a tech support at a copmany that are a reseller for 2N, and i LOVE that product! the most flexible door phone on the market!
If “you” is me (!), then, very likely. It is another sip doorbell. So, you could replace the grandstream gds3710 with this one.
The GDS has also a keyboard and an rfid reader for almost the same price…
GV
Christian and jiiins, i have a 2n ip verso with the enhanced license… but i just cant get it integrated in my home automation… I especially want that if somebody rings and im away, that the video pops up on the iphone and communication is possible… can you help me out? thx
That error can occur for a number of reasons, even if the resource can be found. One possible source is mis-configuration of the card that uses the resource, so take a look at your ui-lovelace.yaml and see if there are possible problems with it.