Skip to content
This repository has been archived by the owner on Oct 13, 2024. It is now read-only.

Files

Latest commit

75b5164 · Aug 10, 2023

History

History

dss_voip

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Jan 26, 2021
Jan 26, 2021
Jun 5, 2022
Jun 5, 2022
Aug 10, 2019
Aug 10, 2023
Jun 5, 2022
Jun 5, 2022
Jan 26, 2021
Jan 26, 2021

SDeSalve Hass.io Add-ons: DSS VoIP Notifier

Supports aarch64 Architecture Supports amd64 Architecture Supports armhf Architecture Supports armv7 Architecture Supports i386 Architecture

Support my work on Paypal

This add-on allows you to make VoIP calls from Hass.io.

Features

This add-on provides a way to transform a text in a audio file, make a VoIP call to a SIP url and play them to the attendee. You will need a valid VoIP account and their parameters to customize this addon config.

Obviously you need to setup Google Translate Text-to-Speech. The google_translate text-to-speech platform uses unofficial Google Translate Text-to-Speech engine to read a text with natural sounding voices. Ensure that Google TTS is activated on your Home Assistant configuration.yaml:

# Text to speech
tts:
  - platform: google_translate
    service_name: google_translate_say
    language: 'it'
    base_url: Please provide a valid base url for Google TTS
    ...

Installation

