arnonym / ha-plugins

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

Deutsche Telekom, SIP registration failed #30

Closed Muehli-dev closed 1 year ago

Muehli-dev commented 1 year ago

Hi Arne,

I've tried to use your addon with my Deutsche Telekom Account. Unfortunately I cannot get it to register properly:

11:27:49.452 sip_resolve.c ...Failed to resolve 'tel.t-online.de': gethostbyname() has returned error (PJ_ERESOLVE) 11:27:49.452 tsx0x16bbb88 ...Failed to send Request msg REGISTER/cseq=51565 (tdta0x16b9bc8)! err=70018 (gethostbyname() has returned error (PJ_ERESOLVE)) 11:27:49.452 pjsua_acc.c .....SIP registration failed, status=502 (gethostbyname() has returned error (PJ_ERESOLVE)) 11:27:49.453 pjsua_acc.c .....Scheduling re-registration retry for acc 0 in 9 seconds.. | OnRegState: 502 gethostbyname() has returned error (PJ_ERESOLVE) 11:27:49.453 sip_reg.c ..Error sending request: gethostbyname() has returned error (PJ_ERESOLVE)

Telekom has disable the DNS-A Record and SIP Clients need to resolve the host with SRV Record.

Any chance you could add this functionality?

arnonym commented 1 year ago

Hi,

from the docs it looks like I need to create a way to specify a nameserver to make pjsip use SRV records.

I'll add that in the next release.

arnonym commented 1 year ago

This is in 2.4 now. Please test if this is working as expected!

Muehli-dev commented 1 year ago

Thanks for the fast response.

There's a new error now:

19:26:13.015 pjsua_acc.c Contact for acc 0 updated: <sip:192.168.10.95:5060;ob>;+sip.ice 19:26:13.015 pjsua_acc.c Acc 0: setting registration.. 19:26:13.015 resolver.c ..Transmitting 43 bytes to NS 0 (217.5.100.185:53): DNS SRV query for _sip._udp.tel.t-online.de: Success 19:26:13.015 resolver.c ..Transmitting 43 bytes to NS 1 (217.5.100.186:53): DNS SRV query for _sip._udp.tel.t-online.de: Success 19:26:13.015 pjsua_acc.c .Acc 0: Registration sent 19:26:13.033 _sip._udp.tel.t-online DNS SRV resolution failed for _sip._udp.tel.t-online.de: DNS "Refused" (PJLIB_UTIL_EDNS_REFUSED) 19:26:13.033 _sip._udp.tel.t-online DNS SRV resolution failed for _sip._udp.tel.t-online.de, trying resolving A/AAAA record for tel.t-online.de 19:26:13.033 resolver.c Transmitting 33 bytes to NS 0 (217.5.100.185:53): DNS A query for tel.t-online.de: Success 19:26:13.052 sip_resolve.c DNS A/AAAA record resolution failed: DNS "Refused" (PJLIB_UTIL_EDNS_REFUSED) 19:26:13.052 tsx0x14a5528 Failed to send Request msg REGISTER/cseq=46674 (tdta0x149dd88)! err=320055 (DNS "Refused" (PJLIB_UTIL_EDNS_REFUSED)) 19:26:13.052 pjsua_acc.c ..SIP registration failed, status=503 (DNS "Refused" (PJLIB_UTIL_EDNS_REFUSED)) 19:26:13.052 pjsua_acc.c ..Scheduling re-registration retry for acc 0 in 299 seconds.. | 19:26:13.052150 [1] OnRegState: 503 DNS "Refused" (PJLIB_UTIL_EDNS_REFUSED)

arnonym commented 1 year ago

Looks like the name server refused to answer that query. Can you try with 1.1.1.1?

arnonym commented 1 year ago

I dug a bit deeper into that topic, and pjsip should actually use a NAPTR query on tel.t-online.de, which it does not support: https://github.com/pjsip/pjproject/issues/3305

I don't understand why the cloudflare DNS server does respond to the SRV query for _sip._udp.tel.t-online.de and the official Telekom server does not.

Maybe this work-around does it for you until pjsip is able to use NAPTR records.

Muehli-dev commented 1 year ago

Hey Arne,

I'm one step further but still can't manage to register my SIP Account:

23:03:30.419 pjsua_core.c .RX 445 bytes Response msg 403/REGISTER/cseq=26967 (rdata0x2ba4988) from UDP 217.0.148.133:5060: SIP/2.0 403 Forbidden Via: SIP/2.0/UDP 93.221.69.206:15060;received=93.221.69.206;rport=15060;branch=z9hG4bKPjtbLDXG8Wz68WGdwbN8ozFnJYe5D1iBOe From: sip:me**********@t-online.de;tag=Z6iT5.az8XmfF5XBQQvnGMCZmXOtvJQ6 To: sip:me**********@t-online.de;tag=0204547C6A3C-14c0-c1451700-11081e-63eea832-630e1 CSeq: 26967 REGISTER Call-ID: BvRm9TWmHPefgJl78PjtO3FYrtk5HJF3 Reason: SIP;cause=403;text="CC_IMS_UNKNOWN_USER" Content-Length: 0 --end msg-- 23:03:30.419 pjsua_acc.c ....SIP registration failed, status=403 (Forbidden) | 23:03:30.420054 [1] OnRegState: 403 Forbidden

i've tried the following config:

enabled: true registrar_uri: sip:tel.t-online.de id_uri: sip:me*@t-online.de realm: tel.t-online.de user_name: "0682**" password: SUPERSECRET answer_mode: listen settle_time: 1 incoming_call_file: ""

Here's a working config from MicroSIP:

grafik

arnonym commented 1 year ago

Did you put the username in quotes? Because otherwise the leading zero will be removed because YAML.

Muehli-dev commented 1 year ago

Yes, i put it in quotes. I've tried all different kind of combinations: Phone Number as Username, PhoneNumber@t-online.de as id_uri. Email as Id_uri etc.

Can't get it to register properly.

Muehli-dev commented 1 year ago

Here are some informations I've found in the Telekom-Forum. Maybe I'm missing something?

https://telekomhilft.telekom.de/t5/Telefonie-Internet/SIP-Phone-einrichten/m-p/937250/highlight/true#M116923

arnonym commented 1 year ago

Can you try this one:

registrar_uri: "sip:tel.t-online.de"
id_uri: "sip:phonenumber@tel.t-online.de"
realm: "*"
user_name: "phonenumber"
password: "web password"
Muehli-dev commented 1 year ago

That did the trick! I never tried @tel.t-online.de. 👍