arnonym / ha-plugins

Home-Assistant SIP Gateway
Apache License 2.0
170 stars 22 forks source link

sending "stop_playback" on established bridged calls, will reset ha-sip #116

Open catohagen opened 2 weeks ago

catohagen commented 2 weeks ago

I'm not sure if I can explain this, but I'm pretty sure this worked fine before...

Normally when dialing another phone connected to ha-sip, there is just silence while waiting for the other phone to pick up. So when calling another phone, ha-sip will play an mp3 for the the caller while waiting for the other phone to pick up. This mp3 is a recoding from a old phonecall, the sounds after you dialed a number, the long repeating beeps :)

When the target phone picks up and the two phones gets bridged, the mp3 needs to stop and this worked fine by sending command: stop_playback to the caller's number and both phones stayed bridged and audio worked fine..

But now a few seconds after the "stop_playback" command are issued, ha-sip just restarts :

calling from port_04 to port_03 :

23:36:43.800219 [1] Registering call with id sip:port_03@192.168.1.162:5060
| 23:36:43.800246 [ ] Add to state: sip:port_03@192.168.1.162:5060
| 23:36:43.803917 [1] Calling
| 23:36:43.868187 [1] Early
| 23:36:46.226735 [1] Call connecting...
| 23:36:46.227398 [1] onCallMediaState call info state 4
| 23:36:46.227489 [1] Connected media 1
| 23:36:46.228166 [1] Call connected
| 23:36:46.308558 [1] onCallMediaState call info state 5
| 23:36:46.308663 [1] Connected media 1
| 23:36:47.234931 [1] Call is established.
| 23:36:47.234987 [1] Calling additional webhook sip_connect_call_bridge_03 for event call_established
| 23:36:47.235008 [ ] Calling webhook sip_connect_call_bridge_03 with data {'event': 'call_established', 'caller': 'sip:port_03@192.168.1.162:5060', 'parsed_caller': 'port_03', 'sip_account': 1}
| 23:36:47.247244 [ ] Webhook response 200 b''
| 23:36:47.248517 [ ] Calling webhook sip_call_webhook_id with data {'event': 'call_established', 'caller': 'sip:port_03@192.168.1.162:5060', 'parsed_caller': 'port_03', 'sip_account': 1}
| 23:36:47.266072 [ ] Webhook response 200 b''
| 23:36:47.266516 [1] No action supplied
| 23:36:47.266626 [1] Playback interrupted.
| 23:36:47.269317 [1] Scheduled post action: noop
| 23:36:47.270714 [1] Scheduled post action: noop
| 23:36:49.304838 [1] Connect audio stream of "port_04" and "sip:port_03@192.168.1.162:5060"
| 23:36:49.304964 [1] Audio streams connected.
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
Getting config options from home-assistant OS.
Python 3.11.3
| 23:37:11.849195 [ ] Setting name server: ['192.168.1.1']
| 23:37:11.849313 [ ] Found cache directory '/config/audio_cache'
| 23:37:11.892109 [1] Loaded menu for incoming call.
| 23:37:11.892253 [2] No file name for incoming call config specified.
| 23:37:11.892276 [3] No file name for incoming call config specified.
23:37:11.892         os_core_unix.c !pjlib 2.14.1 for POSIX initialized
23:37:11.894         sip_endpoint.c  .Creating endpoint instance...
23:37:11.894                  pjlib  .select() I/O Queue created (0x7f1b75f4b138)
23:37:11.894         sip_endpoint.c  .Module "mod-msg-print" registered
23:37:11.894        sip_transport.c  .Transport manager created.
23:37:11.894           pjsua_core.c  .PJSUA state changed: NULL --> CREATED
| 23:37:11.902946 [ ] Supported audio codecs: speex/16000/1, speex/8000/1, speex/32000/1, iLBC/8000/1, GSM/8000/1, PCMU/8000/1, PCMA/8000/1, G722/16000/1, opus/48000/2, L16/44100/2, L16/44100/1

I think i created the automations on v3.5, and it worked fine ( running ha-sip-next v3.9 now )

If I disable the "stop_playback" command, they stay bridged, but the mp3 with the ringing sound plays to the end (1 minute long)

Is there maybe a command I can use to roll back to version 3.5 ?

edit: I found backups, tried with restoring 3.5 and 3.6, but the same happends , ha-sip just restarts with no error :/

catohagen commented 1 week ago

nevermind.. as a workaround, when the calls get bridged it works to issue command: play_audio_file with a 0.2 second blank audio file to the caller, to "stop" the audio. Everything is working excellent now..