BelledonneCommunications / linphone-android

Linphone.org mirror for linphone-android (https://gitlab.linphone.org/BC/public/linphone-android)
https://linphone.org
GNU General Public License v3.0
1.13k stars 692 forks source link

Unable to remove account from core #2130

Closed ParticleCore closed 6 months ago

ParticleCore commented 7 months ago

Hi there, this is related to what I discussed in #2129 but since it was different than the original question I thought it would be better off as a new issue.

  1. Describe the bug (mandatory)

It is not currently possible to remove an account from core, tried using the following to no avail:

When I run a new core instance the core.defaultAccount still returns the old account and core.accountList still has the account that was suppose to be removed.

  1. To Reproduce (mandatory)

The following is executed when the user logs out of the app:

val core = <current core instance> ?: return
val account = core.defaultAccount ?: return
val authInfo = account.findAuthInfo()
val params = account.params
val clonedParams = params.clone().apply {
    isRegisterEnabled = false
}

if (authInfo != null) {
    core.removeAuthInfo(authInfo)
}

account.params = clonedParams

core.removeAccount(account)
core.accountList.firstOrNull()?.let {
    val authInfo = account.findAuthInfo()
    val params = account.params
    val clonedParams = params.clone().apply {
        isRegisterEnabled = false
    }
    if (authInfo != null) {
        core.removeAuthInfo(authInfo)
    }
    core.removeAccount(it)
}
core.clearAccounts()
core.clearAllAuthInfo()
core.defaultAccount = null
core.removeListener(coreListener)
core.stop()

And on login the following is run:

val factory = Factory.instance()
val coreConfig = factory.createConfigWithFactory(
    "${context.filesDir.absolutePath}/.linphonerc",
    null,
)
val core = factory.createCoreWithConfig(coreConfig, context)

log.d("Core account list: ${core.accountList.size}") <--- this always has 1 account after the first time
log.d("Core default account: ${core.defaultAccount}") <--- this is never null after the first time

val authInfo = factory.createAuthInfo(username, null, password, null, null, domain, null)
val identity = factory.createAddress("sip:$username@$domain")
val address = factory.createAddress("sip:$domain")?.apply {
    transport = transportType
}
val params = core.createAccountParams().apply {
    identityAddress = identity
    serverAddress = address
    isRegisterEnabled = true
    remotePushNotificationAllowed = true
}

core.addListener(coreListener)

val oldAccount = core.accountList.firstOrNull()

if (oldAccount == null) {
    val account = core.createAccount(params)
    core.addAccount(account)
    core.addAuthInfo(authInfo)
    core.defaultAccount = account
    core.start()
}
  1. Expected behavior (mandatory)

Whenever an account is removed or clearAccounts is called no accounts should be left in the defaultAccount nor accountList in subsequent core instance uses.

  1. Please complete the following information (mandatory)

    • Device: Multiple Pixel devices, and emulators
    • OS: Android OS varies between 10 and 13
    • Version of the App: Not applicable
    • Version of the SDK: 5.3.19 and 5.3.37
    • Where you did got it from: Not applicable
    • Please tell us if your Android is a Lineage OS or another variant: Vanilla Android
  2. SDK logs (mandatory)


These logs represent when the user logs out, and the account is suppose to be removed

2024-03-27 10:36:23.555 [Activity Monitor] Activity paused:com.app.Main@724cfaf
2024-03-27 10:36:23.555 [Activity Monitor] runningActivities=0
2024-03-27 10:36:23.706 [Activity Monitor] Activity created:com.app.Login@ecb1029
2024-03-27 10:36:23.751 Activity started:com.app.Login@ecb1029
2024-03-27 10:36:23.755 [Activity Monitor] Activity resumed:com.app.Login@ecb1029
2024-03-27 10:36:23.755 [Activity Monitor] runningActivities=1
2024-03-27 10:36:23.900 linphoneAccountIsServerConfigChanged : 1
2024-03-27 10:36:23.900 Publish params have not changed on account [0xb4000078273bfed8]
2024-03-27 10:36:23.900 Linphone core [0xb4000076a749bef0] notified [default_account_changed]
2024-03-27 10:36:23.900 Linphone core [0xb4000076a749bef0] notified [account_removed]
2024-03-27 10:36:23.900 linphoneAccountIsServerConfigChanged : 1
2024-03-27 10:36:23.900 Publish params have not changed on account [0xb4000078273bfed8]
2024-03-27 10:36:23.900 This account is already the default one, skipping.
2024-03-27 10:36:23.901 Callbacks [0xb4000077d73f58b0] unregistered on core [0xb4000076a749bef0]
2024-03-27 10:36:23.901 Closing friend list [0xb4000078175a1fd0] subscriptions
2024-03-27 10:36:23.901 Switching LinphoneCore [0xb4000076a749bef0] from state LinphoneGlobalReady to LinphoneGlobalShutdown
2024-03-27 10:36:23.901 context is null.
2024-03-27 10:36:23.901 [Core Manager] Core stopped
2024-03-27 10:36:23.901 Failed to find the native listener matching jobject [0x0]
2024-03-27 10:36:23.901 [Core Manager] Stopping scheduling of core.iterate() every 20 ms
2024-03-27 10:36:23.901 [Core Manager] core.iterate() scheduler stopped
2024-03-27 10:36:23.902 [Platform Helper] onLinphoneCoreStop, network monitoring is false
2024-03-27 10:36:23.902 [Platform Helper] Preview window surface set to null
2024-03-27 10:36:23.902 [Platform Helper] Video window surface set to null
2024-03-27 10:36:23.902 [Platform Helper] [Signal Strength Monitor] Destroying
2024-03-27 10:36:23.902 Destroying friends.
2024-03-27 10:36:23.902 Destroying friends done.
2024-03-27 10:36:23.902 Reseting transports
2024-03-27 10:36:23.902 Sal::unlistenPorts(): done
2024-03-27 10:36:23.902 http provider destroyed.
2024-03-27 10:36:23.902 stack [0xb4000078174fff30] destroyed.
2024-03-27 10:36:23.903 [Core Manager] Destroying
2024-03-27 10:36:23.903 [Bluetooth] Bluetooth broadcast receiver unregistered
2024-03-27 10:36:23.903 [Bluetooth] Bluetooth helper destroyed
2024-03-27 10:36:23.903 [Core Manager] Unregistering shutdown receiver
2024-03-27 10:36:23.903 [Audio Helper] Destroying
2024-03-27 10:36:23.904 [Audio Helper] CoreManager has been destroyed already!
2024-03-27 10:36:23.904 [Audio Helper] Call audio focus request was already abandonned
2024-03-27 10:36:23.904 [Audio Helper] Destroyed
2024-03-27 10:36:23.904 [Core Manager] Destroyed
2024-03-27 10:36:23.904 [Android Platform Helper] CoreManager has been destroyed.
2024-03-27 10:36:23.904 bellesip_wake_lock_uninit(): uninitialization succeed
2024-03-27 10:36:23.904 [Android Platform Helper] AndroidPlatformHelper has been destroyed.
2024-03-27 10:36:23.904 Switching LinphoneCore [0xb4000076a749bef0] from state LinphoneGlobalShutdown to LinphoneGlobalOff

These logs represent when the user logs in after having logged out, so right after the above

Note: at 10:39:30.489 there are two custom entries representing the two log.d(...) in the snippet examples posted above, and it confirms the accountlist is still not empty, and that a default account is not null.

2024-03-27 10:39:30.417 Using (r/w) config information from /data/user/0/com.app/files/.linphonerc
2024-03-27 10:39:30.418 Initializing LinphoneCore 5.3.37
2024-03-27 10:39:30.418 Sal nat helper [enabled]
2024-03-27 10:39:30.418 [Core Manager] Linphone SDK Android classes will use main thread: [main], id=2
2024-03-27 10:39:30.418 ==== Phone information dump ====
2024-03-27 10:39:30.418 DEVICE=oriole
2024-03-27 10:39:30.418 MODEL=Pixel 6
2024-03-27 10:39:30.418 MANUFACTURER=Google
2024-03-27 10:39:30.418 ANDROID SDK=34
2024-03-27 10:39:30.418 PERFORMANCE CLASS=31
2024-03-27 10:39:30.418 ABIs=arm64-v8a, armeabi-v7a, armeabi
2024-03-27 10:39:30.418 =========================================
2024-03-27 10:39:30.418 ==== Linphone SDK information dump ====
2024-03-27 10:39:30.419 VERSION=5.3.37
2024-03-27 10:39:30.419 BRANCH=tags/5.3.37^0
2024-03-27 10:39:30.419 PLUGINS=libmsaaudio.so, libmsandroidcamera2.so, libmswebrtc.so
2024-03-27 10:39:30.419 PACKAGE=org.linphone.core
2024-03-27 10:39:30.419 BUILD TYPE=release
2024-03-27 10:39:30.419 =========================================
2024-03-27 10:39:30.420 ==== Previous exit reason information dump ====
2024-03-27 10:39:30.420 REASON=User requested
2024-03-27 10:39:30.421 TIMESTAMP=27-03-2024 10:35:22
2024-03-27 10:39:30.421 DESCRIPTION=[FORCE STOP] stop com.app due to from pid 13315
2024-03-27 10:39:30.421 =========================================
2024-03-27 10:39:30.421 ==== Previous exit reason information dump ====
2024-03-27 10:39:30.421 REASON=User requested
2024-03-27 10:39:30.422 TIMESTAMP=27-03-2024 10:14:27
2024-03-27 10:39:30.422 DESCRIPTION=[REMOVE TASK] remove task
2024-03-27 10:39:30.422 =========================================
2024-03-27 10:39:30.422 ==== Previous exit reason information dump ====
2024-03-27 10:39:30.422 REASON=User requested
2024-03-27 10:39:30.422 TIMESTAMP=27-03-2024 10:14:27
2024-03-27 10:39:30.423 DESCRIPTION=[REMOVE TASK] remove task
2024-03-27 10:39:30.423 =========================================
2024-03-27 10:39:30.423 ==== Previous exit reason information dump ====
2024-03-27 10:39:30.423 REASON=Other
2024-03-27 10:39:30.423 TIMESTAMP=27-03-2024 10:13:39
2024-03-27 10:39:30.423 DESCRIPTION=[ISOLATED NOT NEEDED] isolated not needed
2024-03-27 10:39:30.423 =========================================
2024-03-27 10:39:30.423 ==== Previous exit reason information dump ====
2024-03-27 10:39:30.423 REASON=User requested
2024-03-27 10:39:30.426 TIMESTAMP=27-03-2024 10:13:39
2024-03-27 10:39:30.426 DESCRIPTION=[FORCE STOP] stop com.app due to from pid 12809
2024-03-27 10:39:30.426 =========================================
2024-03-27 10:39:30.428 [Headset] Headset receiver created
2024-03-27 10:39:30.430 [Audio Helper] Helper created
2024-03-27 10:39:30.430 [Bluetooth] Adapter found
2024-03-27 10:39:30.430 [Bluetooth] SCO available off call, continue
2024-03-27 10:39:30.430 [Bluetooth] Bluetooth receiver created
2024-03-27 10:39:30.430 [Bluetooth] Bluetooth broadcast receiver registered
2024-03-27 10:39:30.430 [Bluetooth] Bluetooth helper created
2024-03-27 10:39:30.431 [Core Manager] Registering shutdown receiver
2024-03-27 10:39:30.431 [Core Manager] Found a service that herits from org.linphone.core.tools.service.CoreService: org.linphone.core.tools.service.CoreService
2024-03-27 10:39:30.431 [Core Manager] Ready
2024-03-27 10:39:30.431 [Android Platform Helper] CoreManager is fully initialised.
2024-03-27 10:39:30.431 [Device] hasLowLatencyFeature: true, hasProFeature: true
2024-03-27 10:39:30.432 [Device] Output frames per buffer: 128, output sample rate: 48000.
2024-03-27 10:39:30.432 [Platform Helper] Created, wifi only mode is disabled
2024-03-27 10:39:30.432 [Platform Helper] Starting copy from assets to application files directory
2024-03-27 10:39:30.435 [Platform Helper] Installing Resource cpim_grammar
2024-03-27 10:39:30.435 [Platform Helper] Installing Resource ics_grammar
2024-03-27 10:39:30.435 [Platform Helper] Installing Resource identity_grammar
2024-03-27 10:39:30.436 [Platform Helper] Installing Resource sdp_grammar
2024-03-27 10:39:30.436 [Platform Helper] Installing Resource vcard_grammar
2024-03-27 10:39:30.437 [Platform Helper] Installing Resource nowebcamcif.jpg
2024-03-27 10:39:30.438 [Platform Helper] Installing Resource rootca.pem
2024-03-27 10:39:30.440 [Platform Helper] Resource dont_wait_too_long.mkv already installed, skipping...
2024-03-27 10:39:30.441 [Platform Helper] Resource hello16000.wav already installed, skipping...
2024-03-27 10:39:30.441 [Platform Helper] Resource hello8000.wav already installed, skipping...
2024-03-27 10:39:30.441 [Platform Helper] Resource incoming_chat.wav already installed, skipping...
2024-03-27 10:39:30.441 [Platform Helper] Resource ringback.wav already installed, skipping...
2024-03-27 10:39:30.442 [Platform Helper] Resource four_hands_together.mkv already installed, skipping...
2024-03-27 10:39:30.442 [Platform Helper] Resource house_keeping.mkv already installed, skipping...
2024-03-27 10:39:30.442 [Platform Helper] Resource its_a_game.mkv already installed, skipping...
2024-03-27 10:39:30.443 [Platform Helper] Resource leaving_dreams.mkv already installed, skipping...
2024-03-27 10:39:30.443 [Platform Helper] Resource notes_of_the_optimistic.mkv already installed, skipping...
2024-03-27 10:39:30.443 [Platform Helper] Resource oldphone-mono.wav already installed, skipping...
2024-03-27 10:39:30.443 [Platform Helper] Resource soft_as_snow.mkv already installed, skipping...
2024-03-27 10:39:30.444 [Platform Helper] Resource silence.mkv already installed, skipping...
2024-03-27 10:39:30.444 [Platform Helper] Resource toy-mono.wav already installed, skipping...
2024-03-27 10:39:30.444 [Platform Helper] Copy from assets done
2024-03-27 10:39:30.445 [Platform Helper] Device is in bucket STANDBY_BUCKET_ACTIVE
2024-03-27 10:39:30.447 [Platform Helper] [Network Manager 26] Found DNS host 192.168.2.1 from active network WIFI
2024-03-27 10:39:30.447 [Platform Helper] [Network Manager 26] Found DNS host 207.164.234.129 from active network WIFI
2024-03-27 10:39:30.447 [Platform Helper] DNS servers list updated
2024-03-27 10:39:30.448 [Platform Helper] [Signal Strength Monitor] Created
2024-03-27 10:39:30.449 bellesip_wake_lock_init(): initialization succeed
2024-03-27 10:39:30.449 [Android Platform Helper] AndroidPlatformHelper is fully initialised.
2024-03-27 10:39:30.449 Mediastreamer2 factory 5.3.0 (git: unknown) initialized.
2024-03-27 10:39:30.449 CPU count set to 8
2024-03-27 10:39:30.449 ms_factory_init() done: platform_tags=linux,android,x86,embedded
2024-03-27 10:39:30.449 srtp init
2024-03-27 10:39:30.449 [Android Audio Utils] SDK version [34] detected
2024-03-27 10:39:30.449 [Android Audio Utils] Device's preferred buffer size is 128
2024-03-27 10:39:30.449 [Android Audio Utils] Device's preferred sample rate is 48000
2024-03-27 10:39:30.449 [Media Codec] Looking if mime type [video/avc] is supported
2024-03-27 10:39:30.449 [Media Codec] Found decoder for mime type [video/avc]
2024-03-27 10:39:30.450 [Media Codec] Found encoder for mime type [video/avc]
2024-03-27 10:39:30.450 [Media Codec] Looking if mime type [video/hevc] is supported
2024-03-27 10:39:30.450 [Media Codec] Found decoder for mime type [video/hevc]
2024-03-27 10:39:30.450 [Media Codec] Found encoder for mime type [video/hevc]
2024-03-27 10:39:30.450 Registering all soundcard handlers
2024-03-27 10:39:30.450 Native android sound support not tested on SDK [34], disabled.
2024-03-27 10:39:30.450 [OpenSLES] libOpenSLES correctly loaded, creating OpenSLES MS soundcard
2024-03-27 10:39:30.456 This device (Google/Pixel 6/gs101) declares it has a built-in echo canceller.
2024-03-27 10:39:30.456 No information available for [Google/Pixel 6/gs101],
2024-03-27 10:39:30.456 Android >= 8 [API 34], using sound device descriptor.with DEVICE_HAS_BUILTIN_AEC | DEVICE_HAS_BUILTIN_OPENSLES_AEC flags
2024-03-27 10:39:30.456 Sound device information for [Google/Pixel 6/gs101] is: builtin=[yes], delay=[0] ms
2024-03-27 10:39:30.456 [Audio Manager] Found device: name [Pixel 6], ID [2], type [Built-in earpiece (1)], isSource [false], isSink [true], address []
2024-03-27 10:39:30.456 [Audio Manager] Found device: name [Pixel 6], ID [3], type [Built-in speaker (2)], isSource [false], isSink [true], address []
2024-03-27 10:39:30.456 [Audio Manager] Found device: name [Pixel 6], ID [15], type [Telephony (18)], isSource [false], isSink [true], address []
2024-03-27 10:39:30.456 [Audio Manager] Found device: name [Pixel 6], ID [4], type [Built-in speaker (safe) (24)], isSource [false], isSink [true], address []
2024-03-27 10:39:30.456 [Audio Manager] Found device: name [Pixel 6], ID [22], type [Built-in microphone (15)], isSource [true], isSink [false], address [bottom]
2024-03-27 10:39:30.456 [Audio Manager] Found device: name [Pixel 6], ID [26], type [Telephony (18)], isSource [true], isSink [false], address []
2024-03-27 10:39:30.456 [Audio Manager] Found device: name [Pixel 6], ID [23], type [Built-in microphone (15)], isSource [true], isSink [false], address [back]
2024-03-27 10:39:30.457 [Audio Manager] Found device: name [Pixel 6], ID [34], type [Remote Submix (25)], isSource [true], isSink [false], address [0]
2024-03-27 10:39:30.457 [Audio Manager] Found device: name [Pixel 6], ID [32], type [UNEXPECTED (28)], isSource [true], isSink [false], address []
2024-03-27 10:39:30.457 [OpenSLES] Create soundcards for 9 devices
2024-03-27 10:39:30.457 Card 'openSLES Earpiece: Pixel 6' added with capabilities [playback]
2024-03-27 10:39:30.457 [OpenSLES] Added card [0xb4000076d73d7f80]: name [Pixel 6] device ID [2] type [Earpiece]
2024-03-27 10:39:30.457 Card 'openSLES Speaker: Pixel 6' added with capabilities [playback]
2024-03-27 10:39:30.457 [OpenSLES] Added card [0xb4000076d73d5c10]: name [Pixel 6] device ID [3] type [Speaker]
2024-03-27 10:39:30.457 [OpenSLES] SKipped device with type [Telephony]
2024-03-27 10:39:30.457 [OpenSLES] Card [0xb4000076d73c2500]: name [Pixel 6] device ID [4] type [Speaker] not added, considered a duplicate of card [0xb4000076d73d5c10]: name [Pixel 6] device ID [3] type [Speaker]
2024-03-27 10:39:30.457 [OpenSLES] Deleting card [0xb4000076d73c2500]: name [Pixel 6] device ID [4] type [Speaker]
2024-03-27 10:39:30.457 [OpenSLES] Deletion of OpenSLES context [0xb4000077f75838c0]
2024-03-27 10:39:30.457 [OpenSLES] Adding MS_SND_CARD_CAP_BUILTIN_ECHO_CANCELLER flag to soundcard ([Pixel 6] device ID [22] type [Microphone]) because of DEVICE_HAS_BUILTIN_OPENSLES_AEC
2024-03-27 10:39:30.457 Card 'openSLES Microphone: Pixel 6' added with capabilities [capture]
2024-03-27 10:39:30.457 [OpenSLES] Added card [0xb4000076d73c2500]: name [Pixel 6] device ID [22] type [Microphone]
2024-03-27 10:39:30.457 [OpenSLES] SKipped device with type [Telephony]
2024-03-27 10:39:30.457 [OpenSLES] Adding MS_SND_CARD_CAP_BUILTIN_ECHO_CANCELLER flag to soundcard ([Pixel 6] device ID [23] type [Microphone]) because of DEVICE_HAS_BUILTIN_OPENSLES_AEC
2024-03-27 10:39:30.457 [OpenSLES] Card [0xb4000076d73d6690]: name [Pixel 6] device ID [23] type [Microphone] not added, considered a duplicate of card [0xb4000076d73c2500]: name [Pixel 6] device ID [22] type [Microphone]
2024-03-27 10:39:30.457 [OpenSLES] Deleting card [0xb4000076d73d6690]: name [Pixel 6] device ID [23] type [Microphone]
2024-03-27 10:39:30.457 [OpenSLES] Deletion of OpenSLES context [0xb4000077f748a8c0]
2024-03-27 10:39:30.457 [Android Audio Utils] Unknown device type for type ID 25
2024-03-27 10:39:30.457 [OpenSLES] SKipped device with type [Unknown]
2024-03-27 10:39:30.457 [Android Audio Utils] Unknown device type for type ID 28
2024-03-27 10:39:30.457 [OpenSLES] SKipped device with type [Unknown]
2024-03-27 10:39:30.457 SDK version [34] detected
2024-03-27 10:39:30.462 This device (Google/Pixel 6/gs101) declares it has a built-in echo canceller.
2024-03-27 10:39:30.462 No information available for [Google/Pixel 6/gs101],
2024-03-27 10:39:30.462 Android >= 8 [API 34], using sound device descriptor.with DEVICE_HAS_BUILTIN_AEC | DEVICE_HAS_BUILTIN_OPENSLES_AEC flags
2024-03-27 10:39:30.462 Sound device information for [Google/Pixel 6/gs101] is: builtin=[yes], delay=[0] ms
2024-03-27 10:39:30.462 Card 'ANDROID SND (deprecated) Unknown: Android Sound card' added with capabilities [capture, playback]
2024-03-27 10:39:30.462 Registering all webcam handlers
2024-03-27 10:39:30.462 Found Android plugin libmsaaudio.so
2024-03-27 10:39:30.462 Found Android plugin libmsandroidcamera2.so
2024-03-27 10:39:30.462 Found Android plugin libmswebrtc.so
2024-03-27 10:39:30.462 [Legacy Capture] Android >= 8.0 detected and msAndroidCamera2 plugin found, disabling legacy capture filter
2024-03-27 10:39:30.462 Webcam StaticImage: Static picture added
2024-03-27 10:39:30.462 MSAndroidDisplay registered.
2024-03-27 10:39:30.462 MSAndroidDisplay (OpenGL ES2) registered (id=81).
2024-03-27 10:39:30.462 ms_factory_init_voip() done
2024-03-27 10:39:30.462 Found Android plugin libmsaaudio.so
2024-03-27 10:39:30.462 Found Android plugin libmsandroidcamera2.so
2024-03-27 10:39:30.462 Found Android plugin libmswebrtc.so
2024-03-27 10:39:30.462 Loading ms plugins from list
2024-03-27 10:39:30.462 Loading plugin libmsaaudio.so...
2024-03-27 10:39:30.463 [AAudio] libmsaaudio plugin loaded
2024-03-27 10:39:30.463 [AAudio] libaaudio.so successfully loaded
2024-03-27 10:39:30.469 This device (Google/Pixel 6/gs101) declares it has a built-in echo canceller.
2024-03-27 10:39:30.469 No information available for [Google/Pixel 6/gs101],
2024-03-27 10:39:30.469 Android >= 8 [API 34], using sound device descriptor.with DEVICE_HAS_BUILTIN_AEC | DEVICE_HAS_BUILTIN_OPENSLES_AEC flags
2024-03-27 10:39:30.469 Sound device information for [Google/Pixel 6/gs101] is: builtin=[yes], delay=[0] ms
2024-03-27 10:39:30.469 [Audio Manager] Found device: name [Pixel 6], ID [2], type [Built-in earpiece (1)], isSource [false], isSink [true], address []
2024-03-27 10:39:30.469 [Audio Manager] Found device: name [Pixel 6], ID [3], type [Built-in speaker (2)], isSource [false], isSink [true], address []
2024-03-27 10:39:30.469 [Audio Manager] Found device: name [Pixel 6], ID [15], type [Telephony (18)], isSource [false], isSink [true], address []
2024-03-27 10:39:30.469 [Audio Manager] Found device: name [Pixel 6], ID [4], type [Built-in speaker (safe) (24)], isSource [false], isSink [true], address []
2024-03-27 10:39:30.469 [Audio Manager] Found device: name [Pixel 6], ID [22], type [Built-in microphone (15)], isSource [true], isSink [false], address [bottom]
2024-03-27 10:39:30.469 [Audio Manager] Found device: name [Pixel 6], ID [26], type [Telephony (18)], isSource [true], isSink [false], address []
2024-03-27 10:39:30.469 [Audio Manager] Found device: name [Pixel 6], ID [23], type [Built-in microphone (15)], isSource [true], isSink [false], address [back]
2024-03-27 10:39:30.469 [Audio Manager] Found device: name [Pixel 6], ID [34], type [Remote Submix (25)], isSource [true], isSink [false], address [0]
2024-03-27 10:39:30.469 [Audio Manager] Found device: name [Pixel 6], ID [32], type [UNEXPECTED (28)], isSource [true], isSink [false], address []
2024-03-27 10:39:30.469 [AAudio] Create soundcards for 9 devices
2024-03-27 10:39:30.474 This device (Google/Pixel 6/gs101) declares it has a built-in echo canceller.
2024-03-27 10:39:30.474 No information available for [Google/Pixel 6/gs101],
2024-03-27 10:39:30.474 Android >= 8 [API 34], using sound device descriptor.with DEVICE_HAS_BUILTIN_AEC | DEVICE_HAS_BUILTIN_OPENSLES_AEC flags
2024-03-27 10:39:30.474 Sound device information for [Google/Pixel 6/gs101] is: builtin=[yes], delay=[0] ms
2024-03-27 10:39:30.474 Card 'AAudio Earpiece: Pixel 6' prepended with capabilities [playback]
2024-03-27 10:39:30.474 [AAudio] Added card with ID [AAudio Earpiece: Pixel 6], name [Pixel 6], device ID [2], type [Earpiece] and capabilities [2]
2024-03-27 10:39:30.474 Card 'AAudio Speaker: Pixel 6' prepended with capabilities [playback]
2024-03-27 10:39:30.474 [AAudio] Added card with ID [AAudio Speaker: Pixel 6], name [Pixel 6], device ID [3], type [Speaker] and capabilities [2]
2024-03-27 10:39:30.474 [AAudio] SKipped device with type [Telephony]
2024-03-27 10:39:30.474 [AAudio] Card with ID [(null)], name [Pixel 6], device ID [4], type [Speaker] and capabilities [2] not added, considered as duplicate
2024-03-27 10:39:30.474 [AAudio] Deletion of AAudio context [0xb4000078373d9b50]
2024-03-27 10:39:30.474 [AAudio] Microphone device has [bottom] address
2024-03-27 10:39:30.474 Card 'AAudio Microphone: Pixel 6' prepended with capabilities [capture]
2024-03-27 10:39:30.474 [AAudio] Added card with ID [AAudio Microphone: Pixel 6], name [Pixel 6], device ID [22], type [Microphone] and capabilities [5]
2024-03-27 10:39:30.474 [AAudio] SKipped device with type [Telephony]
2024-03-27 10:39:30.474 [AAudio] Microphone device have [back] address, assuming not bottom (back)
2024-03-27 10:39:30.474 [AAudio] Bottom microphone already added with device ID [22], storing back microphone ID [23] as alternative in it
2024-03-27 10:39:30.474 [AAudio] Deletion of AAudio context [0xb4000078373d9c30]
2024-03-27 10:39:30.474 [Android Audio Utils] Unknown device type for type ID 25
2024-03-27 10:39:30.474 [AAudio] SKipped device with type [Unknown]
2024-03-27 10:39:30.474 [Android Audio Utils] Unknown device type for type ID 28
2024-03-27 10:39:30.474 [AAudio] SKipped device with type [Unknown]
2024-03-27 10:39:30.474 [AAudio] Soundcard created
2024-03-27 10:39:30.474 Plugin loaded (libmsaaudio.so)
2024-03-27 10:39:30.474 Loading plugin libmsandroidcamera2.so...
2024-03-27 10:39:30.475 [Camera2 Capture] libmsandroidcamera2 plugin loaded
2024-03-27 10:39:30.475 [Camera2 Capture] Detecting cameras
2024-03-27 10:39:30.478 [Camera2 Capture] Camera 0 is facing back with angle 90, hardware level is full
2024-03-27 10:39:30.478 Webcam BackFacingCamera prepended
2024-03-27 10:39:30.478 [Camera2 Capture] Camera 1 is facing front with angle 270, hardware level is full
2024-03-27 10:39:30.478 Webcam FrontFacingCamera prepended
2024-03-27 10:39:30.478 Plugin loaded (libmsandroidcamera2.so)
2024-03-27 10:39:30.479 Loading plugin libmswebrtc.so...
2024-03-27 10:39:30.479 libmswebrtc 1.1.1 plugin loaded, iSAC codec version 3.6.0, iLBC codec version 1.1.1
2024-03-27 10:39:30.479 Plugin loaded (libmswebrtc.so)
2024-03-27 10:39:30.479 All plugins in list correctly loaded
2024-03-27 10:39:30.479 Core callbacks [0xb4000077d7421170] registered on core [0xb4000076a755bda0]
2024-03-27 10:39:30.479 Codec opus/48000 fmtp=[useinbandfec=1] number=-1, default enablement: 1) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec SILK/16000 fmtp=[] number=-1, default enablement: 1) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec speex/16000 fmtp=[vbr=on] number=-1, default enablement: 1) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec speex/8000 fmtp=[vbr=on] number=-1, default enablement: 1) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec PCMU/8000 fmtp=[] number=0, default enablement: 1) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec PCMA/8000 fmtp=[] number=8, default enablement: 1) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec red/1000 fmtp=[] number=-1, default enablement: 1) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec t140/1000 fmtp=[] number=-1, default enablement: 1) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec GSM/8000 fmtp=[] number=3, default enablement: 0) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec G722/8000 fmtp=[] number=9, default enablement: 0) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec iLBC/8000 fmtp=[mode=30] number=-1, default enablement: 0) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec AMR/8000 fmtp=[octet-align=1] number=-1, default enablement: 0) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec AMR-WB/16000 fmtp=[octet-align=1] number=-1, default enablement: 0) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec G729/8000 fmtp=[annexb=yes] number=18, default enablement: 1) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec mpeg4-generic/16000 fmtp=[config=F8EE2000; constantDuration=512; indexDeltaLength=3; indexLength=3; mode=AAC-hbr; profile-level-id=76; sizeLength=13; streamType=5] number=-1, default enablement: 0) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec mpeg4-generic/22050 fmtp=[config=F8EE2000; constantDuration=512; indexDeltaLength=3; indexLength=3; mode=AAC-hbr; profile-level-id=76; sizeLength=13; streamType=5] number=-1, default enablement: 0) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec mpeg4-generic/32000 fmtp=[config=F8E82000; constantDuration=512; indexDeltaLength=3; indexLength=3; mode=AAC-hbr; profile-level-id=76; sizeLength=13; streamType=5] number=-1, default enablement: 0) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec mpeg4-generic/44100 fmtp=[config=F8E82000; constantDuration=512; indexDeltaLength=3; indexLength=3; mode=AAC-hbr; profile-level-id=76; sizeLength=13; streamType=5] number=-1, default enablement: 0) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec mpeg4-generic/48000 fmtp=[config=F8EE2000; constantDuration=512; indexDeltaLength=3; indexLength=3; mode=AAC-hbr; profile-level-id=76; sizeLength=13; streamType=5] number=-1, default enablement: 0) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec iSAC/16000 fmtp=[] number=-1, default enablement: 0) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec speex/32000 fmtp=[vbr=on] number=-1, default enablement: 0) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec SILK/8000 fmtp=[] number=-1, default enablement: 0) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec SILK/12000 fmtp=[] number=-1, default enablement: 0) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec SILK/24000 fmtp=[] number=-1, default enablement: 0) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec G726-16/8000 fmtp=[] number=-1, default enablement: 0) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec G726-24/8000 fmtp=[] number=-1, default enablement: 0) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec G726-32/8000 fmtp=[] number=-1, default enablement: 0) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec G726-40/8000 fmtp=[] number=-1, default enablement: 0) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec AAL2-G726-16/8000 fmtp=[] number=-1, default enablement: 0) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec AAL2-G726-24/8000 fmtp=[] number=-1, default enablement: 0) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec AAL2-G726-32/8000 fmtp=[] number=-1, default enablement: 0) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec AAL2-G726-40/8000 fmtp=[] number=-1, default enablement: 0) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec CODEC2/8000 fmtp=[] number=-1, default enablement: 0) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec BV16/8000 fmtp=[] number=-1, default enablement: 0) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec AV1/90000 fmtp=[] number=-1, default enablement: 1) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec VP8/90000 fmtp=[] number=-1, default enablement: 1) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec H264/90000 fmtp=[profile-level-id=42801F] number=-1, default enablement: 1) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec H265/90000 fmtp=[] number=-1, default enablement: 1) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec MP4V-ES/90000 fmtp=[profile-level-id=3] number=-1, default enablement: 1) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec H263-1998/90000 fmtp=[CIF=1;QCIF=1] number=-1, default enablement: 0) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec H263/90000 fmtp=[] number=34, default enablement: 0) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec 1016/8000 fmtp=[] number=1, default enablement: 0) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec G723/8000 fmtp=[] number=4, default enablement: 0) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec LPC/8000 fmtp=[] number=7, default enablement: 0) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec L16/44100 fmtp=[] number=10, default enablement: 0) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec L16/44100 fmtp=[] number=11, default enablement: 0) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec CN/8000 fmtp=[] number=13, default enablement: 0) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec H261/90000 fmtp=[] number=31, default enablement: 0) added to the list of possible codecs.
2024-03-27 10:39:30.479 Codec MPV/90000 fmtp=[] number=32, default enablement: 0) added to the list of possible codecs.
2024-03-27 10:39:30.479 Root ca path set to /system/etc/security/cacerts
2024-03-27 10:39:30.479 Root ca path set to /system/etc/security/cacerts
2024-03-27 10:39:30.479 [Platform Helper] getDnsServers() returning 192.168.2.1, 207.164.234.129, 
2024-03-27 10:39:30.479 [Android Platform Helper] Found DNS server 192.168.2.1
2024-03-27 10:39:30.479 [Android Platform Helper] Found DNS server 207.164.234.129
2024-03-27 10:39:30.479 Found Android plugin libmsaaudio.so
2024-03-27 10:39:30.479 Found Android plugin libmsandroidcamera2.so
2024-03-27 10:39:30.479 Found Android plugin libmswebrtc.so
2024-03-27 10:39:30.479 Loading ms plugins from list
2024-03-27 10:39:30.479 Loading plugin libmsaaudio.so...
2024-03-27 10:39:30.480 [AAudio] libmsaaudio plugin loaded
2024-03-27 10:39:30.480 [AAudio] libaaudio.so successfully loaded
2024-03-27 10:39:30.484 This device (Google/Pixel 6/gs101) declares it has a built-in echo canceller.
2024-03-27 10:39:30.484 No information available for [Google/Pixel 6/gs101],
2024-03-27 10:39:30.484 Android >= 8 [API 34], using sound device descriptor.with DEVICE_HAS_BUILTIN_AEC | DEVICE_HAS_BUILTIN_OPENSLES_AEC flags
2024-03-27 10:39:30.484 Sound device information for [Google/Pixel 6/gs101] is: builtin=[yes], delay=[0] ms
2024-03-27 10:39:30.484 [AAudio] Soundcard created
2024-03-27 10:39:30.484 Plugin loaded (libmsaaudio.so)
2024-03-27 10:39:30.484 Loading plugin libmsandroidcamera2.so...
2024-03-27 10:39:30.485 [Camera2 Capture] libmsandroidcamera2 plugin loaded
2024-03-27 10:39:30.485 Plugin loaded (libmsandroidcamera2.so)
2024-03-27 10:39:30.485 Loading plugin libmswebrtc.so...
2024-03-27 10:39:30.485 libmswebrtc 1.1.1 plugin loaded, iSAC codec version 3.6.0, iLBC codec version 1.1.1
2024-03-27 10:39:30.485 Plugin loaded (libmswebrtc.so)
2024-03-27 10:39:30.485 All plugins in list correctly loaded
2024-03-27 10:39:30.485 Device [Android Sound card] type is unknown
2024-03-27 10:39:30.485 linphone_core_set_playback_gain_db(): no active call.
2024-03-27 10:39:30.485 linphone_core_enable_mic(): new state is [enabled], current state is [disabled]
2024-03-27 10:39:30.485 linphone_core_set_mic_gain_db(): no active call.
2024-03-27 10:39:30.485 Sal nat helper [enabled]
2024-03-27 10:39:30.485 Sal use rports [enabled]
2024-03-27 10:39:30.485 MTU is supposed to be 1300, rtp payload max size will be 1240
2024-03-27 10:39:30.485 Could not find encoder for SILK
2024-03-27 10:39:30.485 Could not find encoder for AMR
2024-03-27 10:39:30.485 Could not find encoder for AMR-WB
2024-03-27 10:39:30.485 Could not find encoder for G729
2024-03-27 10:39:30.485 Could not find encoder for mpeg4-generic
2024-03-27 10:39:30.485 Could not find encoder for mpeg4-generic
2024-03-27 10:39:30.485 Could not find encoder for mpeg4-generic
2024-03-27 10:39:30.485 Could not find encoder for mpeg4-generic
2024-03-27 10:39:30.485 Could not find encoder for mpeg4-generic
2024-03-27 10:39:30.485 Could not find encoder for SILK
2024-03-27 10:39:30.485 Could not find encoder for SILK
2024-03-27 10:39:30.485 Could not find encoder for SILK
2024-03-27 10:39:30.485 Could not find encoder for G726-16
2024-03-27 10:39:30.485 Could not find encoder for G726-24
2024-03-27 10:39:30.485 Could not find encoder for G726-32
2024-03-27 10:39:30.485 Could not find encoder for G726-40
2024-03-27 10:39:30.485 Could not find encoder for AAL2-G726-16
2024-03-27 10:39:30.485 Could not find encoder for AAL2-G726-24
2024-03-27 10:39:30.485 Could not find encoder for AAL2-G726-32
2024-03-27 10:39:30.485 Could not find encoder for AAL2-G726-40
2024-03-27 10:39:30.485 Could not find encoder for CODEC2
2024-03-27 10:39:30.485 Could not find encoder for 1016
2024-03-27 10:39:30.485 Could not find encoder for G723
2024-03-27 10:39:30.485 Could not find encoder for LPC
2024-03-27 10:39:30.485 Could not find encoder for CN
2024-03-27 10:39:30.485 Could not find encoder for MP4V-ES
2024-03-27 10:39:30.485 Could not find encoder for H263-1998
2024-03-27 10:39:30.485 Could not find encoder for H263
2024-03-27 10:39:30.485 Could not find encoder for H261
2024-03-27 10:39:30.485 Could not find encoder for MPV
2024-03-27 10:39:30.485 Supported codec red/1000 fmtp= automatically added to codec list.
2024-03-27 10:39:30.485 Supported codec t140/1000 fmtp= automatically added to codec list.
2024-03-27 10:39:30.485 Sorting video codec list, new list is:
2024-03-27 10:39:30.485 H265
2024-03-27 10:39:30.485 H264
2024-03-27 10:39:30.485 AV1
2024-03-27 10:39:30.485 VP8
2024-03-27 10:39:30.485 Sal use rports [enabled]
2024-03-27 10:39:30.485 belle_sip_stack_set_well_know_port() : set to [5060]
2024-03-27 10:39:30.485 belle_sip_stack_set_well_know_port_tls() : set to [5061]
2024-03-27 10:39:30.485 Root ca path set to /data/user/0/com.app/files/share/linphone/rootca.pem
2024-03-27 10:39:30.488 LinphoneAccount[0xb4000078274af758] created with params
2024-03-27 10:39:30.488 LinphoneAccount[0xb4000078274af758] created with proxy config
2024-03-27 10:39:30.488 linphoneAccountIsServerConfigChanged : 0
2024-03-27 10:39:30.488 Publish params have changed on account [0xb4000078274af758]
2024-03-27 10:39:30.488 Invalidating friends maps for list [0xb4000078176e7b50]
2024-03-27 10:39:30.489 Switching LinphoneCore [0xb4000076a755bda0] from state LinphoneGlobalOff to LinphoneGlobalReady
2024-03-27 10:39:30.489 Core account list: 1
2024-03-27 10:39:30.489 Core default account: Java object [org.linphone.core.AccountImpl@f8a34d], native pointer [0xb4000078274af758]
2024-03-27 10:39:30.490 Core callbacks [0xb4000077d742a830] registered on core [0xb4000076a755bda0]
2024-03-27 10:39:30.494 [Push Notification] Token fetched from Firebase: <token>
2024-03-27 10:39:30.495 [Core Manager] Push notification app id is [539156446598] and token is [<token>]
2024-03-27 10:39:30.636 [Activity Monitor] Activity paused:com.app.Login@ecb1029
2024-03-27 10:39:30.636 [Activity Monitor] Activity wasn't registered yet...
2024-03-27 10:39:30.653 [Activity Monitor] Activity created:com.app.Main@b83a6a
2024-03-27 10:39:30.669 Activity started:com.app.Main@b83a6a
2024-03-27 10:39:30.672 [Activity Monitor] Activity resumed:com.app.Main@b83a6a
2024-03-27 10:39:30.672 [Activity Monitor] runningActivities=1
2024-03-27 10:39:30.672 [Activity Monitor] App has left background mode
2024-03-27 10:39:30.707 [Core Manager] App has left background mode
2024-03-27 10:39:30.707 [Core Manager] Device computed rotation is 0 device display id is 0)
2024-03-27 10:39:30.707 [Core Manager] Restarting core.iterate() schedule with foreground timer
2024-03-27 10:39:30.707 [Core Manager] core.iterate() scheduling wasn't started or already stopped
2024-03-27 10:39:30.708 [Core Manager] Call to core.iterate() scheduled every 20 ms
2024-03-27 10:39:30.847 linphoneAccountIsServerConfigChanged : 1
2024-03-27 10:39:30.847 Publish params have not changed on account [0xb4000078274af758]
2024-03-27 10:39:30.847 Push notification information updated: param [539156446598], prid [<token>]
2024-03-27 10:39:31.363 [Activity Monitor] Activity stopped:com.app.Login@ecb1029
2024-03-27 10:39:31.366 [Activity Monitor] Activity destroyed:com.app.Login@ecb1029

  1. Adb logcat logs (mandatory if native crash)

