BelledonneCommunications / linphone-desktop

Linphone is a free VoIP and video softphone based on the SIP protocol. Mirror of git://git.linphone.org/linphone-desktop.git
https://linphone.org/
GNU General Public License v3.0
391 stars 200 forks source link

[Bug]: SIP/2.0 400 Bad Request #789

Open satirebird opened 9 months ago

satirebird commented 9 months ago

Context

If linphone tries to register my SIP account (telekom) it receives a 400 Bad Request from the server. I captured it with wireshark. My other provider sipgate works well.

Request:

REGISTER sip:tel.t-online.de SIP/2.0
Via: SIP/2.0/UDP 192.168.3.78:5060;branch=z9hG4bK.ROY3k-PgO;rport
From: <sip:000000000000@tel.t-online.de>;tag=ja~vy-zRe
To: sip:000000000000@tel.t-online.de
CSeq: 41 REGISTER
Call-ID: utZ42PoDVN
Max-Forwards: 70
Supported: replaces, outbound, gruu, record-aware
Accept: application/sdp
Accept: text/plain
Accept: application/vnd.gsma.rcs-ft-http+xml
Contact: <sip:000000000000@192.168.3.78;transport=udp>;message-expires=604800;+sip.instance="<urn:uuid:33dd8428-32bf-00c9-8a18-b0e619e40bb7>";+org.linphone.specs="ephemeral/1.1,groupchat/1.2,lime"
Expires: 600
User-Agent: Linphone-Desktop/5.1.2 (alfred) ubuntu/20.04 Qt/5.15.2 LinphoneSDK/5.2.97

Answer:

SIP/2.0 400 Bad Request
Via: SIP/2.0/UDP 192.168.3.78:5060;branch=z9hG4bK.ROY3k-PgO;rport
From: <sip:000000000000@tel.t-online.de>;tag=ja~vy-zRe
To: sip:000000000000@tel.t-online.de;tag=SipLib_02A51670BA30-7bc5-0-a1a1cf-650c27a9-3fd90
Call-ID: utZ42PoDVN
CSeq: 41 REGISTER
Content-Length: 0

Whats going wrong here?

General information

Expected behaviour

Successful registration

To Reproduce

  1. Configure a SIP account

Additional context

No response

SDK logs URL

No response

codiflow commented 7 months ago

I got the same problem with Linphone and the German "Telekom" as VoIP provider. Seems like this has to do with the name resolution of tel.t-online.de as stated here: https://support.securepoint.de/viewtopic.php?t=9843

They do not resolve A records for their domain since I think 2021 so you have to do SRV-requests to get the IP of the server.

Seems like the issue arrised since September in different variants (German pages): https://www.ip-phone-forum.de/threads/fritz-7490-fon-c5-kann-die-nummer-0800-000-8382-nicht-w%C3%A4hlen.316212/

I will report back as soon as I found a solution for this.

codiflow commented 7 months ago

The solution was to completely remove the accounts from Linphone and add them through the assistant instead of through the settings dialog.

grafik

Linphone itself can resolve the SRV entries from DNS just fine. In case of problems just look at the log files within Linphone – they should help you.

codiflow commented 7 months ago

I wrote a step-by-step tutorial (only in German) for the process of using Telekom SIP accounts with Linphone today: https://andersgood.de/kurz-notiert/voip-telefonie-der-telekom-mit-linphone-nutzen

satirebird commented 7 months ago

This doesn't help. I got a "Bad request" answer from the TCOM server. I guess it has to do with the selected server. There are several choices in the SRV record. Depending on that choice the server doesn't accept the SIP register message. The request is malformed in some way.

The SRV recorrd from my connection looks like this, which is similar you listed in your instruction.

;; ANSWER SECTION:
_sip._udp.tel.t-online.de.  3276    IN  SRV 30 0 5060 hno002-l01-mav-pc-rt-001.edns.t-ipnet.de.
_sip._udp.tel.t-online.de.  3276    IN  SRV 10 0 5060 stg010-l01-mav-pc-rt-001.edns.t-ipnet.de.
_sip._udp.tel.t-online.de.  3276    IN  SRV 20 0 5060 nes008-f01-mav-pc-rt-001.edns.t-ipnet.de.

Linphone always uses 217.0.146.197 which is the stg010... server in my case. Can you record the SIP register message with wireshark from you computer?

codiflow commented 7 months ago

Does this already help you? It's the log of the complete registration process with all REGISTER messages: https://andersgood.de/kurz-notiert/voip-telefonie-der-telekom-mit-linphone-nutzen#vollstaendiger-authentifizierungsprozess

satirebird commented 6 months ago

I had some time to create a small python script that sends the initial SIP register message to the telekom server. I figured out that the following parameter makes the difference:

+org.linphone.specs="ephemeral/1.1,groupchat/1.2,lime"

It is the last part of the Contact parameter. If I change it to

+org.linphone.specs="lime"

the server accepts it. In your log only the "lime" spec is listed.

Currently I'm not sure which linphone settings affects this thing. Do you have an idea?

codiflow commented 6 months ago

Unfortunately no.

I also don't have the respective client with the Telekom server configured at hand so I unfortunately can't check your investigation results against my config.

petervnv commented 6 months ago

I had some time to create a small python script that sends the initial SIP register message to the telekom server. I figured out that the following parameter makes the difference:

+org.linphone.specs="ephemeral/1.1,groupchat/1.2,lime"

It is the last part of the Contact parameter. If I change it to

+org.linphone.specs="lime"

the server accepts it. In your log only the "lime" spec is listed.

Currently I'm not sure which linphone settings affects this thing. Do you have an idea?

You can set the linphone_specs parameters in linphonerc

[sip] linphone_specs=groupchat,lime

Don't know if it works with the desktop client. It doesn't seem to work with the iOS client as reported here

Hope this helps

satirebird commented 6 months ago

I had some time to create a small python script that sends the initial SIP register message to the telekom server. I figured out that the following parameter makes the difference:

+org.linphone.specs="ephemeral/1.1,groupchat/1.2,lime"

It is the last part of the Contact parameter. If I change it to

+org.linphone.specs="lime"

the server accepts it. In your log only the "lime" spec is listed. Currently I'm not sure which linphone settings affects this thing. Do you have an idea?

You can set the linphone_specs parameters in linphonerc

[sip] linphone_specs=groupchat,lime

Don't know if it works with the desktop client. It doesn't seem to work with the iOS client as reported here

Hope this helps

You are right. It's listed with the groupchat and ephemeral enabled in the linphone_specs. But even if I change or remove it, linphone re-writes the original content. Does anyone how to disable it?

codiflow commented 6 months ago

As far as I remember Linphone has some kind of backup/integrity check mechanism regarding manual config changes.

You have to keep Linphone closed completely (not sent to tray) before you can edit the config.

Also look for a config "backup" file in the config directory and also update this.