arnonym / ha-plugins

Home-Assistant SIP Gateway
Apache License 2.0
178 stars 23 forks source link

Crashes or core-dumps at 1st call #93

Open unlucio opened 9 months ago

unlucio commented 9 months ago

System Information

version core-2024.1.6
installation_type Home Assistant Supervised
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.11.6
os_name Linux
os_version 5.10.0-21-arm64
arch aarch64
timezone Europe/Rome
config_dir /config
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 4994 Installed Version | 1.34.0 Stage | running Available Repositories | 1391 Downloaded Repositories | 57
Home Assistant Cloud logged_in | false -- | -- can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Home Assistant Supervisor host_os | Debian GNU/Linux 11 (bullseye) -- | -- update_channel | stable supervisor_version | supervisor-2023.12.1 agent_version | 1.4.1 docker_version | 23.0.4 disk_total | 457.4 GB disk_used | 201.4 GB healthy | true supported | failed to load: Unsupported supervisor_api | ok version_api | ok installed_addons | ESPHome (2023.12.9), Mosquitto broker (6.4.0), Piper (1.4.0), Whisper (1.0.2), openWakeWord (1.8.2), Studio Code Server (5.15.0), ha-sip (3.5.1)
Dashboards dashboards | 5 -- | -- resources | 29 views | 27 mode | storage
Recorder oldest_recorder_run | 3 February 2023 at 18:17 -- | -- current_recorder_run | 31 January 2024 at 15:04 estimated_db_size | 9242.86 MiB database_engine | mysql database_version | 10.6.11
Sonoff version | 3.5.4 (a4a8c5f) -- | -- cloud_online | 0 / 8 local_online | 8 / 8 debug | failed to load:
Spotify api_endpoint_reachable | ok -- | --
homepi ~ # uname -a
Linux homepi 5.10.0-21-arm64 #1 SMP Debian 5.10.162-1 (2023-01-21) aarch64 GNU/Linux
ha-sip (3.5.1)

Crash

From the logs, it seems to connect fine to my fritzbox's sip thing, but asap I try to make the 1st example call:

service: hassio.addon_stdin
data:
  addon: c7744bff_ha-sip
  input:
    command: dial
    number: sip:+334446666666@10.6.9.1‬
    ring_timeout: 15
    sip_account: 1
    menu:
      message: There's a burglar in da house.

the whole sip's container crashes. Mostly with the following error:

22:07:33.719               call.cpp  pjsua_call_make_call(acc.getId(), &pj_dst_uri, param.p_opt, this, param.p_msg_data, &id) error: Invalid Request URI (PJSIP_EINVALIDREQURI) (status=171042) [../src/pjsua2/call.cpp:706]
Traceback (most recent call last):
  File "/ha-sip/main.py", line 113, in <module>
    main()
  File "/ha-sip/main.py", line 106, in main
    handle_command_list(command_client, command_handler)
  File "/ha-sip/main.py", line 24, in handle_command_list
    command_handler.handle_command(command, None)
  File "/ha-sip/command_handler.py", line 80, in handle_command
    call.make_call(self.end_point, sip_account, number, menu, self, self.ha_config, ring_timeout, webhook_to_call, webhooks)
  File "/ha-sip/call.py", line 671, in make_call
    new_call.makeCall(uri_to_call, call_param)
  File "/root/.local/lib/python3.11/site-packages/pjsua2-2.14-py3.11-linux-aarch64.egg/pjsua2.py", line 5845, in makeCall
    return _pjsua2.Call_makeCall(self, dst_uri, prm)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pjsua2.Error
