WebsiteBeaver / CordovaCall

Cordova CallKit & ConnectionService plugin for iOS/Android that displays the native call UI for VOIP apps
MIT License
196 stars 91 forks source link

Events don't trigger to me #105

Open numerized opened 4 years ago

numerized commented 4 years ago

Hello, amazing plugin but I have to face two problems. So far the one that really annoys me is that I cannot catch any event with this code:

I'm on IOS 13.6, I tried with different phones but same OS. Is there something I am missing ?

Anyone has been able to catch events on IOS13 ?

Thanks a lot


 document.addEventListener(
      "deviceready",
      () => {

       cordova.plugins.CordovaCall.on("receiveCall", () => {
          console.log("has received an incoming call");
          this.event = `${this.uid} ${this.nickname} has received an incoming call`;
        });

})
numerized commented 3 years ago

now I get it! Because I use another 2 audio plugin IOSRTC and cordova-plugin media. I had to change in CordovaCall.m the setupAudioSession

- (void)setupAudioSession
{
    @try {
      AVAudioSession *sessionInstance = [AVAudioSession sharedInstance];
        [sessionInstance setCategory:AVAudioSessionCategoryPlayAndRecord
        withOptions:AVAudioSessionCategoryOptionMixWithOthers |
         AVAudioSessionCategoryOptionDefaultToSpeaker error:nil];
      [sessionInstance setMode:AVAudioSessionModeVoiceChat error:nil];
      NSTimeInterval bufferDuration = .005;
      [sessionInstance setPreferredIOBufferDuration:bufferDuration error:nil];
      [sessionInstance setPreferredSampleRate:44100 error:nil];
      NSLog(@"Configuring Audio");
    }
    @catch (NSException *exception) {
       NSLog(@"Unknown error returned from setupAudioSession");
    }
    return;
}
toriqo commented 3 years ago

what does the audio session has to do with the events?

numerized commented 3 years ago

it just was crashing the whole thing because I use other plugins which needs to access the audio session and this one takes control over it, any press on speaker or mute is accessing the audio session.

toriqo commented 3 years ago

but you were talking about the events in the first post on this issue, you weren't able to catch them...

numerized commented 3 years ago

Yes, because the plugin was crashing somehow. as soon as I pressed a button from the standby screen

toriqo commented 3 years ago

weird... for me it's not crashing but i get this message:

[Application] -[AppDelegate application:continueUserActivity:restorationHandler:] <NSUserActivity: 0x281c02440> has an interaction attached but it is not handled

when i click a call in recents. that should be the sendCall event

toriqo commented 3 years ago

the method receiveCallFromRecents: in CordovaCall.m doesn't seem to broadcast anything to cordova in order to emit an event back to javascript...

numerized commented 3 years ago

yeah this thing is not super reliable, there's a fork available with a bit more maintenance.

toriqo commented 3 years ago

where? :) currently there are 65... :)

toriqo commented 3 years ago

yeah, so after debugging a little bit i found out why the events aren't working. turns out there's a conflict (in my case with the deeplinks plugin) both using the same delegate method - (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler

i'll swizzle the method in cordova call's delegate so i can have both

numerized commented 3 years ago

Wow I'm very interested about this finding. Can you send me the link of your fork ?

We can try to check other forks that implements that maybe

On Tue, 20 Oct 2020 at 17:12, Flavius Andrei notifications@github.com wrote:

yeah, so after debugging a little bit i found out why the events aren't working. turns out there's a conflict (in my case with the deeplinks plugin) both using the same delegate method - (BOOL)application:(UIApplication )application continueUserActivity:(NSUserActivity )userActivity restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler

i'll swizzle the method in cordova call's delegate so i can have both

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/WebsiteBeaver/CordovaCall/issues/105#issuecomment-712924539, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABIXLI3GR6FT77SYNVD4PLSLWSEVANCNFSM4PNHNMPQ .

-- Kévin Perrée

Web & App / Full-Stack developer / System Architect

toriqo commented 3 years ago

well, my fork is not for this plugin but for one containing both cordova call and voip pushkit. the delegate i modified could be applied to this plugin alone though.

you can find it here

numerized commented 3 years ago

I need this too :))

That's cool man

On Tue, 20 Oct 2020 at 17:37, Flavius Andrei notifications@github.com wrote:

well, my fork is not for this plugin but for one containing both cordova call and voip pushkit. the delegate i modified could be applied to this plugin alone though.

you can find it here https://github.com/toriqo/cordova-plugin-callkit/blob/master/src/ios/AppDelegateCordovaCall.m

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/WebsiteBeaver/CordovaCall/issues/105#issuecomment-712942339, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABIXLI4KH2HC4SOPD2SOW3SLWVE7ANCNFSM4PNHNMPQ .

-- Kévin Perrée

Web & App / Full-Stack developer / System Architect