SIP client card, as intercom

ty, will try.

my use case is having a unifi doorbell device ring the phones in my house.
I have sip phones connected to a grandstream pbx…

is my best bet to just create a sip card in HA and have the sip card connect as a grand stream phone line extension. and once the sip card is registered on the grand stream - I can have the sip card dial a ring group on my my pbx?

or is there a better solution?

thx

Just try out :slight_smile:
But the sip card needs a wss connection, not sure if you can create those on your PBX?

how should i make it work on my system? i have a haproxy instance (in pfsense) that handles wildcard certificates, and home assistant itself runs without ssl
should i grab the certs from the pfsense box and copy them over to /config/ssl? so far I get a cert error in the logs and cannot make a call (I have multiple users each on their dedicated devices, have the addon and the card installed and extensions are automatically created)
i would like to use the companion app (both android and ios) and a pc

1 Like

It’s possible to use the card on a http page, but the certificate needs to match. (Or manually accepted but that’s a temporary solution)

So yes you need to find a way to get your certificate in HA, but your certificate probaly updates once a couple months. Or use another certificate. I use duckdns which also creates a certificate.

Make sure that in the card config you set the server to a domain that matches the certificate. You can also set a DNS rewrite to point the domain to a local ip if you only want it locally.

You can use the companion app, but with video make sure the codecs are supported on the devices.
I would try without video first.

OK, I managed to export the certificate from HAProxy and ACME and then I could make it work. I’ll set up a script to export the certs automatically once they update.
I found some things:

  • is there a service or something that would let me change the active view if I have an incoming call? I’d like to have a wall-mount dashboard to be the internal receiver of my video doorbell and that I’d have something else to be the default view, not the empty call card. (I don’t need the service to also change the view, I’ll handle that with Kiosk browser or something, just a service, webhook or an entity that changes state when the phone rings
  • when I tried enabling video with my iPhone and Windows PC I found that I can only see the video of the one that was called, no matter which way I start the call. That is exactly the opposite of what I want to achieve, because the doorbell would call the tablet and I’d like to see the video feed of the doorbell on my tablet (the doorbell does not have a screen, so I don’t care if there is no return feed)

Edit: I also tried using an android phone and it crashes the moment a call would go through, so I am somewhat puzzled. (I have all permissions set for the phone)

1 Like

I think you can use the browser_mod integration in hacs for that.

So if your iphone calls your pc, you can only see video on your iphone and nothing on your pc? You should see eachothers video on both. Did you change the dialplan?

For you android phone, try without video first, check the Asterisk logs, or connect a remote debugger.

So if your iphone calls your pc, you can only see video on your iphone and nothing on your pc? You should see eachothers video on both. Did you change the dialplan?

That is exactly the case. I did not change anything with the dialplan, I installed the addon and it generated all the extensions, I just added them. Tonight (Europe time) I can provide you some config or log details.

For you android phone, try without video first, check the Asterisk logs, or connect a remote debugger.

I’ll do that and get back to you.

ran into a problem. When trying to update Asterisk, an error appears:

Source: components/hassio/update.py:169
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 17:46:54 (3 occurrences)
Last logged: 20:33:04

[2553540696] Error updating Asterisk: Can't install ghcr.io/tech7fox/armv7-addon-asterisk:2.3.0: 500 Server Error for http+docker://localhost/v1.41/images/create?tag=2.3.0&fromImage=ghcr.io%2Ftech7fox%2Farmv7-addon-asterisk&platform=linux%2Farm%2Fv7: Internal Server Error ("manifest unknown")
[2634332912] Error updating Asterisk: Can't install ghcr.io/tech7fox/armv7-addon-asterisk:2.3.0: 500 Server Error for http+docker://localhost/v1.41/images/create?tag=2.3.0&fromImage=ghcr.io%2Ftech7fox%2Farmv7-addon-asterisk&platform=linux%2Farm%2Fv7: Internal Server Error ("manifest unknown")
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/hassio/update.py", line 167, in async_install
    await async_update_addon(self.hass, slug=self._addon_slug, backup=backup)
  File "/usr/src/homeassistant/homeassistant/components/hassio/handler.py", line 45, in _wrapper
    raise HassioAPIError(data["message"])
homeassistant.components.hassio.handler.HassioAPIError: Can't install ghcr.io/tech7fox/armv7-addon-asterisk:2.3.0: 500 Server Error for http+docker://localhost/v1.41/images/create?tag=2.3.0&fromImage=ghcr.io%2Ftech7fox%2Farmv7-addon-asterisk&platform=linux%2Farm%2Fv7: Internal Server Error ("manifest unknown")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 199, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1713, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1750, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 676, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 930, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 713, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/update/__init__.py", line 152, in async_install
    await entity.async_install_with_progress(version, backup)
  File "/usr/src/homeassistant/homeassistant/components/update/__init__.py", line 411, in async_install_with_progress
    await self.async_install(version, backup)
  File "/usr/src/homeassistant/homeassistant/components/hassio/update.py", line 169, in async_install
    raise HomeAssistantError(f"Error updating {self.title}: {err}") from err
homeassistant.exceptions.HomeAssistantError: Error updating Asterisk: Can't install ghcr.io/tech7fox/armv7-addon-asterisk:2.3.0: 500 Server Error for http+docker://localhost/v1.41/images/create?tag=2.3.0&fromImage=ghcr.io%2Ftech7fox%2Farmv7-addon-asterisk&platform=linux%2Farm%2Fv7: Internal Server Error ("manifest unknown")

I tried without video, the Android phone worked with both the PC and with my iPhone.
When video was on, the android phone crashes:
android phone is IP1 (endpoint 102), my iphone is IP2 (endpoint 101)


[Aug 22 20:35:09]   == WebSocket connection from 'IP1:34844' for protocol 'sip' accepted using version '13'
[Aug 22 20:35:09]     -- Added contact 'sip:9kngh378@IP1:34844;transport=ws' to AOR '102' with expiration of 600 seconds
[Aug 22 20:35:09]   == Endpoint 102 is now Reachable
[Aug 22 20:35:11] ERROR[496]: res_http_websocket.c:567 ws_safe_read: Error reading from web socket: Connection reset by peer
[Aug 22 20:35:11]     -- Removed contact 'sip:bh6g4ave@IP2:49896;transport=ws' from AOR '101' due to shutdown
[Aug 22 20:35:11]   == Contact 101/sip:bh6g4ave@IP2:49896;transport=ws has been deleted
[Aug 22 20:35:11]   == Endpoint 101 is now Unreachable
[Aug 22 20:35:11] ERROR[387]: iostream.c:552 ast_iostream_close: SSL_shutdown() failed: error:00000005:lib(0):func(0):DH lib, Underlying BIO error: Bad file descriptor
[Aug 22 20:35:11]   == WebSocket connection from 'IP2:49896' forcefully closed due to fatal write error
[Aug 22 20:35:11] ERROR[502]: res_http_websocket.c:567 ws_safe_read: Error reading from web socket: Success
[Aug 22 20:35:11]     -- Removed contact 'sip:9kngh378@IP:34844;transport=ws' from AOR '102' due to shutdown
[Aug 22 20:35:11]   == Contact 102/sip:9kngh378@IP1:34844;transport=ws has been deleted
[Aug 22 20:35:11]   == Endpoint 102 is now Unreachable
[Aug 22 20:35:11]   == WebSocket connection from 'IP1:34844' closed

and for some reason video still works only one way, when I call my PC from my phone I see my PC’s video on my phone, when I call the other way I only see the other way (I have just updated the addon to the new version before my latest trials)

Yes, there is an issue with the builds for RPI , fix is coming

thanks, I’ll wait

Subscribe to this one, actually is was my fault :slight_smile:

oh. And the author will stop supporting arm completely?

All current architectures are still supported, but for now I will only include the rtsp_sip module for amd64 and i386 until there will be a fix for it. There is already a issue for it: Compilation Error Asterisk 18.14 on Raspberry pi 4 · Issue #5 · tommyjlong/app_rtsp_sip (github.com)

So for now the only difference is that the other architectures don’t have the rtsp_sip module.

Can you share your card config?

for your android phone, it’s probaly a codec issue. Which you can’t do a lot about, except maybe changing the video codec the other end sends. You can try increasing the log level option to see if it is something else.

is there a way to change the codec somewhere? all my clients are currently in HASS, however I plan to use a dahua vto video doorbell

here is my card config:

type: custom:sipjs-card
server: server-address
port: '8089'
button_size: '48'
state_color: true
auto_answer: false
hide_me: false
custom_title: ''
video: true
custom: []
dtmfs:
  - name: dtmf1
    signal: 1
    icon: mdi:door
iceTimeout: 5
prefix: ''
ringtone: ''
ringbacktone: ''
extensions:
  - person: person.1
    name: person1 (windows pc)
    extension: '100'
    secret: xxxx
    icon: mdi:account
  - person: person.2
    name: person2 (ios)
    extension: '101'
    secret: xxxx
    icon: mdi:account-plus
  - person: person.3
    name: person3 (not currently in use)
    extension: '103'
    secret: xxxx
    icon: mdi:home
  - person: person.4
    name: person4 (android)
    extension: '102'
    secret: xxxx
    icon: mdi:home

Don’t think so. Some sip devices have that option though.

On your pc, check the browser console for any errors when you should be getting video.

You can also set a camera entity on extensions and custom objects. That way you still have video on your android device if you can’t get it working.

I have found these errors in the browser console when calling my pc from my iphone (only see video on my iphone), I don’t know if it is related to this:

Uncaught (in promise) INVALID_STATE_ERROR: Invalid status: 9
    at e.answer (https://xxxxxx/hacsfiles/sip-hass-card/sipjs-card.js?hacstag=414692790231:2:119595)
    at oe._answer (https://xxxx/hacsfiles/sip-hass-card/sipjs-card.js?hacstag=414692790231:879:1567)
    at J.handleEvent (https://xxxx/hacsfiles/sip-hass-card/sipjs-card.js?hacstag=414692790231:2:240163)

and how should i create a camera entity for the extensions?

Weird. Do you have multiple sipjs cards loaded?

You can add a existing camera entity in HA to a extension, so when you call with that extension it shows the set camera entity. Like this:

  - person: person.jordy
    name: PC
    extension: '100'
    secret: password
    icon: mdi:monitor
    camera: camera.doorbell

one sip card is added to the same lovelace dashboard that is loaded on each device