Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio Not Transmitting to Dialed Number in Twilio Call #180

Closed
hbsciw opened this issue Oct 7, 2023 · 20 comments · Fixed by #185
Closed

Audio Not Transmitting to Dialed Number in Twilio Call #180

hbsciw opened this issue Oct 7, 2023 · 20 comments · Fixed by #185
Assignees
Labels
Android bug Something isn't working help wanted Extra attention is needed next release Feature in development / Available in next release

Comments

@hbsciw
Copy link

hbsciw commented Oct 7, 2023

Issue Summary

I'm experiencing an issue with the sound not being transferred from the source (client) to the destination (dialed number) when implementing a Twilio call. After the client calls the Twilio number and Twilio dials the number, the two parties are connected, but the sound from the source is not audible at the destination. This is unexpected behavior as the audio should be transmitted seamlessly between both connected numbers.

Steps to Reproduce

  1. Implement a Twilio call where the client calls a Twilio number.
  2. Program Twilio to dial another number upon receiving a call.
  3. Connect the source and destination.

Expected Behavior: The sound from the source should be transmitted and heard at the destination without issues.

Actual Behavior: The source and destination are connected, but the sound from the source is not reaching the destination, resulting in a one-way audio issue.

@cybex-dev cybex-dev self-assigned this Oct 7, 2023
@cybex-dev
Copy link
Owner

Hi @hbsciw

Thanks for opening the issue - I'm investigating this issue at the moment. Additional information would be helpful.

On which Android SDK/OS versions do you experience this issue?

@cybex-dev cybex-dev added bug Something isn't working Android labels Oct 7, 2023
@hbsciw
Copy link
Author

hbsciw commented Oct 7, 2023

Hi @cybex-dev
Thank you for your response

Android version 13
Device Galaxy A51
twilio_voice SDK v0.1.0

@cybex-dev
Copy link
Owner

@hbsciw wonderful, to confirm caller and recipient are both Android +13?

@hbsciw
Copy link
Author

hbsciw commented Oct 7, 2023

Caller is android 13, for recipient i test with different devices such as android 13, android 12, ...

For your information the recipient is not app or sdk. recipient is phone number.

@hbsciw
Copy link
Author

hbsciw commented Oct 7, 2023

@cybex-dev Is there a way to revert to a previous version until the issue is resolved?

@cybex-dev
Copy link
Owner

Caller is android 13, for recipient i test with different devices such as android 13, android 12, ...

For your information the recipient is not app or sdk. recipient is phone number.

Thanks for the info.

@cybex-dev
Copy link
Owner

@cybex-dev Is there a way to revert to a previous version until the issue is resolved?

The only alternative is reverting back to 0.0.9 - though keep in mind there are many additional fixes, etc in the latest version.

We have several clients affected by this issue and am actively investigating the cause.

@hbsciw
Copy link
Author

hbsciw commented Oct 7, 2023

@cybex-dev Is there a way to revert to a previous version until the issue is resolved?

The only alternative is reverting back to 0.0.9 - though keep in mind there are many additional fixes, etc in the latest version.

We have several clients affected by this issue and am actively investigating the cause.

Than you.

Could you give me the branch or the commit relates to this version?

@hbsciw
Copy link
Author

hbsciw commented Oct 7, 2023

@cybex-dev Is there a way to revert to a previous version until the issue is resolved?

The only alternative is reverting back to 0.0.9 - though keep in mind there are many additional fixes, etc in the latest version.

We have several clients affected by this issue and am actively investigating the cause.

Thank you for your valuable contribution

@ardeshir-33033
Copy link

Same issue here, hope its gonna fixed soon.
we have many angry clients.

@ardeshir-33033
Copy link

@cybex-dev is there anything you can point us to so we might be able to help you.

@cybex-dev
Copy link
Owner

@ardeshir-33033 @hbsciw

@cybex-dev is there anything you can point us to so we might be able to help you.

Thank you for offering, what would be helpful is to understand what's happening in the background when this issue occurs.

If you could provide Android log outputs (via logcat) when placing the call until it is answered. This would assist in tracking down the issue faster.

@cybex-dev
Copy link
Owner

1 2 3

4

Thanks for the screenshots, but it doesn't help that much.

Could you copy/paste from logcat instead when you experienced this issue - would help alot, thanks.

@cybex-dev
Copy link
Owner

I've revised the required implementation for Android +13, to my knowledge all required functionality has been implemented. A change brought along with Android 14 is Foreground Service Types which has been implemented, however this issue remains.

I've been able to replicate this issue using:

  • Twilio Voice web client
  • Android 14 Google API 34 x86_64 emulator (API 33 and lower all appear to work as expected)

For the record, I've opened an issue on Android 14 QPR, I hope to have some feedback soon to resolve this issue. https://issuetracker.google.com/issues/304335430

@mohsen-jalali
Copy link

I faced this issue as well, I tried with different type of devices but could not be able to receive caller audio from callee.
@cybex-dev

@cybex-dev
Copy link
Owner

Hi @mohsen-jalali, thanks for the report.

I've been able to consistently reproduce this issue, I'd like to ask everyone who has experienced this issue to assist in testing this scenario:

