But the address is used for other stuff too, and won’t work then. Think the best way is a extra optional input.
Ah! Didn’t know that, then yes an extra optional input is best…thanks!
I have a problem. It is normal on the computer. When used on the Android Tablet and phone, it also uses the Chrome and firefox browser. There are audio and video when calling out, but there is only sound and no video when being called in.
Hello,
unfortunately I’m stuck and can’t get any further to use the SIP Card Integration. I set up FreePBX with Asterisk as Raspbx. I followed the instructions on how to setup FreePBX for the Sip Card. Whenever I insert the Asterisk integration according to the instructions, I get the error message “Error connecting to Asterisk: Connection refused” in the logs.
I understand, that the Asterisk add-on is an alternative to my RasPBX-setup and would run directly on Homeassistant OS. But the instructions said that i need a domain for a certificate. However, I would like to use the SIP card only for the Hikvision Doorbell ( DS-KV8213-WME1 ) and two indoor stations (Fire HD 10) as intercoms. I don’t want Homeassistant to be reachable from outside. Do I then have to setup a local domain? And where do I have to set this up?
I’m just a little bit confused about what I’m doing wrong or how to proceed?
Yes, for Lovelace card you need a valid SSL certificate, don’t think certificates are valid on IP…
You can use a free duckdns
For permission denied, you need to allow the IP…
There is an add-on for asterisk, use that one, it’s preconfigured…
Like pergola.fabio said, you should first try to use the SIP-HASS solution as-is. So follow the instructions to setup the Asterisk Add-on, Asterisk Integration and SIP Card exactly like it’s documented at the above link. The original author (TECHFox) did a pretty amazing job to create an out-of-the-box SIP solution for Home Assistant. If you got that working you can think of ‘custom’ stuff like using your own Asterisk instance (ie. raspbx) or other customizations.
Building a SIP system (the right way) is a pretty advanced task and as you already experienced SIP over websockets (the way the SIP Card communicates with Asterisk) are even more challenging.
Your browser (all of them) doesn’t allow unsecured websockets in general so first you need to setup certificates (X509) for Asterisk and accept them in your browser. Technically you could use IP addresses in the Subject Alternatives Name part of your self-signed certificate (or custom X509 PKI setup), but domain names are more easy and the only ones that are being signed and accepted by public CA’s like Let’s Encrypt and all the commercial ones if you use one of these.
If you want to setup your own custom Private / Corporate PKI infrastructure I can recommend XCA
So from SIP → to websockets → to X509 → to DNS
Setting up a DNS system (like SIP, doing it the “right” way is hard) is another challenge, but to make things easy you could use static host files on your system(s). That’s how they did 'DNS" in the old ARPA days ;-). You can make up your ‘own’ domain in this way, like homeassistant.lan or ha.lan or something. Don’t use a .local suffix, these are ‘reserved’ for mDNS / BonJour.
If you’re feeling lucky and like to run your custom (local) authorative DNS server look into Bind (old-skool), PowerDNS (modern) or Unbound, which is actually a recursive DNS resolver, but can be configured to serve authorative (local) domains. It even understands BIND zone files if you like…
There might be a DNS solution in HA itself (or an add-on) which you can use, but the DNS basics are for all the same.
Did I already mentioned some basic IP (routing) knowledge for both SIP and RTP traffic ???
TL;DR
Back to your question…
What logs ? What is refused ?
- Can it resolve the configured hostname (DNS) and/or connect the IP address (Network Config) ?
Integration:
- Did you configure a AMI User in Asterisk ?
- Can it connect ?
- Right credentials ?
Card:
- Is the cerificate configured the right way in both Asterisk and browser ?
- Is the Asterisk websocket active and reachable on port 8089 ?
As explained above, there are some dependencies on the technology used, not the SIP HASS integration itself. Whatever your use-case is, you need to have these in place to do it right.
Use the complete SIP-HASS solution as-is (AddOn, Integration & Card), customize from there if you have a working setup. Thank God (and TECHFox ;-)) the code is that flexible.
I have the integration and add-on working well, but having issues with the card on iOS. Card works fine in Chrome.
In iOS (both ipad and iphone) - when you click to call another extension the sip box pops up for a second and then disappears.
If you call the iPad from chrome, the box shows up, but when you click the Green telephone to answer it drops the call and the box disappears.
This is the latest card version (2.0) and HA is all up to date.
any ideas how to troubleshoot in iOS? I know how to troubleshoot on chrome with devtools…but never had to on iOS.
I have a problem. It is normal on the computer. When used on the Android Tablet and phone, it also uses the Chrome and firefox browser. There are audio and video when calling out, but there is only sound and no video when being called in.
When calling out, it is normal, but when calling in, there is only sound and no video.
This kind of problem only happens between an android and a pc. If both are PCs, there is no such problem.
Seems like someone had the same problem.
Okay, thanks to your answer. I installed the complet SIP-HASS solution + DuckDNS + Let’sEncrypt.
First i tried it with my own domain and generated ssl certificates by dns challang. SIP Card was not working. So i started from beginning with DuckDNS Addon + Let’sEncrypt Addon and setup all to my-ha.duckdns.org but the SIP Card still ist not working. It is shown but nothings happens by a call. So i tested my-ha.duckdns.org:8089/ws and i think there is my problem. The Port 8089 is used in my router by mine internet provider für setting up my router. In the config of my router i can see that the port forwarding is changed from 8089 to 64112 by the router. So when i now call my-ha.duckdns.org:64112/ws i get the right message “Upgrade Required” for working certificates. But i can’t setup the port in the SIP Card to 64112 because it still not works. In the Asterisk Logs i get the message:
WARNING[955]: res_http_websocket.c:831 __ast_websocket_uri_cb: WebSocket connection from 'MY-IP:60459' could not be accepted - did not request WebSocket
Why now port 60459? What i can do to get the SIP Card working?
Do you have video enabled? That doesn’t always work on mobile because it doesn’t always support the video codec it sends.
Not sure how to get a console on IOS… Does the Asterisk logs say anything?
You probaly have the same problem, codecs that are not supported in your mobile browser.
Did you give access to use the camera?
The codecs problem is a known issue, but there’s not a lot I can do about that. For SIP devices like doorbells there sometimes is a option to choose a codec, but for browsers I don’t think that’s possible.
There is a issue open for this: Call fails with video enabled on Android companion app · Issue #67 · TECH7Fox/sip-hass-card (github.com)
If the certificate isn’t accepted, you should see a error box on the card with error 9006...
Can you also check the console log in your browser? (F12)
Thanks KnockKnock!
Getting the certificate to work is indeed not simple. There are a bunch of ways to do this based on your situation. Explained a couple ways here: Card | SIP-HASS - SSL (tech7fox.github.io)
And indeed like you said, you can customize a lot, mainly because of Asterisk + integration for automations. Here is one example: Text-to-Speech | SIP-HASS (tech7fox.github.io)
I don’t want to be rude, just honest…
The forum quote you posted is a lousy problem/bug report (unfortunately most of them are), what intercom ? what laptop ? sip client ? webrtc ? versions ? os ? anyway…
The specsheet of your SIP DoorBell should tell you which codecs are supported.
Most SIP clients (like LinPhone) do have a configuration section for codec settings. WebRTC is a different beast, most of the time you can’t configure anything, but somehow you need to know what is supported for both audio and video.
Some guidance from Mozilla which might help. As of RFC7742 a WebRTC Client (ie. a browser NOT a regular SIP softphone app) MUST support G.711 & Opus for audio and VP8 & H.264 for video.
The SIP-HASS add-on preconfigure endpoints with the following settings, so it should support almost every reasonable SIP situation:
disallow=all
allow=ulaw,alaw,speex,gsm,g726,g723,g722,opus
allow=h264,vp8,vp9
ulaw & alaw are G.711 codecs that give you mid-eighties sound quality. As seen at the above two links WebRTC supports Opus, which provides clear modern audio quality (with the cost of some bandwidth). Most of the times you need to do some extra work in Asterisk to get Opus supported. You can compile it yourself or (for Debian) just apt install asterisk-opus to get the one-size-fits-all Open Source module. You can also get pre-compiled Opus modules from Digium which are more feature rich than the Open Source variant and can be configured with different profiles in /etc/asterisk/codecs.conf
Back to the doorbell and the quoted forum post, if it calls you, it makes sense that both audio and video are RECEIVED. If you call the doorbell you’re SENDING only audio, unless your doorbell has a video screen that displays your (web)cam picture to the man/woman at the door.
But at least you can see that “Our Configuration” only shows video codecs and the “Incoming SDP” shows only audio codecs. Without any further details it’s hard to figure out the right config.
The card is shown normaly without displayed errors. But the console log shows
WebSocket connection to 'wss://192.xxx.xxx.xxx:64112/ws' failed:
When i call this url in browser i get also an unreachable page, when i call https instead wss and instead ip the my-ha.duckdns.org url then i get the message Upgrade Required
. When i call wss://my-ha.duckdns.org/ws i get still an unreachable page.
The console log shows:
WebSocket connection to 'wss://my-ha.duckdns.org:64112/ws' failed:
But the connection to https://my-ha.duckdns.org:8123/ is correct signed by my certificate shown in browser.
What i am doing wrong?
I changed on my pc the hosts file so my-ha.duckdns.org is pointing directly to my internal homeassistant ip 192.xxx.xxx.xxx and not going through my router. And something starts working. After i setup a DNS server for pointing all devices in my network to the internal IP of homeassistant the sip card is working. Perhaps this will helps somebody else, too.
THX for your help
Hello! I’ve installed Asterisk/Sip card etc and have everything up and running. Very confused as to how i can add my HIK Doorbell (SIP) to this? What is the sip server url - how do i create the account etc? Thanks!
I think its best to start reading the asterisk wiki pages, especially if SIP is new to you … its not something you can explain as we dont know your IT skillss
Like pergola.fabio said, easiest is to read the wiki.
Here is the link on how to create a endpoint for a sip doorbell. Doorbell | SIP-HASS (tech7fox.github.io)
There is also a guide for a Dahua VTO doorbell, which could be helpful. Dahua VTO Doorbell | SIP-HASS (tech7fox.github.io)
If your still having problems, there is a link to the discord server at the bottom.
Good luck! Let me know how it goes.