BelledonneCommunications / linphone-sdk

Mirror for linphone-sdk (https://gitlab.linphone.org/BC/public/linphone-sdk.git)
GNU Affero General Public License v3.0
105 stars 81 forks source link

[Bug]:Dual card dual standby mobile phone, mobile traffic switch between. Occasionally, no invite message is sent after the network switchover, resulting in abnormal call termination. #358

Closed jysssssssssssssss closed 10 months ago

jysssssssssssssss commented 10 months ago

Context

use sdk linphone-sdk-android-5.2.110.aar,Dual card dual standby mobile phone, mobile traffic switch between. Occasionally, no invite message is sent after the network switchover, resulting in abnormal call termination.

General information

Expected behaviour

Dual card dual standby mobile phone, mobile traffic switch between, the call can continue, will not hang up abnormally

To Reproduce

Switch mobile traffic multiple times after starting a call. no send "invite" sip message,the call is finied for a moment.

Additional context

Add any other context about the problem here. log.txt

SDK logs URL

https://github.com/BelledonneCommunications/linphone-sdk/files/13554736/log.txt

Viish commented 10 months ago

Hi @jysssssssssssssss,

Please attach full debug logs from SDK.

Cheers,

jysssssssssssssss commented 10 months ago

fulllog.txt Thanks. Here is the full logs

Viish commented 10 months ago

Thanks @jysssssssssssssss.

@AndreaGianarda can you take a look at it please? In the logs at 2023-12-05 18:00:44.243 network is reachable again but no RE-INVITE is sent.

jysssssssssssssss commented 10 months ago

Thanks. @Viish That's the bug. how to sent RE-INVITE at this time again,has any method to config?

jysssssssssssssss commented 10 months ago

I changed my code in this morning. before invite, called setCapabilityNegotiationReinviteEnabled(true), setCapabilityNegotiationsEnabled(true) in CallParams, when receive 'onNetworkReachable' callback, call 'update' method in current call try to send re-invite, but not work.

AndreaGianarda commented 10 months ago

Hi,

Linphone behaves correctly by trying to send the reINVITE: 2023-12-05 18:00:43.245 9941-9941 liblinphone com.linkcircle.zt.demo I [ (LcPhoneManager.java:696)#onLogMessageWritten ] MediaSession [0xb4000078b7b5e878] is going to be updated (reINVITE) in order to recover from lost connectivity 2023-12-05 18:00:43.247 9941-9941 liblinphone com.linkcircle.zt.demo I [ (LcPhoneManager.java:696)#onLogMessageWritten ] Media local-ip for streams advertised in SDP: 127.0.0.1 2023-12-05 18:00:43.247 9941-9941 liblinphone com.linkcircle.zt.demo I [ (LcPhoneManager.java:696)#onLogMessageWritten ] CallSession [0xb4000078b7b5e878] moving from state LinphoneCallStreamsRunning to LinphoneCallUpdating 2023-12-05 18:00:43.248 9941-9941 LcPhoneManager com.linkcircle.zt.demo I [ (LcPhoneManager.java:724)#onCallStateChanged ] Call state changed [Updating], call dir [Outgoing], call errorInfo reason [SessionIntervalTooSmall], message [Updating call] 2023-12-05 18:00:43.248 9941-9941 liblinphone com.linkcircle.zt.demo I [ (LcPhoneManager.java:696)#onLogMessageWritten ] Linphone core [0xb4000078b7d6d900] notified [call_state_changed] 2023-12-05 18:00:43.249 9941-9941 liblinphone com.linkcircle.zt.demo I [ (LcPhoneManager.java:696)#onLogMessageWritten ] Media local ip to reach default route is :127.0.0.1 2023-12-05 18:00:43.249 9941-9941 liblinphone com.linkcircle.zt.demo W [ (LcPhoneManager.java:695)#onLogMessageWritten ] [LIME] No contactAddress available, unable to setup identity key for ZRTP auxiliary shared secret 2023-12-05 18:00:43.250 9941-9941 liblinphone com.linkcircle.zt.demo I [ (LcPhoneManager.java:696)#onLogMessageWritten ] Local stream description has changed: CODEC_CHANGED NETWORK_CHANGED 2023-12-05 18:00:43.253 9941-9941 belle-sip com.linkcircle.zt.demo I [ (LcPhoneManager.java:696)#onLogMessageWritten ] bellesip_wake_lock_acquire(): Android wake lock [belle-sip transaction(0xb4000078c727b9e0)] acquired [ref=0x2406] 2023-12-05 18:00:43.255 9941-22358 ortp com.linkcircle.zt.demo E [ (LcPhoneManager.java:694)#onLogMessageWritten ] RtpSession [0xb4000079fb4e2c00] error sending [rtp] packet [0xb4000078c7296c00] to [::ffff:122.195.227.194]:50454: Network is unreachable [101] 2023-12-05 18:00:43.255 9941-9941 belle-sip com.linkcircle.zt.demo I [ (LcPhoneManager.java:696)#onLogMessageWritten ] bellesip_wake_lock_acquire(): cast long of wakelock 9222 2023-12-05 18:00:43.255 9941-9941 belle-sip com.linkcircle.zt.demo I [ (LcPhoneManager.java:696)#onLogMessageWritten ] transaction [0xb4000078c727b9e0]: starting transaction background task with id=[2406]. 2023-12-05 18:00:43.256 9941-9941 belle-sip com.linkcircle.zt.demo I [ (LcPhoneManager.java:696)#onLogMessageWritten ] Dialog [0xb4000079231f3e00]: now updated by transaction [0xb4000078c727b9e0]. 2023-12-05 18:00:43.256 9941-9941 belle-sip com.linkcircle.zt.demo I [ (LcPhoneManager.java:696)#onLogMessageWritten ] Transaction [0xb4000078b7ba4000] deleted 2023-12-05 18:00:43.256 9941-9941 belle-sip com.linkcircle.zt.demo I [ (LcPhoneManager.java:696)#onLogMessageWritten ] belle_sip_channel_init(); peer_cname=(null) 2023-12-05 18:00:43.256 9941-9941 belle-sip com.linkcircle.zt.demo I [ (LcPhoneManager.java:696)#onLogMessageWritten ] belle_sip_client_transaction_send_request(): waiting channel to be ready 2023-12-05 18:00:43.258 9941-9941 belle-sip com.linkcircle.zt.demo I [ (LcPhoneManager.java:696)#onLogMessageWritten ] bellesip_wake_lock_acquire(): Android wake lock [belle-sip send channel] acquired [ref=0x18a2] 2023-12-05 18:00:43.258 9941-9941 belle-sip com.linkcircle.zt.demo I [ (LcPhoneManager.java:696)#onLogMessageWritten ] bellesip_wake_lock_acquire(): cast long of wakelock 6306 2023-12-05 18:00:43.259 9941-9941 belle-sip com.linkcircle.zt.demo I [ (LcPhoneManager.java:696)#onLogMessageWritten ] channel [0xb4000078b724d440]: starting send background task with id=[18a2]. 2023-12-05 18:00:43.259 9941-9941 belle-sip com.linkcircle.zt.demo I [ (LcPhoneManager.java:696)#onLogMessageWritten ] channel [0xb4000078b724d440]: starting resolution of 122.195.227.194 2023-12-05 18:00:43.259 9941-9941 belle-sip com.linkcircle.zt.demo I [ (LcPhoneManager.java:696)#onLogMessageWritten ] channel[0xb4000078b724d440]: entering state RES_IN_PROGRESS 2023-12-05 18:00:43.259 9941-9941 belle-sip com.linkcircle.zt.demo I [ (LcPhoneManager.java:696)#onLogMessageWritten ] transaction [0xb4000078c727b9e0] channel state changed to [RES_IN_PROGRESS] 2023-12-05 18:00:43.260 9941-9941 belle-sip com.linkcircle.zt.demo I [ (LcPhoneManager.java:696)#onLogMessageWritten ] channel[0xb4000078b724d440]: entering state RES_DONE 2023-12-05 18:00:43.260 9941-9941 belle-sip com.linkcircle.zt.demo I [ (LcPhoneManager.java:696)#onLogMessageWritten ] transaction [0xb4000078c727b9e0] channel state changed to [RES_DONE] 2023-12-05 18:00:43.260 9941-9941 belle-sip com.linkcircle.zt.demo I [ (LcPhoneManager.java:696)#onLogMessageWritten ] channel[0xb4000078b724d440]: entering state CONNECTING 2023-12-05 18:00:43.260 9941-9941 belle-sip com.linkcircle.zt.demo I [ (LcPhoneManager.java:696)#onLogMessageWritten ] transaction [0xb4000078c727b9e0] channel state changed to [CONNECTING] 2023-12-05 18:00:43.260 9941-9941 belle-sip com.linkcircle.zt.demo I [ (LcPhoneManager.java:696)#onLogMessageWritten ] Trying to connect to [UDP://::ffff:122.195.227.194:2046] 2023-12-05 18:00:43.261 9941-9941 belle-sip com.linkcircle.zt.demo E [ (LcPhoneManager.java:694)#onLogMessageWritten ] belle_sip_get_src_addr_for: bctbx_connect() failed: Network is unreachable 2023-12-05 18:00:43.261 9941-9941 belle-sip com.linkcircle.zt.demo E [ (LcPhoneManager.java:694)#onLogMessageWritten ] Cannot connect to [UDP://122.195.227.194:2046] 2023-12-05 18:00:43.261 9941-9941 belle-sip com.linkcircle.zt.demo I [ (LcPhoneManager.java:696)#onLogMessageWritten ] channel[0xb4000078b724d440]: entering state ERROR

Unfortunately it cannot reach the IPv4 IP address 122.195.227.194. Try to use domain names instead of IP addresses. In fact once a SIP session is established, we must use the same channel therefore if Linphone cannot establish the connection with your IPv4 IP address, the session will be terminated by the RTP timeout (by default is 30s).

The advantage of using a domain name is that your DNS can resolve it as an IPv6 or IPv4 address and Linphone will try to use either of those.

Hope this helps,

Andrea

jysssssssssssssss commented 10 months ago

belle_sip_get_src_addr_for: bctbx_connect() failed: Network is unreachable
2023-12-05 18:00:43.261 9941-9941 belle-sip com.linkcircle.zt.demo E [ (LcPhoneManager.java:694)#onLogMessageWritten ] Cannot connect to [UDP://122.195.227.194:2046]
2023-12-05 18:00:43.261 9941-9941 belle-sip com.linkcircle.zt.demo I [ (LcPhoneManager.java:696)#onLogMessageWritten ] channel[0xb4000078b724d440]: entering state ERROR
Cannot reach the IPv4 IP address 122.195.227.194. Because Network is unreachable.
2023-12-05 18:00:43.261 9941-9941 LcPhoneManager com.linkcircle.zt.demo I [ (LcPhoneManager.java:817)#onNetworkReachable ] onNetworkReachable [true]
When network is reachable, not send re-invite again.This is the problem.
And I try to called setCapabilityNegotiationReinviteEnabled(true), setCapabilityNegotiationsEnabled(true) in CallParams before invite, when receive 'onNetworkReachable' callback, called 'update' method in current call try to send re-invite, but not work.