Not applicable

  1. Screenshots (optionnal)

Not applicable

  1. Additional context (optionnal)

Unsure if I am doing anything wrong, I could not find any documentation, readme, or tutorial explaining how to properly do something like this.

ParticleCore commented 7 months ago

I just realized this might be better off asked at a different repo? https://github.com/BelledonneCommunications/linphone-sdk

If so this one can be closed.

Viish commented 7 months ago

Hi @ParticleCore,

Could you dump the content of /data/user/0/com.app/files/.linphonerc file after you call

core.clearAccounts()
core.clearAllAuthInfo()

please?

It's the first time I hear about such issue, and as this code almost never changes I find it weird it doesn't work on your side.

Cheers,

ParticleCore commented 7 months ago

Here is the content of the file you asked for after calling both methods (account related information has been redacted):

[misc]
empty_chat_room_deletion=1
uuid=<truncated>

[sound]
playback_dev_id=AAudio Earpiece: Pixel 6
ringer_dev_id=AAudio Earpiece: Pixel 6
capture_dev_id=AAudio Microphone: Pixel 6
media_dev_id=AAudio Earpiece: Pixel 6
remote_ring=/data/user/0/com.app/files/share/sounds/linphone/ringback.wav
playback_gain_db=0.000000
mic_gain_db=0.000000
disable_record_on_mute=0

