0

I am using linephone library to call trough app. I have integrated everything using the example code given here

My issue is Case 1 - if i call on some number and if it plays some sound like- number is not available right now and so on.... (EarlyMedia case) and disconnected.

Case2 - Now if i call on proper working number. Other phone get phone call and if other phone receives the call then some music tone will play. Actual sound will not come on both the side.( EarlyMedia-> Connected- > StreamsRunning->paused) this callback flow is calling.

Note: Both case need to execute one by one. If app kills and restart then everything work fine.

Case 1 Callback flow (OutgoingInit->OutgoingProgress->OutgoingEarlyMedia->End)

Case 2 Callback flow (OutgoingInit->OutgoingProgress->OutgoingEarlyMedia->Connected->StreamsRunning->Pausing->Paused)

Please help me out for How to avoid the call going to paused state after connecting?

I am using org.linphone:linphone-sdk-android:5.1.36 for android.

Thanks in advance

UPDATE: LOGS

Parth
  • 1,908
  • 1
  • 19
  • 37

1 Answers1

1

Your call is paused because your app has lost (temporarily) the audio focus. That is the recommended behavior by google for such scenario, see https://developer.android.com/guide/topics/media-apps/audio-focus for more information about it.

If you don't want linphone-sdk to automatically pause calls when audio focus is lost, you can use the following configuration item:

[audio]
android_pause_calls_when_audio_focus_lost=0

Alternatively you can ask the SDK not to make any audio focus request if you prefer to handle it yourself in your app:

[audio]
android_disable_audio_focus_requests=1

There is a wiki entry about audio focus for Android in linphone-sdk here: https://wiki.linphone.org/xwiki/wiki/public/view/Lib/Getting%20started/Android/#HAudiofocus

Viish
  • 434
  • 4
  • 12
  • thanks for your reply. Let me try this. One more question Any idea why its losing audio focus. Because there is nothing running that acquire audio focus and lost from here. This is new login and new call request( for 2nd call) – Parth Jun 07 '22 at 08:08
  • Sadly no, Android isn't very chatty about this. You might want to check adb logcat logs to see if you see something. – Viish Jun 07 '22 at 09:50
  • is there any way to handle to prevent ongoing call pause while incoming GSM call? – Parth Jun 19 '22 at 11:53
  • [Core Manager] App has lost audio focus, pausing all calls --.> this log i am getting and call is going on pause sate. – Parth Jun 19 '22 at 12:18
  • Yes, use android_pause_calls_when_audio_focus_lost=0 as I explained in my answer above. – Viish Jun 20 '22 at 07:09
  • I got this flag. But i am not aware how to set this flag. i have seen example of linephone sdk. but i didn't found the way to set this flag using android studio code. can you please help me out? ( How to set config or how to use factory rc: i am not using this in my app) – Parth Jun 20 '22 at 07:21
  • Then you can use the followig: core.config.setBool("audio", "android_pause_calls_when_audio_focus_lost", false) – Viish Jun 20 '22 at 09:45
  • Thanks its working. Call is not going on pause state. But incoming call ringtone is playing so can't able to listen voice coming from other side? is that anything i need to do to stop sound of incoming call ringtone while i am in call? – Parth Jun 20 '22 at 10:36
  • Use core.ringDuringIncomingEarlyMedia = false – Viish Jun 20 '22 at 11:18
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/245759/discussion-between-parth-and-viish). – Parth Jun 20 '22 at 12:15