The installation of this add-on is pretty straightforward and not different in comparison to installing any other Hass.io add-on.

  1. Add my Hass.io add-ons repository (https://github.com/sdesalve/hassio-addons) to your Hass.io instance.
  2. Install the "DSS VoIP Notifier" add-on.
  3. Configure at least the caller_id_uri, username, and password options.
  4. Start the "DSS VoIP Notifier" add-on.
  5. Check the logs of the "DSS VoIP Notifier" add-on to see if everything went well. Addons will wait to be invoked from an automation/script.

Configuration

Note: Remember to restart the add-on when the configuration is changed.

DSS VoIP Notifier add-on configuration:

sip_parameters:
  caller_id_uri: 'sip:username@sipserver.com'
  realm: '*'
  username: 'username'
  password: 'password'

Note: This is just an example, don't copy and paste it! Create your own!

Basic options

Option sip_parameters: caller_id_uri (Required)

Set SIP URL of the caller account (i.e. From header). For example: "sip:username@sipserver.com"

Option sip_parameters: username (If required by outgooing server in call_sip_uri. See below.)

Set authentication user ID.

Option sip_parameters: password (If required by outgooing server in call_sip_uri. See below.)

Set authentication password (clear text).

Option sip_parameters: realm (Optional)

Set authentication realm. The realm is used to match this credential against challenges issued by downstream servers. If the realm is not known beforehand, wildcard character ('*') can be specified to make SIP Client respond to any realms.

Advanced options

Following options are not required for a standard setup. Use them if you know what are you doing.

Option sip_parameters: sip_server_uri (Optional)

Set the URL of the registrar server. If set, addon will auto-answer to call and play a dummy audio so you can check system's status. An example of URL: "sip:sipserver.com"

Option pjsua_custom_options (Optional)

Set optional custom command's line options. For reference see PJSua man page.

Option sox_custom_options_input_file (Optional)

Set optional custom command's line options for input file. For reference see SoX man page.

Option sox_custom_options_output_file (Optional)

Set optional custom command's line options for output file. For reference see SoX man page.

Option max_call_time (Optional)

Set maximum call duration in seconds. Accept value between 10 and 120 seconds, but must be in single quotes. Default value if this option is not specified is 50 seconds. If set to '-1' max_call_time is set to the length of the wav file being read. This setting is to accommodate auto-answering systems like pagers and intercoms. Be advised that many such systems will present insert a short beep at the start of the page. It may be adventitious to pad some small amount of silence at that start of the wav file. See call_duration below. The timer starts working after a call is initiated and is not related to the call status.

Option platform_tts (Optional)

Specify Text-to-speech platform to use. Default value if this option is not specified is google_translate. For a list of available TTS integration please see Hassio integrations

Example config for some VoIP providers

A Fritz!Box with VoIP PBX

sip_parameters:
  caller_id_uri: 'sip:username@fritz.box:5060'
  realm: '*'
  username: 'username'
  password: 'password'
pjsua_custom_options: '--ip-addr=RASPBERRY_IP_ADDRESS'

Note: call_sip_uri in Hass.io service call must end with @fritz.box:5060. An example of URL: "sip:+393334455667@fritz.box:5060".

Please note that "pjsua_custom_options": "--ip-addr=RASPBERRY_IP_ADDRESS" is mandatory and you need to replace RASPBERRY_IP_ADDRESS with your LAN Raspberry IP Address

sip_parameters:
  caller_id_uri: 'sip:extension@pbxes.com'
  realm: '*'
  username: 'extension'
  password: 'password'

Note: call_sip_uri in Hass.io service call must end with @pbxes.com. An example of URL: "sip:+393334455667@pbxes.com"

sip_parameters:
  caller_id_uri: 'sip:AAAAA12456aaaaaaaa@sip.vohippo.com'
  realm: '*'
  username: 'AAAAA12456aaaaaaaa'
  password: 'ABCDE123456789FGHI'

Note: call_sip_uri in Hass.io service call must end with @sip.vohippo.com. An example of URL: "sip:+393334455667@sip.vohippo.com"

sip_parameters:
  caller_id_uri: 'sip:phonenumber@voip.eutelia.it'
  realm: '*'
  username: 'phonenumber'
  password: 'password'

Note: call_sip_uri in Hass.io service call must end with @voip.eutelia.it. An example of URL: "sip:+393334455667@voip.eutelia.it"

sip_parameters:
  caller_id_uri: 'sip:extension@domain.3cx.com.au'
  realm: '*'
  username: 'AuthenticationID'
  password: 'AuthenticationPassword'
pjsua_custom_options: '-–no-tcp'

Note: Use the Authentication ID and Password from the Extension settings for username and password, but the SIP extension number for the caller ID URI

sip_parameters:
  caller_id_uri: 'sip:numerointerno@sip.messagenet.it'
  realm: '*'
  username: 'numerointerno'
  password: 'password'
pjsua_custom_options: '--outbound=sip:sip.messagenet.it:5061;lr'

Note: numerointerno is a personal ID (aka URI or Internal number) that you have received with a mail from Messagenet. Be aware: is not your Messagenet User ID that you use to login on Messagenet website. call_sip_uri in Hass.io service call must end with @sip.messagenet.it. An example of URL: "sip:+393334455667@sip.messagenet.it"

FreeVoipDeal/Any other Dellmont/Betamax provider

sip_parameters:
  caller_id_uri: 'sip:username_or_phonenumber@sip.freevoipdeal.com'
  realm: '*'
  username: 'username'
  password: 'password'
pjsua_custom_options: '--no-tcp'

Note: call_sip_uri in Hass.io service call must end with @sip.freevoipdeal.com. An example of URL: "sip:+393334455667@sip.freevoipdeal.com". Option username_or_phonenumber can be your FreeVoipDeal username or any of authorized numbers. Please note that "pjsua_custom_options": "--no-tcp" is mandatory. Without it you'll get an 408 error:

pjsua_app.c ....Call 0 is DISCONNECTED [reason=408 (Request Timeout)]

For a list of all Dellmont/Betamax provider and for get price comparison, please visit Voip-comparison.com.

2talk is a NZ based VoIP and internet provider. Getting it set up with this addon was easy.

sip_parameters:
  caller_id_uri: 'sip:areacodeandnumber@2talk.co.nz:5060'
  realm: '*'
  username: areacodeandnumber
  password: secretpassword

Where areacodeandnumber is in the format 035556789 (03 is the area code, the phone number is 5556789). This is the same login you would use in connecting your VoIP phone to 2talk.

sipgate.co.uk

sip_parameters:
  caller_id_uri: sip:12345678@sipgate.co.uk
  realm: '*'
  username: '12345678'
  password: MYPASS
  sip_parameters: sip:sipgate.co.uk
pjsua_custom_options: '--no-tcp'

VoIP NETelip

sip_parameters:
  caller_id_uri: sip:USSERVOIP@sip.netelip.com:9060
  realm: '*'
  username: 'USSERVOIP'
  password: 'PASSWORD'
  sip_server_uri: sip.netelip.com:9060
pjsua_custom_options: '-–no-tcp --outbound=sip:sip.netelip.com:9060;lr'

Thanks to Javier Domingo

How to use

You will need to call this addon from your Hass.io automation/script usign following yaml service invoke:

   ...
    - service: hassio.addon_stdin
      data_template:
        addon: 89275b70_dss_voip
        input: {"call_sip_uri":"sip:+393334455667@sipserver.com","message_tts":"Write here your message"}
   ...

Note: Make sure call_sip_uri was a SIP URI and ends with your SIP server. See samples above for some VoIP providers config. If you have to use special character in your JSON string, you can escape it using \ character.

See this list of special character used in JSON :

\b  Backspace (ascii code 08)
\f  Form feed (ascii code 0C)
\n  New line
\r  Carriage return
\t  Tab
\"  Double quote
\\  Backslash character

Option call_sip_uri (Required)

Set SIP URL to call. For example: "sip:username@sipserver.com" or "sip:+393334455667@sipserver.com" Outgooing SIP server can require authentication. Please set an username and password under sip_parameters section in addon config.

Note: To call external PTSN numbers, use the number in the SIP URI accounting for your dialer settings. For example for 3CX you may use "sip:0412345678@domain.3cx.com.au" and this will call the PTSN number if accessible from your PBX / VoIP provider.

Option message_tts (Required if audio_file_url is not specified)

Write here your message that will be played thru TTS to the attendee. If this option is not specified, the add-on will check presence of audio_file_url option. If nor message_tts neither audio_file_url are specified an error will raise.

Option audio_file_url (Required if message_tts is not specified)

Write here a valid URL of a MP3 file that will be played to the attendee. If nor message_tts neither audio_file_url are specified an error will raise.

Note: The length of the audio file should not be longer than 2 minutes 20 seconds. Anything longer and PjSua would start breaking up the voice path after that time. The sound plays fine for the first 2 minutes and 20 seconds and then starts breaking up. With 2 minute audio files, however, the sound plays endlessly.

Option call_duration (Optional)

Set maximum call duration in seconds. Be aware that timer starts running after a call is initiated and is not related to the call status. If this option is specified max_call_time will be overwrited for service invocation. If set to '-1' this will set the call duration to the length of the wav file. See max_call_time above.

Support

Got questions?

You have several options to get them answered:

GATracking

Contributing

This is an active project. I'm always open to people who want to use the code or contribute to it.

Thank you for being involved! 😍

Authors & contributors

The original setup of this repository is by SDeSalve.

License

Copyright (c) 2019-2021 SDeSalve

See LICENSE