22:07:33.802           pjsua_core.c  Shutting down, flags=0...
22:07:33.802           pjsua_core.c  PJSUA state changed: RUNNING --> CLOSING
22:07:33.802           pjsua_call.c  .Hangup all calls..
Whole Log ```shell-session | 22:07:33.704029 [ ] Got "dial" command for sip:+334446666666@10.6.9.1 | &id001 | id: null | message: There's a burglar in da house. | 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 | timeout: 300.0 | post_action: | action: noop | parent_menu: null | | 22:07:33.718525 [1] Registering call with id sip:+334446666666@10.6.9.1 | 22:07:33.718686 [ ] Add to state: sip:+334446666666@10.6.9.1 22:07:33.718 pjsua_call.c Making call with acc #0 to sip:+334446666666@10.6.9.1 22:07:33.718 pjsua_aud.c .Set sound device: capture=-99, playback=-99, mode=0, use_default_settings=0 22:07:33.718 pjsua_aud.c ..Null sound device, mode setting is ignored 22:07:33.718 pjsua_aud.c ..Setting null sound device.. 22:07:33.718 pjsua_aud.c ...Opening null sound device.. 22:07:33.719 pjsua_call.c .Unable to make call: Invalid Request URI (PJSIP_EINVALIDREQURI) [status=171042] 22:07:33.719 pjsua_media.c .Call 0: deinitializing media.. 22:07:33.719 call.cpp pjsua_call_make_call(acc.getId(), &pj_dst_uri, param.p_opt, this, param.p_msg_data, &id) error: Invalid Request URI (PJSIP_EINVALIDREQURI) (status=171042) [../src/pjsua2/call.cpp:706] Traceback (most recent call last): File "/ha-sip/main.py", line 113, in main() File "/ha-sip/main.py", line 106, in main handle_command_list(command_client, command_handler) File "/ha-sip/main.py", line 24, in handle_command_list command_handler.handle_command(command, None) File "/ha-sip/command_handler.py", line 80, in handle_command call.make_call(self.end_point, sip_account, number, menu, self, self.ha_config, ring_timeout, webhook_to_call, webhooks) File "/ha-sip/call.py", line 671, in make_call new_call.makeCall(uri_to_call, call_param) File "/root/.local/lib/python3.11/site-packages/pjsua2-2.14-py3.11-linux-aarch64.egg/pjsua2.py", line 5845, in makeCall return _pjsua2.Call_makeCall(self, dst_uri, prm) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pjsua2.Error 22:07:33.802 pjsua_core.c Shutting down, flags=0... 22:07:33.802 pjsua_core.c PJSUA state changed: RUNNING --> CLOSING 22:07:33.802 pjsua_call.c .Hangup all calls.. 22:07:33.802 pjsua_media.c .Call 0: deinitializing media.. 22:07:33.802 pjsua_media.c .Call 1: deinitializing media.. 22:07:33.802 pjsua_media.c .Call 2: deinitializing media.. 22:07:33.802 pjsua_media.c .Call 3: deinitializing media.. 22:07:33.802 pjsua_pres.c .Shutting down presence.. 22:07:33.802 pjsua_acc.c .Acc 0: setting unregistration.. 22:07:33.802 pjsua_core.c ...TX 398 bytes Request msg REGISTER/cseq=32832 (tdta0xffff91476378) to UDP 10.6.9.1:5060: REGISTER sip:10.6.9.1 SIP/2.0 Via: SIP/2.0/UDP 10.6.9.3:5060;rport;branch=z9hG4bKPjeBF8uzLDU1j7UJfYdWcg19kkyOxtU2nS Max-Forwards: 70 From: ;tag=YC2.GBJ-.SmlNiXWVlicDnLzHS4BCNpF To: Call-ID: RMzV9tQqRCkJfgV0I8hVIaiCNbIimdyq CSeq: 32832 REGISTER Contact: ;+sip.ice Expires: 0 Content-Length: 0 --end msg-- 22:07:33.802 pjsua_acc.c ..Acc 0: Unregistration sent AttributeError: 'Account' object has no attribute 'onRegStarted' 22:07:33.806 pjsua_core.c ..RX 424 bytes Response msg 401/REGISTER/cseq=32832 (rdata0xffff921250c8) from UDP 10.6.9.1:5060: SIP/2.0 401 Unauthorized Via: SIP/2.0/UDP 10.6.9.3:5060;rport=5060;branch=z9hG4bKPjeBF8uzLDU1j7UJfYdWcg19kkyOxtU2nS From: ;tag=YC2.GBJ-.SmlNiXWVlicDnLzHS4BCNpF To: ;tag=0A5B92B2DEE2F15A Call-ID: RMzV9tQqRCkJfgV0I8hVIaiCNbIimdyq CSeq: 32832 REGISTER WWW-Authenticate: Digest realm="fritz.box", nonce="CDC97528A17BA32F" User-Agent: FRITZ!OS Content-Length: 0 --end msg-- 22:07:33.806 sip_auth_client.c ....Digest algorithm is "" 22:07:33.806 pjsua_core.c .....TX 556 bytes Request msg REGISTER/cseq=32833 (tdta0xffff91476378) to UDP 10.6.9.1:5060: REGISTER sip:10.6.9.1 SIP/2.0 Via: SIP/2.0/UDP 10.6.9.3:5060;rport;branch=z9hG4bKPj6TpJHwXH9uzGr0YCGGCAgYaZk8a8VVGc Max-Forwards: 70 From: ;tag=YC2.GBJ-.SmlNiXWVlicDnLzHS4BCNpF To: Call-ID: RMzV9tQqRCkJfgV0I8hVIaiCNbIimdyq CSeq: 32833 REGISTER Contact: ;+sip.ice Expires: 0 Authorization: Digest username="homeassistant", realm="fritz.box", nonce="CDC97528A17BA32F", uri="sip:10.6.9.1", response="13cdb80f3f4e600aa719bfe4cfe591de" Content-Length: 0 --end msg-- 22:07:33.812 pjsua_core.c ..RX 617 bytes Response msg 200/REGISTER/cseq=32833 (rdata0xffff92125028) from UDP 10.6.9.1:5060: AttributeError: 'Account' object has no attribute 'onRegState' SIP/2.0 200 OK Via: SIP/2.0/UDP 10.6.9.3:5060;rport=5060;branch=z9hG4bKPj6TpJHwXH9uzGr0YCGGCAgYaZk8a8VVGc From: ;tag=YC2.GBJ-.SmlNiXWVlicDnLzHS4BCNpF To: ;tag=208C056E871E26D0 Call-ID: RMzV9tQqRCkJfgV0I8hVIaiCNbIimdyq CSeq: 32833 REGISTER User-Agent: AVM FRITZ!Box 7430 146.07.31 (Sep 2 2023) Supported: 100rel,replaces,timer Allow-Events: telephone-event,refer,reg Allow: INVITE,ACK,OPTIONS,CANCEL,BYE,UPDATE,PRACK,INFO,SUBSCRIBE,NOTIFY,REFER,MESSAGE,PUBLISH Accept: application/sdp, multipart/mixed Accept-Encoding: identity Content-Length: 0 --end msg-- 22:07:33.812 pjsua_acc.c .....sip:homeassistant@10.6.9.1: unregistration success 22:07:34.718 pjsua_aud.c .Closing sound device after idle for 1 second(s) 22:07:34.719 pjsua_aud.c ..Closing null sound device.. 22:07:34.809 pjsua_core.c .Destroying... 22:07:34.809 sip_transport.c .Transport udp0xffff91473d20 shutting down, force=0 22:07:34.810 pjsua_media.c .Shutting down media.. 22:07:34.811 sip_transaction.c .Stopping transaction layer module 22:07:34.811 sip_transaction.c .Stopped transaction layer module 22:07:34.811 sip_endpoint.c .Module "mod-unsolicited-mwi" unregistered 22:07:34.811 sip_endpoint.c .Module "mod-pjsua-options" unregistered 22:07:34.811 sip_endpoint.c .Module "mod-pjsua-im" unregistered 22:07:34.811 sip_endpoint.c .Module "mod-pjsua-pres" unregistered 22:07:34.811 sip_endpoint.c .Module "mod-pjsua" unregistered 22:07:34.811 sip_endpoint.c .Module "mod-stateful-util" unregistered 22:07:34.811 sip_endpoint.c .Module "mod-refer" unregistered 22:07:34.811 sip_endpoint.c .Module "mod-mwi" unregistered 22:07:34.811 sip_endpoint.c .Module "mod-presence" unregistered 22:07:34.811 sip_endpoint.c .Module "mod-evsub" unregistered 22:07:34.811 sip_endpoint.c .Module "mod-invite" unregistered 22:07:34.811 sip_endpoint.c .Module "mod-100rel" unregistered 22:07:34.811 sip_endpoint.c .Module "mod-ua" unregistered 22:07:34.812 sip_transaction.c .Transaction layer module destroyed 22:07:34.812 sip_endpoint.c .Module "mod-tsx-layer" unregistered 22:07:34.812 sip_endpoint.c .Module "mod-msg-print" unregistered 22:07:34.812 sip_endpoint.c .Module "mod-pjsua-log" unregistered 22:07:34.813 udp0xffff91473d20 .SIP UDP transport destroyed 22:07:34.813 timer.c .Dumping timer heap: 22:07:34.813 timer.c . Cur size: 0 entries, max: 3070 22:07:34.813 sip_endpoint.c .Endpoint 0xffff91330df8 destroyed 22:07:34.813 pjsua_core.c .PJSUA state changed: CLOSING --> NULL 22:07:34.813 pjsua_core.c .PJSUA destroyed... 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 ```
catohagen commented 9 months ago

I would look into this error...

error: Invalid Request URI (PJSIP_EINVALIDREQURI) (status=171042)

also, maybe try adding a port number to the call :

number: sip:+334446666666@10.6.9.1‬:5060 or what port number used...

unlucio commented 9 months ago

Yeah I noticed that error and I tried pretty much all the permutation that came to my mind, I just didn't think about adding the port as it's already set in the config file 😆

Anyway, it was a good suggestion but adding the port doesn't seem to help as the sip crashes with the same error :/