BelledonneCommunications / linphone-sdk

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

Ice not working on incoming calls #413

Open lazydev2 opened 1 month ago

lazydev2 commented 1 month ago

Hello. I am trying to use linphone with enabled ice. If i make a call from linphoen app, then ice attributes are present in SDP data.

But if the app received a call, it answers with no ICE attributes. There is not much information in logs:

$ grep " ICE " 6698cf865e936_d1658f4107263b48f310
2024-07-18 11:16:49:406 [comm.preo.linphone/liblinphone] MESSAGE ICE state is IceStateNotActivated for stream#0 [audio] in state [Stopped]
2024-07-18 11:16:51:589 [comm.preo.linphone/liblinphone] MESSAGE Checking for ICE reINVITE
2024-07-18 11:16:51:598 [comm.preo.linphone/liblinphone] MESSAGE ICE state is IceStateNotActivated for stream#0 [audio] in state [Running]
$

(full logs available here)

So I need help to solve the prooblem. I am not sure it is a bug, but there are no more suitable issue types.

linphone versions is 5.2, built manually from git commit 0206753d78847402b4ab0d0014337ada6e0a7b23

Viish commented 1 month ago

Hi @lazydev2,

There's been a fix for that in our SDK recently: https://gitlab.linphone.org/BC/public/linphone-sdk/-/commit/663b566f07083008f1ed0e672baaeee8edf2bda8 You should try it out.

Cheers,

lazydev2 commented 1 month ago

Could you please give more details how to use custom-build sdk? I [think I] successfully bult the SDK using instructions in README.md, and in order to use it, I put

LinphoneSdkBuildDir=path_to_sdk/build-android

in ~/.gradle/gradle.properties AND in linphone-android_5.2/gradle.properties (linphone-android_5.2 is the directory containing source files).

However, according to gradle, SDK from repository is still used:

linphone-android_5.2$ ANDROID_HOME=path_to_android_sdk ./gradlew assembleRelease

> Configure project :app
Git version: 5.2.5.1+0206753d7 (52005)
WARNING: BuildType(releaseWithCrashlytics): resValue 'bool/crashlytics_enabled' value is being replaced.

> Task :app:linphoneSdkSource
Linphone SDK used is 5.3.73-pre.1+809988a8 from linphone.org maven repository

what I did wrong and what I need to do to compile linphone-android with my custom-built sdk?

Viish commented 1 month ago

Could you please give more details how to use custom-build sdk?

Fix has been made in master branch, which means the SDK built has a 5.40-alpha version number. You need to change the implementation line in app/build.gradle so it requires a 5.4+ SDK instead of a 5.3+. You should also edit the settings.gradle file and comment out our online maven repository to make sure it uses the local one, as it always pick the most recent SDK based on version number and that may not be the one you built.

lazydev2 commented 1 month ago

Thanks for the reply, however, I still cannot do it :(

You need to change the implementation line in app/build.gradle so it requires a 5.4+ SDK instead of a 5.3+.

I changed implementation 'org.linphone:linphone-sdk-android:5.3+' to implementation 'org.linphone:linphone-sdk-android:5.4+'

Is it correct?

You should also edit the settings.gradle file and comment out our online maven repository to make sure it uses the local one, as it always pick the most recent SDK based on version number and that may not be the one you built.

I commented this section:

/*
maven {
    name "linphone.org maven repository"
    url "https://linphone.org/maven_repository"
    content {
        includeGroup "org.linphone"
    }
}
*/

Now my local sdk is used:

inphone-android_5.2$ ANDROID_HOME=<path to android sdk> ./gradlew assembleRelease

> Configure project :app
Git version: 5.2.5.1+0206753d7 (52005)
WARNING: BuildType(releaseWithCrashlytics): resValue 'bool/crashlytics_enabled' value is being replaced.

> Task :app:linphoneSdkSource
Linphone SDK used is 5.4.0-alpha.297+5459708b from local linphone-sdk maven repository

But compilation fails:

> Task :app:kaptReleaseKotlin
warning: ERROR: View field icon collides with a variable or import file://app/src/main/res/layout/settings_widget_basic.xml Line:29
warning: ERROR: View field dialogMessage collides with a variable or import file://app/src/main/res/layout/voip_dialog_info.xml Line:33

> Task :app:compileReleaseKotlin
e: file://<...>/linphone-android_5.2/app/src/main/java/org/linphone/activities/voip/viewmodels/ConferenceViewModel.kt:562:13 Type mismatch: inferred type is Address? but Address was expected
e: file://<...>/linphone-android_5.2/app/src/main/java/org/linphone/activities/voip/viewmodels/ConferenceViewModel.kt:672:13 Type mismatch: inferred type is Address? but Address was expected
e: file://<...>/linphone-android_5.2/app/src/main/java/org/linphone/utils/LinphoneUtils.kt:97:21 Type mismatch: inferred type is Address? but Address was expected

> Task :app:compileReleaseKotlin FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileReleaseKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
   > Compilation error. See log for more details

(I am trying to use fresh sdk with release 5.2, is that setup even can be built correctly?). I am not a java/kotlin programmer, so I need help again.

Viish commented 1 month ago

Yes there have been a few API changes between 5.3 and 5.4 SDK and release/5.2 branch isn't made for it.

You can switch to master branch commit ID 4624d2698d2051662350e2a857aac43d6fe27d01 that is basically the same as release/5.2 but will build with 5.4 SDK.

lazydev2 commented 1 month ago

No success :(

warning: ERROR: View field icon collides with a variable or import file://app/src/main/res/layout/settings_widget_basic.xml Line:29
warning: ERROR: View field dialogMessage collides with a variable or import file://app/src/main/res/layout/voip_dialog_info.xml Line:33

> Task :app:compileReleaseKotlin FAILED
e: file://<...>/linphone-android/app/src/main/java/org/linphone/activities/voip/viewmodels/ConferenceViewModel.kt:542:13 Type mismatch: inferred type is Address? but Address was expected
e: file://<...>/linphone-android/app/src/main/java/org/linphone/core/CoreService.kt:85:5 'showForegroundServiceNotification' overrides nothing
e: file://<...>/linphone-android/app/src/main/java/org/linphone/utils/LinphoneUtils.kt:97:21 Type mismatch: inferred type is Address? but Address was expected

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileReleaseKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
   > Compilation error. See log for more details

sdk was built from rev. 5459708b4c4b7db3ae544c4427587093698eeb6f, if that matters

Viish commented 1 month ago

Hi @lazydev2,

My bad, I gave you the wrong commit id. Try with 852e78c5a66debc515b3c7b88d3609c0b8b46ee7 (I just did it and it built just fine).

Cheers,

lazydev2 commented 1 month ago

Thanks for help. With rev 852e78c5a66debc515b3c7b88d3609c0b8b46ee7 it compiles and runs, but still no ICE fields in SIP OK message

logs: https://www.linphone.org:444//tmp/669ff1f025784_ccd149d92f5ce0d15711.gz

harut420 commented 1 month ago

this is why also call-conference does not get any audio before cliccking on video button.

lazydev2 commented 1 month ago

Its a pity that this promising project has gazzilion issues in the tracker, and no one from belledonne tries to fix them.

However, for this particular bug I was able to track a cause.

It is linphone_call_new_incoming function from sdk. It does not accept account in its parameters (as, for example, linphone_call_new_outgoing do), so the account information is not passed into instantiating Call object.

Which, in turn, cannot pass account into MediaSession::configure, which, in turn, cannot save ICE settings for later usage.

And later, when ICE settings are needed, they are not used, so ICE not works.