[net]
nat_policy_ref=iNUTu4EfNSKW2XJ
mtu=1300

[sip]
root_ca=/data/user/0/com.app/files/share/linphone/rootca.pem
verify_server_certs=1
verify_server_cn=1
contact=sip:linphone@unknown-host
auto_send_ringing=1
media_encryption=none
register_only_when_network_is_up=1
supported=replaces, outbound, gruu, path
default_proxy=0
http_proxy_port=0
guess_hostname=1
inc_timeout=45
in_call_timeout=0
delayed_timeout=4
register_only_when_upnp_is_ok=1

[app]
auto_download_incoming_files_max_size=-1
auto_download_incoming_voice_recordings=1
auto_download_incoming_icalendars=1
sender_name_hidden_in_forward_message=0
record_aware=0

[nat_policy_0]
ref=iNUTu4EfNSKW2XJ

[rtp]
audio_rtp_port=-1
video_rtp_port=-1
text_rtp_port=-1
audio_jitt_comp=60
video_jitt_comp=60
nortp_timeout=30
audio_adaptive_jitt_comp_enabled=1
video_adaptive_jitt_comp_enabled=1

[video]
size=vga
display=1
capture=1
codec_priority_policy=1

[audio_codec_0]
mime=opus
rate=48000
channels=2
enabled=1
recv_fmtp=useinbandfec=1

[audio_codec_1]
mime=speex
rate=16000
channels=1
enabled=1
recv_fmtp=vbr=on

[audio_codec_2]
mime=speex
rate=8000
channels=1
enabled=1
recv_fmtp=vbr=on

[audio_codec_3]
mime=PCMU
rate=8000
channels=1
enabled=1

[audio_codec_4]
mime=PCMA
rate=8000
channels=1
enabled=1

[audio_codec_5]
mime=GSM
rate=8000
channels=1
enabled=0

[audio_codec_6]
mime=G722
rate=8000
channels=1
enabled=0

[audio_codec_7]
mime=iLBC
rate=8000
channels=1
enabled=0
recv_fmtp=mode=30

[audio_codec_8]
mime=iSAC
rate=16000
channels=1
enabled=0

[audio_codec_9]
mime=speex
rate=32000
channels=1
enabled=0
recv_fmtp=vbr=on

[audio_codec_10]
mime=BV16
rate=8000
channels=1
enabled=0

[audio_codec_11]
mime=L16
rate=44100
channels=2
enabled=0

[audio_codec_12]
mime=L16
rate=44100
channels=1
enabled=0

[video_codec_0]
mime=H265
rate=90000
enabled=1

[video_codec_1]
mime=H264
rate=90000
enabled=1
recv_fmtp=profile-level-id=42801F

[video_codec_2]
mime=AV1
rate=90000
enabled=1

[video_codec_3]
mime=VP8
rate=90000
enabled=1

[proxy_0]
reg_proxy=<sip:<truncated>;transport=udp>
reg_identity=sip:<truncated>
push_parameters=pn-prid=<truncated>;pn-provider=fcm;pn-param=539156446598;pn-silent=1;pn-timeout=0;pn-msg-str=IM_MSG;pn-call-str=IC_MSG;pn-groupchat-str=GC_MSG;pn-call-snd=notes_of_the_optimistic.caf;pn-msg-snd=msg.caf;
quality_reporting_enabled=0
quality_reporting_interval=0
reg_expires=3600
reg_sendregister=1
publish=0
avpf=-1
avpf_rr_interval=1
dial_escape_plus=0
use_dial_prefix_for_calls_and_chats=1
privacy=32768
push_notification_allowed=1
remote_push_notification_allowed=1
force_register_on_push=0
cpim_in_basic_chat_rooms_enabled=0
idkey=proxy_config_4i3~JIsh2xn1S5L
publish_expires=-1
rtp_bundle=0
rtp_bundle_assumption=0
Viish commented 7 months ago

Thanks.

Indeed the proxy_0 section should not be here after calling core.clearAccounts() Problem is I don't reproduce it...

Could you check your code and make sure you don't add it again somewhere? Does calling core.clearProxyConfigs() makes it better?

Cheers,

ParticleCore commented 7 months ago

I've tried with core.clearProxyConfig() along with the other methods, and on its own, the result is exactly the same, there is always one account when reading the account list after.

However, I did something different; while the account was registered I deleted the .linphonerc file directly from the device and now it started working normally. It would logout correctly and clear the account from the file, and on login it would correctly indicate there were currently 0 accounts stored and create a new registration.

So far so good, but after repeating the logout and login a few times I tried the following; while logged in, close the app, and then open it again. It correctly reads the account in the file. I then logged out, and the account information was still in the file. Logged in, and it was back with the same issue, it stated that 1 account was already stored.

So it seems like running the login logic more than once (it is executed on login, and every time the app resumes) is enough to cause the issue.

Is there something that I should not be doing in the login code logic that could explain this problem? I am already checking to see if an account already exists so it does not add multiple equal accounts:

val oldAccount = core.accountList.firstOrNull()

if (oldAccount == null) {
    val account = core.createAccount(params)
    core.addAccount(account)
    core.addAuthInfo(authInfo)
    core.defaultAccount = account
    core.start()
}

Is it something that is being done before that? Is it the factory.createConfigWithFactory or factory.createCoreWithConfig that should only be run once? But then how can I check the account on resume without it?