Please grab the latest version twilio_voice/tree/fix_android_14_microphone_audio, then replicate with the following actions:

  • Microphone single direction only (inbound)

This will simulate a user installing the app from Play Store and placing an outbound call. Observe audio output from the calling device, but no mic input on call recipient.

  1. Fresh install example app (use your own app), ensure you use proper/valid Twilio credentials
  2. Call FROM device (with app installed)
  3. Observe audio output (i.e. mic input from recipient) is heard on device.
  4. Observe microphone input from caller does NOT work

Note - this is 100% reproducible on first call, but further on it occurs intermittently regardless of caller.

  • Microphone works bi-directional

This will simulate a user installing the app from Play Store and receiving an "introductory" first call call. Observe audio output from the calling device AND mic input on call recipient.

  1. Fresh install example app (use your own app), ensure you use proper/valid Twilio credentials
  2. Call TO device (with app installed)
  3. Observe audio output (i.e. mic input from recipient) is heard on device.
  4. Observe microphone input from caller works.

Note - this seems to be more reliable, however the same issue is faced with microphone input working intermittently.


Please contribute to the bug tracker link, reposted here - it will help draw attention to this issue.
https://issuetracker.google.com/issues/304335430

@cybex-dev cybex-dev added the help wanted Extra attention is needed label Oct 11, 2023
@mohsen-jalali
Copy link

mohsen-jalali commented Oct 14, 2023

I found the solution, the issue was because of not starting foreground service on outgoing calls.
I created a pull request for it and fixed it.
#181
@cybex-dev

mohsen-jalali added a commit to mohsen-jalali/twilio_voice that referenced this issue Oct 14, 2023
…_service

fix: Fix cybex-dev#180 Audio Not Transmitting to Dialed Number in Twilio Call
@cybex-dev
Copy link
Owner

I found the solution, the issue was because of not starting foreground service on outgoing calls. I created a pull request for it and fixed it. #181 @cybex-dev

Absolutely amazing - that would explain the Op codes error. I'll review, merge and push latest update today. Many thanks @mohsen-jalali!

@cybex-dev
Copy link
Owner

@mohsen-jalali initial testing on Google API 34 emulator (the only platform I can reliably and consistently reproduce this issue), does not seem to resolve this no microphone on outgoing calls.

2023-10-14 12:25:12.050   416-432   PermissionCache         audioserver                          D  checking android.permission.CALL_AUDIO_INTERCEPTION for uid=10204 => denied (599 us)
2023-10-14 12:25:12.056   416-6318  AudioFlinger            audioserver                          I  AudioFlinger's thread 0x77d19e0d4bb0 tid=6318 ready to run
2023-10-14 12:25:12.062   416-432   AudioPolicyService      audioserver                          I  App op 27 missing, silencing record AttributionSourceState{pid: 6050, uid: 10204, packageName: com.twilio.twilio_voice_example, attributionTag: (null), token: binder:0x77d0d1caf660, renouncedPermissions: [], next: []}
2023-10-14 12:25:12.065  6050-6253  tvo.webrtc.Logging      com.twilio.twilio_voice_example      I  WebRtcAudioEffectsExternal: enable(audioSession=257)
2023-10-14 12:25:12.065  6050-6253  tvo.webrtc.Logging      com.twilio.twilio_voice_example      I  WebRtcAudioRecordExternal: AudioRecord: session ID: 257, channels: 1, sample rate: 48000
2023-10-14 12:25:12.066  6050-6253  tvo.webrtc.Logging      com.twilio.twilio_voice_example      I  WebRtcAudioRecordExternal: AudioRecord: buffer size in frames: 2880
2023-10-14 12:25:12.067  6050-6253  tvo.webrtc.Logging      com.twilio.twilio_voice_example      I  WebRtcAudioRecordExternal: Number of active recording sessions: 0
2023-10-14 12:25:12.068  6050-6253  tvo.webrtc.Logging      com.twilio.twilio_voice_example      I  WebRtcAudioRecordExternal: startRecording
2023-10-14 12:25:12.071   585-1409  AppOps                  system_server                        E  Operation not started: uid=10204 pkg=com.twilio.twilio_voice_example(null) op=RECORD_AUDIO
2023-10-14 12:25:12.075   416-6318  audioserver             audioserver                          D  FGS Logger Transaction failed
2023-10-14 12:25:12.075   416-6318  audioserver             audioserver                          D  -129
2023-10-14 12:25:12.075   416-6318  audioserver             audioserver                          D  FGS Logger Transaction failed
2023-10-14 12:25:12.076   416-6318  audioserver             audioserver                          D  -129

This should resolve microphone access issues for prior Android 13 devices - will merge but we're not out of the water yet.

cybex-dev added a commit that referenced this issue Oct 14, 2023
…nd_service

Fix #180 Audio Not Transmitting to Dialed Number in Twilio Call
@cybex-dev cybex-dev added the next release Feature in development / Available in next release label Oct 14, 2023
@cybex-dev
Copy link
Owner

Re-opening issue for Android 14.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Android bug Something isn't working help wanted Extra attention is needed next release Feature in development / Available in next release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants