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

Sender audio stream not work when accept call on answer for android #93

Open
hatinfotech opened this issue Jan 17, 2020 · 11 comments
Open

Comments

@hatinfotech
Copy link

Hi team !
I had a problem on android

I try this code then audio stream was stoped (caller not receive audio)

// Show call receive notification
cordova.plugins.CordovaCall.receiveCall("David Marcus");

// Listen answer event then accept call
cordova.plugins.CordovaCall.on("answer", function() {
     // Accept call
      session.accept();
});

But try code below audio working normal, call endCall function before accept call

// Show call receive notification
cordova.plugins.CordovaCall.receiveCall("David Marcus");

// Listen answer event then end call screen and then accept call
cordova.plugins.CordovaCall.on("answer", function() {
     // End call screen after answer
      cordova.plugins.CordovaCall.endCall();

     // Accept call
      session.accept();
});

I think plugin CordovaCall occupied audio stream so app can not send audio.

Please help me !

@mattkhaw
Copy link

Please post more details on this. It is pretty vague from what you have described. Are you making an app with VOIP functionality?

@Qvadis
Copy link

Qvadis commented Jun 15, 2020

Hi,

did you find a solution for this already? We have the same issue. When we call receiveCall, the microphone doesn't work (or at least, the caller does not receive any sound from the called.

It only happens in some androids, not all.

Cheers.

@mattkhaw
Copy link

I think it's best to list down the devices that you've tested with this issue. There's tons of Android devices out there and the creator might not have the device that has issues like this. I also wish to know more before I encounter this issue. Are you sure the problem is from this plugin?

@Qvadis
Copy link

Qvadis commented Jun 16, 2020

Hi, you are totally right.
The devices I tested and ain't worked:

  • OnePlus 6T
  • Xiaomi MI A2

This is the scenario:

User A calls User B (OnePlus 6T or Xiaomi MI A2).

User B receives an incoming call through JSSIP and I call the cordova call receiveCall method. It starts ringing.

The user b can either pick up in the app and in the plugin notification. There's no diference. When it picks the call up, it triggers the method that calls "connectCall". The call is established but I hear nothing on the user A end.

If I hang up from the plugin but I don't call the methods to finish the call in jssip, then the UI of the plugin disappears but I'm able to speak normally! User A can finally hear User B.

It is like if the plugin takes over the audio input channel and if we get ride of it, we can use it again.

Any thoughts?

@mattkhaw
Copy link

Just one small question, where is the connectCall function being called? Caller or callee?

@Qvadis
Copy link

Qvadis commented Jun 16, 2020

The callee. So it receives the incoming call -> CordovaCall executes receive call -> Answers -> Cordova call - Connect Call

@mattkhaw
Copy link

Forgot to include this question, when did you call connectCall? Before you invoke answer in JsSIP or after? If it is before, then it should be incorrect. I think the correct way is to call the answer function in JsSIP first then only connectCall. Without looking your code, it's pretty difficult to guess. But the main idea is, only use CordovaCall to handle all the native UI and use JsSIP to handle everything else. I think it is just the function call order is incorrect here.

@Qvadis
Copy link

Qvadis commented Jun 16, 2020

Yes, it triggers the connect call only when the JSSIP session is established.

I'll look further in the code, because this may be caused on my end. I'll try to downgrade and see if it worked some versions ago.

I'll keep you updated with my findings :) Thank you for your time!

@mattkhaw
Copy link

Sure. Keep us posted. I apologise in the lack of knowledge in JsSIP but the underlying concept should be similar.

@Qvadis
Copy link

Qvadis commented Jun 18, 2020

Hi!

I solved it. I don't know what the problem was, but sending the audio output to the earpiece with the AudioToggle plugin solved it.

@mattkhaw
Copy link

@Qvadis I see. I think it might be the default output is not specified. I've seen WebRTC has a function to toggle the audio stream, either to speaker or to earpiece. Maybe it is a good idea to explicitly specify the default output. I'm glad you solved this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants