Skip to content

Cannot establish healthy connection to fritz.box - "connection reset by peer" #161

@chill10n

Description

@chill10n

Dear arnonym,
I've been struggling a while to set up the ha-sip addon, paged through device manuals of my fritzbox 7581 and other vendors of voip or sip devices and a lot of forums that deal with failing outgoing calls with this addon and other sip homeassistant addons. But I really dont made progress. The one diffence in error I saw, when I tried to active tls or changed the port for the sip connecting to.
I start a call, with the new format of hassio.stdin command like this:

service: hassio.addon_stdin
data:
addon: c7744bff_ha-sip
input:
command: dial
number: sip:homeassistant@fritz.box
ring_timeout: 15
sip_account: 1
menu:
message: Theres a burglar

but the connection seems to fail at a very low level (drawn from the very short conneciton time) already:

--end msg--
19:00:48.831 tcpc0x3590e528 TCP transport 192.168.99.105:45361 is connected to 192.168.99.1:5060
19:00:48.834 tcpc0x3590e528 TCP connection closed
19:00:48.834 pjsua_acc.c Disconnected notification for transport tcpc0x3590e528
19:00:48.834 sip_transport.c .Transport tcpc0x3590e528 shutting down, force=0
19:00:48.834 pjsua_media.c ..Call 1: deinitializing media..
19:00:48.834 pjsua_media.c ...
[DISCONNECTED] To: sip:**610@fritz.box >>>>>>>>>>>>>>>>>>>>>>my internal phone nr
Call time: 00h:00m:00s, 1st res in 8 ms, conn in 0ms
19:00:48.834 pjsua_media.c ...Call 1: cleaning up provisional media, prov_med_cnt=1, med_cnt=0
19:00:48.834 icetp00 ...Stopping ICE, reason=media stop requested
19:00:48.834 icetp00 ...Destroying ICE session 0x35414548
19:00:48.834 srtp0x35900040 ...Destroying SRTP transport
19:00:48.834 icetp00 ...Destroying ICE transport
19:00:48.834 ice_session.c ...ICE session 0x35414548 destroyed
19:00:48.834 icetp00 ...ICE stream transport 0x358fde68 destroyed
19:00:48.834 icetp00 ...ICE transport destroyed
19:00:48.834 srtp0x35900040 ...SRTP transport destroyed
| 19:00:48.834512 [1] Call disconnected
| 19:00:48.834585 [ ] Calling webhook sip_call_webhook_id with data {'event': 'call_disconnected', 'caller': 'sip:**610@fritz.box', 'parsed_caller': '**610', 'sip_account': 1, 'call_id': 'Lqv3VE2T3cTjB.rkkWHUlktva1iOFN7v', 'internal_id': 'sip:**610@fritz.box'}
| 19:00:48.841982 [ ] Webhook response 200 b''
| 19:00:48.842233 [ ] Remove from state: sip:**610@fritz.box
19:00:48.842 sip_transport.c Transport tcpc0x3590e528 is being destroyed due to timeout in idle timer

19:00:48.842 tcpc0x3590e528 TCP transport destroyed with reason 120104: Connection reset by peer <<<<<<<<<<<<<<<<< error code differnet with TLS enabled or port changed (then its something like EOF-Error).

19:00:49.842 pjsua_aud.c Closing sound device after idle for 1 second(s)
19:00:49.842 pjsua_aud.c .Closing null sound device..
| 19:01:29.588619 [ ] Got "dial" command for sip:homeassistant@fritz.box
| &id001
| id: null
| message: Theres a burglar
| audio_file: null
| language: de_DE
| 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
| cache_audio: false
| wait_for_audio_to_finish: false
| 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
| cache_audio: false
| wait_for_audio_to_finish: false
| timeout: 300.0
| post_action:
| action: noop
| parent_menu: null
| cache_audio: false
| wait_for_audio_to_finish: false
|
| 19:01:29.591671 [1] Registering call with id sip:homeassistant@fritz.box
| 19:01:29.591716 [ ] Add to state: sip:homeassistant@fritz.box
19:01:29.591 pjsua_call.c Making call with acc #0 to sip:homeassistant@fritz.box
19:01:29.591 pjsua_aud.c .Set sound device: capture=-99, playback=-99, mode=0, use_default_settings=0
19:01:29.591 pjsua_aud.c ..Null sound device, mode setting is ignored
19:01:29.591 pjsua_aud.c ..Setting null sound device..
19:01:29.591 pjsua_aud.c ...Opening null sound device..
19:01:29.592 pjsua_media.c .Call 2: initializing media..
19:01:29.592 icetp00 ..Creating ICE stream transport with 2 component(s)
19:01:29.593 icetp00 ...Comp 1/0: host candidate 192.168.99.105:4027 (tpid=64) added
19:01:29.593 icetp00 ...Comp 1/1: host candidate 192.168.99.114:4027 (tpid=64) added
19:01:29.593 icetp00 ...Comp 1/2: host candidate 172.30.32.1:4027 (tpid=64) added
19:01:29.593 icetp00 ...Comp 1/3: host candidate 172.30.232.1:4027 (tpid=64) added
19:01:29.594 icetp00 ...Comp 2/0: host candidate 192.168.99.105:4018 (tpid=64) added
19:01:29.594 icetp00 ...Comp 2/1: host candidate 192.168.99.114:4018 (tpid=64) added
19:01:29.594 icetp00 ...Comp 2/2: host candidate 172.30.32.1:4018 (tpid=64) added
19:01:29.594 icetp00 ...Comp 2/3: host candidate 172.30.232.1:4018 (tpid=64) added
19:01:29.594 icetp00 ...ICE stream transport 0x353daef8 created
19:01:29.594 pjsua_media.c ..Media index 0 selected for audio call 2
19:01:29.595 srtp0x34ff4fc0 SRTP transport created
19:01:29.595 icetp00 ICE session created, comp_cnt=2, role is Controlling agent
19:01:29.595 icetp00 ICE nomination type set to aggressive
19:01:29.595 icetp00 Candidate 0 added: comp_id=1, type=host, foundation=Hc0a86369, addr=192.168.99.105:4027, base=192.168.99.105:4027, prio=0x7effffff (2130706431)
19:01:29.595 icetp00 Candidate 1 added: comp_id=1, type=host, foundation=Hc0a86372, addr=192.168.99.114:4027, base=192.168.99.114:4027, prio=0x7efffeff (2130706175)
19:01:29.595 icetp00 Candidate 2 added: comp_id=1, type=host, foundation=Hac1e2001, addr=172.30.32.1:4027, base=172.30.32.1:4027, prio=0x7efffdff (2130705919)
19:01:29.595 icetp00 Candidate 3 added: comp_id=1, type=host, foundation=Hac1ee801, addr=172.30.232.1:4027, base=172.30.232.1:4027, prio=0x7efffcff (2130705663)
19:01:29.595 icetp00 Candidate 4 added: comp_id=2, type=host, foundation=Hc0a86369, addr=192.168.99.105:4018, base=192.168.99.105:4018, prio=0x7efffffe (2130706430)
19:01:29.595 icetp00 Candidate 5 added: comp_id=2, type=host, foundation=Hc0a86372, addr=192.168.99.114:4018, base=192.168.99.114:4018, prio=0x7efffefe (2130706174)
19:01:29.595 icetp00 Candidate 6 added: comp_id=2, type=host, foundation=Hac1e2001, addr=172.30.32.1:4018, base=172.30.32.1:4018, prio=0x7efffdfe (2130705918)
19:01:29.595 icetp00 Candidate 7 added: comp_id=2, type=host, foundation=Hac1ee801, addr=172.30.232.1:4018, base=172.30.232.1:4018, prio=0x7efffcfe (2130705662)
19:01:29.595 resolver.c ...Transmitting 37 bytes to NS 0 (192.168.99.1:53): DNS SRV query for _sip._udp.fritz.box: Success
| 19:01:29.596059 [1] Calling
19:01:29.596 _sip._udp.fritz.box DNS SRV resolution failed for _sip._udp.fritz.box: DNS "Name Error" (PJLIB_UTIL_EDNS_NXDOMAIN)
19:01:29.596 _sip._udp.fritz.box DNS SRV resolution failed for _sip._udp.fritz.box, trying resolving A/AAAA record for fritz.box
19:01:29.597 resolver.c Transmitting 27 bytes to NS 0 (192.168.99.1:53): DNS A query for fritz.box: Success
19:01:29.598 tcpc0x35911578 TCP client transport created
19:01:29.598 tcpc0x35911578 TCP transport 192.168.99.105:54175 is connecting to 192.168.99.1:5060...
19:01:29.598 pjsua_core.c TX 1979 bytes Request msg INVITE/cseq=25568 (tdta0x35907f38) to TCP 192.168.99.1:5060:
INVITE sip:homeassistant@fritz.box SIP/2.0
Via: SIP/2.0/TCP 192.168.99.105:54175;rport;branch=z9hG4bKPj-R0dMcNAhzpz4rRV-WDF-Mw3Egph1VdX;alias
Max-Forwards: 70
From: sip:homeassistant@fritz.box;tag=Y9CrAypBvDpea8H0921TWXX2nxVZxxLd
To: sip:homeassistant@fritz.box
Contact: sip:homeassistant@192.168.99.105:5060;ob;+sip.ice
Call-ID: 6.RNIpr9oOc6cPYM3--nMuKOOKX.M-ED
CSeq: 25568 INVITE
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Supported: replaces, 100rel, timer, norefersub
Session-Expires: 1800
Min-SE: 90
Content-Type: application/sdp
Content-Length: 1350
v=0
o=- 3975674489 3975674489 IN IP4 192.168.99.105
s=pjmedia
b=AS:117
t=0 0
a=X-nat:0
m=audio 4027 RTP/AVP 96 97 98 99 3 0 8 9 100 120 121 122 123
c=IN IP4 192.168.99.105
b=TIAS:96000
a=rtcp:4018 IN IP4 192.168.99.105
a=sendrecv
a=rtpmap:96 speex/16000
a=rtpmap:97 speex/8000
a=rtpmap:98 speex/32000
a=rtpmap:99 iLBC/8000
a=fmtp:99 mode=30
a=rtpmap:3 GSM/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:9 G722/8000
a=rtpmap:100 opus/48000/2
a=fmtp:100 useinbandfec=1
a=rtpmap:120 telephone-event/16000
a=fmtp:120 0-16
a=rtpmap:121 telephone-event/8000
a=fmtp:121 0-16
a=rtpmap:122 telephone-event/32000
a=fmtp:122 0-16
a=rtpmap:123 telephone-event/48000
a=fmtp:123 0-16
a=ssrc:445830440 cname:636cc9b769df6901
a=ice-ufrag:4eb31e41
a=ice-pwd:128af49a7ac3d5aa112d1838
a=candidate:Hc0a86369 1 UDP 2130706431 192.168.99.105 4027 typ host
a=candidate:Hc0a86372 1 UDP 2130706175 192.168.99.114 4027 typ host
a=candidate:Hac1e2001 1 UDP 2130705919 172.30.32.1 4027 typ host
a=candidate:Hac1ee801 1 UDP 2130705663 172.30.232.1 4027 typ host
a=candidate:Hc0a86369 2 UDP 2130706430 192.168.99.105 4018 typ host
a=candidate:Hc0a86372 2 UDP 2130706174 192.168.99.114 4018 typ host
a=candidate:Hac1e2001 2 UDP 2130705918 172.30.32.1 4018 typ host
a=candidate:Hac1ee801 2 UDP 2130705662 172.30.232.1 4018 typ host
--end msg--

I read that the fritzbox might lock the port 5060 down to its own services and that for other VOIP or SIP vendors there may be other ports opened, but that was just a single threat about this topic and it seems the port is at least responding in an halfway acceptible way.

Here is my yaml config:

sip_global:
port: 5060
log_level: 5
name_server: 192.168.99.1
cache_dir: /config/audio_cache
global_options: ""
sip:
enabled: true
registrar_uri: sip:fritz.box
id_uri: sip:homeassistant@fritz.box
realm: ""
user_name: homeassistant
password: veryniceguysreadnosecrets
answer_mode: listen
settle_time: 1
incoming_call_file: ""
options: ""
sip_2:
enabled: false
registrar_uri: sip:fritz.box
id_uri: sip:anotheruser@fritz.box
realm: "
"
user_name: anotheruser
password: secret
answer_mode: listen
settle_time: 1
incoming_call_file: ""
options: ""
sip_3:
enabled: false
registrar_uri: sip:192.168.178.10
id_uri: ""
realm: "*"
user_name: ""
password: ""
answer_mode: listen
settle_time: 1
incoming_call_file: ""
options: ""
tts:
engine_id: tts.piper
platform: ""
language: de_DE
voice: ""
debug_print: true
webhook:
id: sip_call_webhook_id

I hope you might help me out if that is a problem of my config, call routine, the fritz box model or well the addon itself. Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions