twilio / audioswitch

An Android audio management library for real-time communication apps.
Apache License 2.0
160 stars 49 forks source link

Doesn't able to route call to bluetooth in car or bluetooth headset #157

Closed softsan closed 4 months ago

softsan commented 5 months ago

Before filing an issue please check that the issue is not already addressed by the following:

Please ensure that you are not sharing any Personally Identifiable Information(PII) or sensitive account information (API keys, credentials, etc.) when reporting an issue.

Describe the bug So i tried using audio switch with Twilio Voice SDK in my android kotlin app. When incoming call arrived and if my mobile device is connected with Bluetooth (Car or BT headset) i can see the ringing tone but i can't accept call by pressing button on Car bluetooth or BT headset. Also if i accept call from mobile device it just route the call to Mobile earpiece or speaker. it doesn't route the audio to BT. I see some timeout exception in logs. Even after selection of Bluetooth device after few seconds it automatically goes to previous one.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior It should route audio to appropriate BT device

Actual behavior Doesn't route audio to BT device.

Application Logs

E/AS/BluetoothScoJob: Bluetooth sco job timed out
    java.util.concurrent.TimeoutException
        at com.twilio.audioswitch.bluetooth.BluetoothScoJob$BluetoothScoRunnable.run(BluetoothScoJob.kt:56)
        at android.os.Handler.handleCallback(Handler.java:984)
        at android.os.Handler.dispatchMessage(Handler.java:104)
        at android.os.Looper.loopOnce(Looper.java:238)
        at android.os.Looper.loop(Looper.java:357)
        at android.app.ActivityThread.main(ActivityThread.java:8149)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:957)

AudioSwitch Version

Android Device (please complete the following information):

Additional context Add any other context about the problem here.

ocarevs commented 5 months ago

@softsan It appears that the problem you are encountering is Bluetooth headset and android device fail to connect; the error indicates that the Bluetooth SCO attempts have timed out. Unfortunately AudioSwitch library currently does not support a straightforward way to manage this error. #154

afalls-twilio commented 4 months ago

closing due to inactivity

softsan commented 2 months ago

@afalls-twilio I found another issue related to car audio. I am using it with the voice sdk android for my voip calling app. When an incoming call came in, it shows binary number like 1000000 as caller id on car dashboard while on my mobile app it shows correct caller id. so my caller id is like phone number - name. Also when call is ended from app it still ongoing on car bluetooth and it only ends when i force close the app. So any resolution on this?