hoping someone can help me here to figure this out. I also have an open issue on the repo with the same question, but maybe there is an extra pair of eyes here which might just give the right insight.
My goal
To enable my kids to call parents and grandparents using the old analog rotary dial phone connected to a Grandstream HT801.
My devices currently used for testing
device |
id |
HA SIP add-on |
**620 |
Granstream (with analog phone) |
**621 |
My mobile phone |
+316123456789 |
note: the mobile number is of course not my real number, but I didn’t seem very wise to share it publicly on GitHub
What I currently have
Based on my initial setup, and the comments already provided in the GitHub issue, I have now created a menu in which I call a script.
In the script I initiate the call to my mobile phone, and then after connection is established, I try to bridge audio with the HA SIP add on (which initiated the call) and the Granstream (and therefor the analog phone).
Automation with the menu
automation:
- id: aef85bb7-d7c6-4727-84b7-c15f222d7f71
alias: Menu for Grandstream
trigger:
- platform: webhook
local_only: true
webhook_id: sip_call_webhook_id
condition: []
action:
- choose:
- conditions: "{{ trigger.json.parsed_caller == '**621' }}"
sequence:
- service: hassio.addon_stdin
data:
addon: c7744bff_ha-sip
input:
command: answer
number: "**621"
menu:
message:
Hallo, draai 1 om papa te bellen
om te stoppen.
timeout: 30
choices:
"1":
id: papa
message: Papa wordt gebeld
action:
domain: script
service: turn_on
entity_id: script.call_dad
post_action: noop
mode: single
script which is called from the menu
script:
call_dad:
alias: Call dad
mode: restart
sequence:
- service: hassio.addon_stdin
data:
addon: c7744bff_ha-sip
input:
command: dial
number: sip:[email protected]
ring_timeout: 60
sip_account: 1
webhook_to_call:
call_established: sip_connect_call_bridge_621
call_disconnected: sip_call_disconnected
- wait_for_trigger:
- platform: webhook
local_only: true
webhook_id: sip_connect_call_bridge_621
timeout:
minutes: 5
- service: hassio.addon_stdin
data:
addon: c7744bff_ha-sip
input:
command: bridge_audio
number: "**620"
bridge_to: sip:**[email protected]
What happens during testing
what works
- the menu works, and the it mentions that dad is being called
- the call is initiated, my phone will ring and I can pick up the message
- the script runs all it’s actions
what doesn’t work
- audio isn’t bridged to the grandstream. So both parties can’t hear each other.
Log report (level 2)
looks like it’s truncated to 100 lines
| 22:28:12.572833 [1] Connected media 1
| 22:28:12.578578 [1] Call connecting...
| 22:28:12.593258 [1] Call connected
| 22:28:13.604314 [1] Call is established.
| 22:28:13.604507 [ ] Calling webhook sip_call_webhook_id with data {'event': 'call_established', 'caller': '"HA SIP" <sip:**[email protected]>', 'parsed_caller': '**621', 'sip_account': 1}
| 22:28:13.615879 [ ] Webhook response 200 b''
| 22:28:13.616201 [1] Playing message: Hallo, draai 1 om papa te bellen, 2 om mama te bellen en 3 om te stoppen.
| 22:28:13.639059 [ ] Getting audio from "http://192.168.2.3:8123/api/tts_proxy/0d6c71cb34afc69c8d79b3ab6420a184c9caf762_nl-nl_dd0e95eb04_cloud.mp3"
| 22:28:13.937746 [1] No action supplied
Could not deserialize JSON: "command":"answer","number":"**621","menu":{"message":"Hallo, draai 1 om papa te bellen, 2 om mama te bellen en 3 om te stoppen.","timeout":30,"choices":{"1":{"id":"papa","message":"Papa wordt gebeld","action":{"domain":"script","service":"turn_on","entity_id":"script.call_dad"},"post_action":"noop"}}}}
| 22:28:17.619169 [1] Playback interrupted.
| 22:28:17.619429 [1] Scheduled post action: noop
| 22:28:17.624295 [1] onDtmfDigit: digit 1
| 22:28:17.624406 [ ] Calling webhook sip_call_webhook_id with data {'event': 'dtmf_digit', 'caller': '"HA SIP" <sip:**[email protected]>', 'parsed_caller': '**621', 'digit': '1', 'sip_account': 1}
| 22:28:17.632121 [ ] Webhook response 200 b''
| 22:28:17.632292 [1] Current input: 1
| 22:28:17.632333 [ ] Calling webhook sip_call_webhook_id with data {'event': 'entered_menu', 'caller': '"HA SIP" <sip:**[email protected]>', 'parsed_caller': '**621', 'menu_id': 'papa', 'sip_account': 1}
| 22:28:17.644434 [ ] Webhook response 200 b''
| 22:28:17.644736 [1] Playing message: Papa wordt gebeld
| 22:28:17.656002 [ ] Getting audio from "http://192.168.2.3:8123/api/tts_proxy/9a1857f9f2a6f548df225dc970b507f01b95382f_nl-nl_dd0e95eb04_cloud.mp3"
| 22:28:17.760298 [ ] Calling home assistant service on domain script service turn_on with entity script.call_dad
| 22:28:17.778029 [ ] Service response 200 b'[{"entity_id":"script.call_dad","state":"on","attributes":{"last_triggered":"2024-01-13T21:28:17.770475+00:00","mode":"restart","current":1,"friendly_name":"Call dad"},"last_changed":"2024-01-13T21:28:17.770602+00:00","last_updated":"2024-01-13T21:28:17.770602+00:00","context":{"id":"01HM2BKF36HZEDHCJ5E17JDWRD","parent_id":null,"user_id":"5cca702da9834cdeacf34de267570551"}}]'
Could not deserialize JSON: "command":"answer","number":"**621","menu":{"message":"Hallo, draai 1 om papa te bellen, 2 om mama te bellen en 3 om te stoppen.","timeout":30,"choices":{"1":{"id":"papa","message":"Papa wordt gebeld","action":{"domain":"script","service":"turn_on","entity_id":"script.call_dad"},"post_action":"noop"}}}}
| 22:28:17.924123 [ ] Got "dial" command for sip:[email protected]
| &id001
| id: null
| message: null
| audio_file: null
| language: en
| action: null
| choices_are_pin: false
| choices: {}
| default_choice:
| id: null
| message: Unknown option
| audio_file: null
| language: en
| action: null
| choices_are_pin: false
| choices: null
| default_choice: null
| timeout_choice: null
| post_action:
| action: return
| level: 1
| timeout: 300.0
| parent_menu: *id001
| timeout_choice:
| id: null
| message: null
| audio_file: null
| language: en
| action: null
| choices_are_pin: false
| choices: null
| default_choice: null
| timeout_choice: null
| post_action:
| action: hangup
| timeout: 300.0
| parent_menu: *id001
| post_action:
| action: noop
| timeout: 300.0
| parent_menu: null
|
| 22:28:17.926182 [1] Registering call with id sip:[email protected]
| 22:28:17.926220 [ ] Add to state: sip:[email protected]
| 22:28:17.929656 [1] Calling
| 22:28:17.979517 [1] Early
| 22:28:17.979773 [1] onCallMediaState call info state 3
| 22:28:17.979811 [1] Connected media 1
| 22:28:20.037095 [1] Playback done.
| 22:28:20.040290 [1] Scheduled post action: noop
| 22:28:25.884630 [1] Call connecting...
| 22:28:25.886520 [1] onCallMediaState call info state 4
| 22:28:25.886581 [1] Connected media 1
| 22:28:25.886704 [1] Call connected
| 22:28:25.898348 [1] onCallMediaState call info state 5
| 22:28:25.898452 [1] Connected media 1
| 22:28:26.903964 [1] Call is established.
| 22:28:26.904038 [ ] Calling webhook sip_connect_call_bridge_621 with data {'event': 'call_established', 'caller': 'sip:[email protected]', 'parsed_caller': '+31123456789', 'sip_account': 1}
| 22:28:26.910687 [ ] Webhook response 200 b''
| 22:28:26.910822 [ ] Calling webhook sip_call_webhook_id with data {'event': 'call_established', 'caller': 'sip:[email protected]', 'parsed_caller': '+31123456789', 'sip_account': 1}
| 22:28:26.922122 [ ] Webhook response 200 b''
| 22:28:26.922231 [1] No action supplied
| 22:28:26.922292 [1] Scheduled post action: noop
| 22:28:26.924052 [ ] Warning: call not in progress: **620
| 22:28:39.456700 [1] Call disconnected
| 22:28:39.456788 [ ] Calling webhook sip_call_disconnected with data {'event': 'call_disconnected', 'caller': 'sip:[email protected]', 'parsed_caller': '+31123456789', 'sip_account': 1}
| 22:28:39.464117 [ ] Webhook response 200 b''
| 22:28:39.464264 [ ] Calling webhook sip_call_webhook_id with data {'event': 'call_disconnected', 'caller': 'sip:[email protected]', 'parsed_caller': '+31123456789', 'sip_account': 1}
| 22:28:39.471151 [ ] Webhook response 200 b''
| 22:28:39.471295 [ ] Remove from state: sip:[email protected]
| 22:28:42.821003 [1] Call disconnected
| 22:28:42.821063 [ ] Calling webhook sip_call_webhook_id with data {'event': 'call_disconnected', 'caller': '"HA SIP" <sip:**[email protected]>', 'parsed_caller': '**621', 'sip_account': 1}
| 22:28:42.827213 [ ] Webhook response 200 b''
| 22:28:42.827404 [ ] Remove from state: **621
| 22:28:42.928156 [ ] Got "answer" command for **621
| 22:28:42.928208 [ ] Warning: call not in progress: **621