125 lines
2.8 KiB
Markdown
125 lines
2.8 KiB
Markdown
# Setting Up the sip_notifier Service
|
|
|
|
The add-on is running, but you need to add the service to Home Assistant manually.
|
|
|
|
## Add to your `configuration.yaml`
|
|
|
|
Add this to `/config/configuration.yaml`:
|
|
|
|
```yaml
|
|
rest_command:
|
|
sip_notification:
|
|
url: "http://088d3b92-sip-notifier:8099/send_notification"
|
|
method: POST
|
|
content_type: "application/json"
|
|
payload: >
|
|
{
|
|
"destination": "{{ destination }}",
|
|
{% if audio_url is defined %}"audio_url": "{{ audio_url }}",{% endif %}
|
|
{% if message is defined %}"message": "{{ message }}",{% endif %}
|
|
"duration": {{ duration | default(30) }}
|
|
}
|
|
```
|
|
|
|
## Restart Home Assistant
|
|
|
|
Settings → System → Restart
|
|
|
|
## Usage
|
|
|
|
After restart, use the service:
|
|
|
|
```yaml
|
|
service: rest_command.sip_notification
|
|
data:
|
|
destination: "+15551234567"
|
|
message: "Hello from Home Assistant!"
|
|
duration: 20
|
|
```
|
|
|
|
Or with audio URL:
|
|
|
|
```yaml
|
|
service: rest_command.sip_notification
|
|
data:
|
|
destination: "+15551234567"
|
|
audio_url: "https://example.com/alert.mp3"
|
|
duration: 30
|
|
```
|
|
|
|
## Alternative: Create a Script
|
|
|
|
If you prefer a more friendly name, add this to `configuration.yaml`:
|
|
|
|
```yaml
|
|
script:
|
|
sip_voice_notification:
|
|
alias: "Send Voice Notification"
|
|
description: "Place a SIP call and play audio"
|
|
fields:
|
|
destination:
|
|
description: "Phone number (+15551234567)"
|
|
example: "+15551234567"
|
|
required: true
|
|
audio_url:
|
|
description: "HTTP(S) URL to audio file"
|
|
example: "https://example.com/alert.mp3"
|
|
required: false
|
|
message:
|
|
description: "Text message for TTS"
|
|
example: "Emergency alert"
|
|
required: false
|
|
duration:
|
|
description: "Call duration in seconds"
|
|
example: 30
|
|
default: 30
|
|
sequence:
|
|
- service: rest_command.sip_notification
|
|
data:
|
|
destination: "{{ destination }}"
|
|
audio_url: "{{ audio_url | default('') }}"
|
|
message: "{{ message | default('') }}"
|
|
duration: "{{ duration | default(30) }}"
|
|
```
|
|
|
|
Then use:
|
|
|
|
```yaml
|
|
service: script.sip_voice_notification
|
|
data:
|
|
destination: "+15551234567"
|
|
message: "This is a test"
|
|
```
|
|
|
|
## Example Automation
|
|
|
|
```yaml
|
|
automation:
|
|
- alias: "Water Leak Alert"
|
|
trigger:
|
|
platform: state
|
|
entity_id: binary_sensor.water_leak
|
|
to: "on"
|
|
action:
|
|
- service: rest_command.sip_notification
|
|
data:
|
|
destination: "+15551234567"
|
|
message: "EMERGENCY! Water leak detected!"
|
|
duration: 40
|
|
```
|
|
|
|
## Troubleshooting
|
|
|
|
### Service not found after restart
|
|
|
|
1. Check configuration.yaml syntax
|
|
2. Check Home Assistant logs for errors
|
|
3. Verify add-on is running (Settings → Add-ons)
|
|
|
|
### Call fails
|
|
|
|
Check add-on logs:
|
|
Settings → Add-ons → SIP Voice Notifier → Log
|
|
|
|
Look for SIP connection errors or audio conversion issues.
|