I already moved everything else in that logic to after if (oldAccount == null) { to rule out the possibility of createAuthInfo, createAddress, createAccountParams possibly interfering here, so the only ones left are the factory instantiation and core instatiation methods.

val factory = Factory.instance()
val coreConfig = factory.createConfigWithFactory(
    "${context.filesDir.absolutePath}/.linphonerc",
    null,
)
val core = factory.createCoreWithConfig(coreConfig, context)

log.d("Core account list: ${core.accountList.size}")
core.addListener(coreListener)
val oldAccount = core.accountList.firstOrNull()
if (oldAccount != null) return
ParticleCore commented 7 months ago

In case it might be helpful, currently this is my SipManager

object SipManager {

    private const val TAG = "SipManager"
    @Volatile
    private var _factory: Factory? = null
    @Volatile
    private var _core: Core? = null

    private fun getFactory() = _factory ?: synchronized(SipManager::class.java) {
        _factory ?: try {
            Factory.instance()?.apply {
                setLoggerDomain("sip")
                enableLogcatLogs(true)
                loggingService.setLogLevel(LogLevel.Debug)
            }
                ?.also { _factory = it }
        } catch (e: Exception) {
            Log.e(TAG, "Failed to obtain factory instance", e)
            null
        }
    }

    private fun getCore(context: Context) = _core ?: synchronized(SipManager::class.java) {
        _core ?: getFactory()?.createCore(
            "${context.filesDir.absolutePath}/.linphonerc",
            null,
            context
        )?.also { _core = it }
    }

    private val coreListener = CoreListenerStub()

    fun connect(
        context: Context,
        username: String,
        password: String,
        domain: String,
        transportType: TransportType,
        onError: ((message: String) -> Unit)? = null,
    ) {

        Log.i(TAG, "Running on main thread ${Looper.getMainLooper().thread == Thread.currentThread()}")

        val core = getCore(context)

        if (core == null) {
            AppLog.error(TAG, "Unable to initialize")
            onError?.invoke("Unable to login")
            return
        }

        Log.i(TAG, "Core account list: ${core.accountList.size}")

        core.addListener(coreListener)

        val oldAccount = core.accountList.firstOrNull()

        if (oldAccount != null) return

        val factory = getFactory()

        if (factory == null) {
            AppLog.error(TAG, "Unable to initialize")
            onError?.invoke("Unable to login")
            return
        }

        val authInfo = factory.createAuthInfo(username, null, password, null, null, domain, null)
        val identity = factory.createAddress("sip:$username@$domain")
        val address = factory.createAddress("sip:$domain")?.apply {
            transport = transportType
        }
        val params = core.createAccountParams().apply {
            identityAddress = identity
            serverAddress = address
            isRegisterEnabled = true
            remotePushNotificationAllowed = true
        }
        val account = core.createAccount(params)

        core.addAccount(account)
        core.addAuthInfo(authInfo)
        core.defaultAccount = account
        core.start()

    }

    fun disconnect(context: Context) {

        Log.i(TAG, "Disconnecting")

        val core = getCore(context) ?: return
        val account = core.defaultAccount ?: return
        val authInfo = account.findAuthInfo()
        val params = account.params
        val clonedParams = params.clone().apply {
            isRegisterEnabled = false
        }

        if (authInfo != null) {
            core.removeAuthInfo(authInfo)
        }

        account.params = clonedParams

        core.removeAccount(account)

        core.accountList.firstOrNull()?.let {

            val authInfo = account.findAuthInfo()
            val params = account.params
            val clonedParams = params.clone().apply {
                isRegisterEnabled = false
            }

            if (authInfo != null) {
                core.removeAuthInfo(authInfo)
            }

            it.params = clonedParams

            core.removeAccount(it)

        }

        core.clearAccounts()
        core.clearAllAuthInfo()
        core.clearProxyConfig()
        core.defaultAccount = null
        core.refreshRegisters()
        core.stop()
        core.removeListener(coreListener)

        _core = null
        _factory = null

    }

}

Connect is called when the user logs in, and every time the app is reopened while the user is still logged in to the app. The subsequent logins when reopening the app (app dies or gets killed and is opened again) seems to be the scenario that causes the documented problem) Disconnect is only called when the user logs out

ParticleCore commented 6 months ago

@Viish I've been trying to make this work without saving the account registration (passing null for the config in createCore) which overcomes the initial issue outlined in this case, but unfortunately this brings up another issue that cannot be ignored.

I'm working with a SIP server that has a number of limited licenses per account and (because of the above change) the app always registers again for the same account and in a different random port every time the app reconnects/is re-opened. This causes the number of registrations to pile up way sooner than older registrations have a chance of expiring, and eventually hits a license limit and after that point the app can no longer receive or make any calls. Also making the port a fixed port lead to conflicts, so the random port feature is very welcome to resolve that.

Changing the license behavior on the server side is not an option since this is a mixed environment, meaning that there are other systems connected to it that need those configurations to stay as they are.

Is there any way that this issue can be resolved? Or a workaround to the original problem? Because the only real problem here is I am unable to tell whether the device has already been registered or not to prevent registering it again.

Viish commented 6 months ago

Hi @ParticleCore,

There is obviously something "wrong" (in the sense that it does something differently than we do) in the way you use our SDK, or there is a serious issue with your device. Can you confirm the issue doesn't happen with our app from the Play Store?

Cheers,

ParticleCore commented 6 months ago

Hi @Viish I've gone ahead and just did a small reproducible project to confirm it wasn't any interference with anything else in the main app, and the issue still happens exactly as before. I'm attaching it here so you can try it out, this app uses a demo server with everything ready so there is no configuration needed.

lin.zip

Steps to recreate the issue with the app:

  1. Run the app
  2. The app registers correctly
  3. Click "unregister"
  4. The app unregisters the account, but if you check the .linphonerc file the account is still present
  5. Pressing "register" again shows in the logs that the account list is not empty, meaning the account was still stored in the config

I was not able to try it out with the linphone app from the Play Store yet, will try it when possible.

Viish commented 6 months ago

Thanks, I'll take a look at it asap.

ParticleCore commented 6 months ago

Hi @ParticleCore,

There is obviously something "wrong" (in the sense that it does something differently than we do) in the way you use our SDK, or there is a serious issue with your device. Can you confirm the issue doesn't happen with our app from the Play Store?

Cheers,

@Viish I am afraid that I am not able to confirm whether or not the account is correctly removed from the config file using the play store app. I have no access to the package, nor can I find a way to access it via the app. When I delete the account it appears to be removed correctly, but I am unsure if it is using an extra logic behind the scene that causes the original problem to not surface, such as keeping a list of removed accounts in order to ignore any existing account in the config file.

Did you manage to find out what the issue is via the sample app I posted?

Viish commented 6 months ago

Did you manage to find out what the issue is via the sample app I posted?

Sorry but I haven't taken the time to take a look at it yet.

I am unsure if it is using an extra logic behind the scene that causes the original problem to not surface, such as keeping a list of removed accounts in order to ignore any existing account in the config file.

No it doesn't, you check our source code.

I am afraid that I am not able to confirm whether or not the account is correctly removed from the config file using the play store app.

You can "dial" #1234# on the main screen and in the popup that appears, click on View config file.

ParticleCore commented 6 months ago

Thanks, I tried replicating the scenario with the Linphone app and the issue does not occur, the account is correctly removed from the config app even after closing and opening the app before deleting the account.

ParticleCore commented 6 months ago

@Viish I see the tag was removed, did you manage to replicate the issue with the sample app?

Viish commented 6 months ago

Hi,

First of all, in your sample, you have forgotten to add the following before the core.stop() in the unregister process :

val authInfo = account.findAuthInfo()
if (authInfo != null) {
    core.removeAuthInfo(authInfo)
}
core.removeAccount(account)

But even with it, I could reproduce your issue. After the above code was executed, the config file did still has the proxy_config and auth_info information.

The real issue is that you never start the core using core.start(), and for some reason accounts aren't cleaned up from config file if Core isn't started when they are removed.

Cheers,

ParticleCore commented 6 months ago

@Viish yes, I only used bare min in the sample app, I did test with all the suggested methods before and the result was the same, but thank you for letting me know that those steps are required to unregister correctly.

As for the core.start() note, I am afraid I am confused here. The main issue is the account is not being removed correctly from the config at all, are you saying we have to always start the core in order to get the accounts properly removed, despite already having done that process priorly?

Sure, in the sample app I provided I do not have a core.start() in this section here:

image

But the fact is the code only enters in that section because there is still an account in the config when it shouldn't:

image

Also, I definitely do have the core.start() called here:

image

Which is guaranteed to be called for the very first time the account is registered, before the call to unregister it.

Again, I am at a total loss here with your explanation, nothing about it is making sense with what is being observed.

In my head this is what should happen:

  1. Register account
  2. Start core
  3. Unregister account
  4. Stop core
  5. Account is no longer in the config file

Which is not what is happening in step 5. At which point does adding another core.start() step help fix this issue?

ParticleCore commented 6 months ago

In the provided tutorial the core.start() is being used in the same way as I am using it, at the end of the account creation and all the parameters: https://gitlab.linphone.org/BC/public/tutorials/-/blob/master/android/kotlin/1-AccountLogin/app/src/main/java/org/linphone/accountlogin/AccountLoginActivity.kt

The only difference is in the unregister section it is not using core.stop(), is that what is causing the problem? Then what would be the point of having that method, or why should it cause this problem to begin with by design?

Viish commented 6 months ago

I simply added it.start() inside

getFactory()?.createCoreWithConfig(config, appContext)?.apply {
    isKeepAliveEnabled = false
    isLimeX3DhEnabled = false
}?.also { _core = it
    it.start()
}
Viish commented 6 months ago

I've opened a ticket on our internal bugtracker for our SDK team to check whether this can be fixed or if it is normal, then to improve the documentation about it.

ParticleCore commented 6 months ago

I simply added it.start() inside

getFactory()?.createCoreWithConfig(config, appContext)?.apply {
    isKeepAliveEnabled = false
    isLimeX3DhEnabled = false
}?.also { _core = it
    it.start()
}

Thank you, this time it is working. So the core must always be started no matter what, and since there is no available feedback to check if it is already started (ex; core.isStarted) it must be started every time we need to invoke it, which makes me concerned with any consequences of calling core.start() multiple times on an already started core.

Still, I believe the biggest issue is the account not actually being removed from the config file when we request it to be removed: image

To me, the expectation is to remove the account from both the core and config when we use core.removeAccount(...) which is definitely not doing. Hopefully that behavior will be changed to do just that!

Thanks for the big help with this one.

Viish commented 6 months ago

You can check if core is started by looking at it's global state (https://download.linphone.org/releases/docs/liblinphone/latest/java/org/linphone/core/GlobalState.html). If it's On then it is started, if it is Ready it means Core was created and is waiting to be started. Startup means core is starting but not yet On.

You can intercept those states in https://download.linphone.org/releases/docs/liblinphone/latest/java/org/linphone/core/CoreListener.html#onGlobalStateChanged(org.linphone.core.Core,org.linphone.core.GlobalState,java.lang.String)