Skip to content

netham45/ha-sip

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ha-sip

Home Assistant SIP/VoIP Gateway is a Home Assistant add-on which

  • allows the dialing and hanging up of phone numbers through a SIP end-point and triggering of services through dial tones (DTMF) after the call was answered.
  • listens for incoming calls and can trigger actions (the call is not picked up)

You can use dial and hangup with the hassio.addon_stdin service to control outgoing calls in an action in your automation:

service: hassio.addon_stdin
data_template:
  addon: c7744bff_ha-sip
  input:
    command: dial
    number: sip:**[email protected]

or to hang up the call again:

service: hassio.addon_stdin
data_template:
  addon: c7744bff_ha-sip
  input:
    command: hangup
    number: sip:**[email protected]

If there is already an outgoing call to the same number active, the request will be ignored.

To trigger services through DTMF you can define a menu on a call:

service: hassio.addon_stdin
data_template:
  addon: c7744bff_ha-sip
  input:
    command: dial
    number: sip:**[email protected]
    menu:
      message: Press one to open the door, two to turn on light outside
      choices:
        '1':
          message: Door has been opened
          action:
            domain: switch
            service: turn_on
            entity_id: switch.open_front_door
        '2':
          message: Light outside has been switched on
          action:
            domain: light
            service: turn_on
            entity_id: light.outside

To only play a message you can just specify message without any choices:

service: hassio.addon_stdin
data_template:
  addon: c7744bff_ha-sip
  input:
    command: dial
    number: sip:**[email protected]
    menu:
      message: There's a burglar in da house.

Installation

This add-on is for the Home Assistant OS or supervised installation methods mentioned in https://www.home-assistant.io/installation/. With that in place you can install this third-party plug-in like described in https://www.home-assistant.io/common-tasks/os#installing-third-party-add-ons. The repository URL is https://github.com/arnonym/ha-plugins.

After that you need to configure your SIP account, TTS parameters and webhook ID. The default configuration looks like this:

sip:
  registrar_uri: sip:fritz.box
  port: 5060
  id_uri: sip:[email protected]
  realm: '*'
  user_name: homeassistant
  password: secure
tts:
  platform: google_translate
webhook:
  id: sip_call_webhook_id

Usage

Outgoing calls

Outgoing calls are made via the hassio.addon_stdin service in the action part of an automation. To be able to enter the full command, you must switch to YAML mode by clicking on the menu with the triple dot and selecting Edit in YAML. See examples above.

Incoming calls

You can trigger an automation through the Webhook trigger type. The webhook ID must match the ID set in the configuration. You can get the caller from {{trigger.json.caller}} for usage in e.g. the action of your automation.

Use-cases

Personally I use them in two automations:

One with the dial command when the doorbell was rung, and a second with hangup when the front door was opened, so I do not need to answer the call when not necessary.

Ideas

  1. Handle incoming calls with PIN protection?
  2. Go back to main menu with # key or something?

About

Home-Assistant SIP Gateway

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 91.4%
  • Shell 4.8%
  • Dockerfile 3.8%