BelledonneCommunications / linphone-iphone

Linphone is a free VoIP and video softphone based on the SIP protocol. Mirror of linphone-iphone (git://git.linphone.org/linphone-iphone.git)

Home Page:http://linphone.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

iOS 5.2 client doesn't respond properly to 401 from flexisip

petervnv opened this issue · comments

Hi everyone,

Happy New Year!

I am trying to get the latest version (Release/5.2) to work with flexisip and after spending some time trying to figure out what's wrong I noticed what seems to be a bug with the iOS version. Note that I have also compiled the android client Release/5.2 and this one works fine as expected. The problem I see only happens with the iPhone client.

Basically I noticed that when trying to login to flexisip the iOS client receives a 401 (as expected) with the challenge for the SHA256 hashed password from flexisip but then it doesn't reply as expected to successfully login.

Looking through the iOS logs in Xcode simulator I see the problem. At the end of the logs linphone seems to not be able to authenticate properly after receiving the 401. When logging in manually (ie through the account wizard) I have to ignore the error that pops up and reenter the password manually, but this is a dirty hack which doesn't address the problem.

Any ideas on how to fix this properly so it can authenticate automatically with SHA256?

Thanks,
Peter

[Message] [LIME] Try to create lime user for device sip:1000@my.domain.com;gr=urn:uuid:7e78cdd3-455b-0006-ba84-68493b76a501 with server URL [https://keys.my.domain.com/lime-server.php]
[Message] Create Lime user sip:1000@my.domain.com;gr=urn:uuid:7e78cdd3-455b-0006-ba84-68493b76a501
[Message] Build outgoing X3DH message:
[Message] 	    Protocol Version is 0x01
[Message] 	    Message Type is registerUser (0x09)
[Message] 	    CurveId is 0x01
[Message] Outgoing X3DH registerUser message holds:
[Message] 	    Ik:c8, 42, 8d, 1e, eb, 42, 32, 22, 79, 50, a3, ae, cb, 3b, 4b, 72, f5, fd, b1, 8e, 12, 9a
bla bla bla

Post outgoing X3DH message from user sip:1000@my.domain.com;gr=urn:uuid:7e78cdd3-455b-0006-ba84-68493b76a501
[Message] belle_sip_channel_init(); peer_cname=(null)
[Message] Background task belle-sip send channel started. Unknown remaining time since application is not fully in background.
[Message] channel [0x1270e0000]: starting send background task with id=[5].
[Message] channel [0x1270e0000]: starting resolution of keys.my.domain.com
[Message] channel[0x1270e0000]: entering state RES_IN_PROGRESS
[Message] LinphoneAccount[0x127336a28] created with params
[Message] LinphoneAccount[0x127336a28] created with proxy config
[Message] LinphoneAccount[0x127158898] created with params
[Message] LinphoneAccount[0x127158898] created with proxy config
[Message] LinphoneAccount[0x127158898] destroyed
[Message] LinphoneAccount[0x11f0be368] created with params
[Message] LinphoneAccount[0x11f0be368] created with proxy config

[Message] Channel [0x1270e0000]: SSL handshake in progress...
[Message] Channel [0x1270e0000]: SSL handshake finished, SSL version is [TLSv1.2], selected ciphersuite is [TLS-ECDHE-ECDSA-WITH-CHACHA20-POLY1305-SHA256]
[Message] Channel has local address 192.168.50.205:64402
[Message] channel[0x1270e0000]: entering state READY
[Message] channel [0x1270e0000]: found binary data in buffer, will stop logging it now.
[Message] channel [0x1270e0000]: message sent to [TLS://keys.my.domain.com:443], size: [3996] bytes
[Message] 	POST /lime-server.php HTTP/1.1
[Message] 	User-Agent: Linphone/5.3.5 (Lime) Belle-sip/5.3.0
[Message] 	Content-Type: x3dh/octet-stream
[Message] 	From: sip:1000@my.domain.com;gr=urn:uuid:7e78cdd3-455b-0006-ba84-68493b76a501
[Message] 	Host: keys.my.domain.com
[Message] 	Content-Length: 3737
[Message] 	\^A	\^A»Bç\^^ÎB2"yP£ÆÀ;Krı˝±é\^Rö*£1èós\^H¡'¯Ω˚	Õfl¢c—eØHˇ˙•ì}\^Z\^QX£oä¡πb:5á\^H\^N)±B!ó'<RçM\^\üèî°b†gt\^^àQ`'Y]æıʪ›·‡˘/ä"M\^]åå±\^VûølÌ÷káé\^R\^\£Öh¸øfløë∏7... (first 389 bytes shown)
[Message] channel [0x1270e0000]: ending send background task with id=[5].
[Message] Background task belle-sip recv channel started. Unknown remaining time since application is not fully in background.
[Message] channel [0x1270e0000]: starting recv background task with id=[7].
[Message] channel [0x1270e0000]: received [356] new bytes from [TLS://keys.my.domain.com:443]:
[Message] 	HTTP/1.1 401 Unauthorized
[Message] 	Date: Wed, 03 Jan 2024 16:41:16 GMT
[Message] 	Server: Apache/2.4.57 (Debian)
[Message] 	WWW-Authenticate: Digest realm="my.domain.com",qop="auth",algorithm=SHA-256,nonce="eff97e06a94c5d9c45891bff68a2b1c6228989cf3166d5e78c6b8553d4604c67",opaque="b2a4db67f46fa9bbcc3111f6767b67ba"
[Message] 	Content-Length: 0
[Message] 	Content-Type: text/html; charset=UTF-8
[Message] channel [0x1270e0000] [356] bytes parsed
[Message] channel [0x1270e0000] read [0] bytes of body from [keys.my.domain.com:443]
**[Error] No auth info found for request [0x6000073b8000], cannot authenticate**
[Warning] [LIME] user sip:1000@my.domain.com;gr=urn:uuid:7e78cdd3-455b-0006-ba84-68493b76a501 creation failed with error [Got a non Ok response from server : 401]