Taracque / ionic-plugin-callkit

Ionic/Cordova plugin for CallKit
36 stars 20 forks source link

Invoking reportIncomingCall is multiple stopAudio responses #1

Closed stormbkk87 closed 7 years ago

stormbkk87 commented 7 years ago

Hi there. I'm getting only "stopAudio" responses when calling reportIncomingCall. Am I missing something? Success function is called and has a UUID.

this.callKit.reportIncomingCall("Testing this", false, function(uuid){
  console.log("iOS Incoming call: "+uuid);

  that.callKitUUID = uuid;
});
Taracque commented 7 years ago

Do you registered the audioChange function with callKit.register?

stormbkk87 commented 7 years ago

Yes, here's a code snippet. This code is called on "deviceready" event.

srixUC.prototype.registerVoipPush = function(){

  var VoipPush = cordova.plugins.voippush.init();

  VoipPush.on("registration", this.onPushRegister);
  VoipPush.on("notification", this.onPushNotification);

  var that = this;

  this.callKit = new CallKit();

  Meteor.setTimeout(function(){
    that.callKit.register(that.onCallChanged, that.onAudioSystem);
  }, 100);
};

srixUC.prototype.onCallChanged = function(data){
  console.log("onCallChanged: "+JSON.stringify(data));
};

srixUC.prototype.onAudioSystem = function(data){
  console.log("onAudioSystem: "+JSON.stringify(data));
};
stormbkk87 commented 7 years ago

Debug log in XCode looks to be notifying. I'm testing with the app activated, does CallKit not activate the incoming call screen if the app is activated?

Provider did reset
RECEIVED AUDIO NOTIFICATION: NSConcreteNotification 0x6080002421c0 {name = CDVCallKitAudioNotification; object = stopAudio}
RECEIVED AUDIO NOTIFICATION: NSConcreteNotification 0x6080002421c0 {name = CDVCallKitAudioNotification; object = stopAudio}
RECEIVED AUDIO NOTIFICATION: NSConcreteNotification 0x6080002421c0 {name = CDVCallKitAudioNotification; object = stopAudio}
RECEIVED AUDIO NOTIFICATION: NSConcreteNotification 0x6080002421c0 {name = CDVCallKitAudioNotification; object = stopAudio}
RECEIVED AUDIO NOTIFICATION: NSConcreteNotification 0x6080002421c0 {name = CDVCallKitAudioNotification; object = stopAudio}
RECEIVED AUDIO NOTIFICATION: NSConcreteNotification 0x6080002421c0 {name = CDVCallKitAudioNotification; object = stopAudio}
RECEIVED AUDIO NOTIFICATION: NSConcreteNotification 0x6080002421c0 {name = CDVCallKitAudioNotification; object = stopAudio}
RECEIVED AUDIO NOTIFICATION: NSConcreteNotification 0x6080002421c0 {name = CDVCallKitAudioNotification; object = stopAudio}
RECEIVED CALL CHANGED NOTIFICATION: NSConcreteNotification 0x608000246a20 {name = CDVCallKitCallsChangedNotification; object = <SrixM1.CDVCallManager: 0x600000424dc0>}
RECEIVED CALL CHANGED NOTIFICATION: NSConcreteNotification 0x608000246a20 {name = CDVCallKitCallsChangedNotification; object = <SrixM1.CDVCallManager: 0x600000424dc0>}
RECEIVED CALL CHANGED NOTIFICATION: NSConcreteNotification 0x608000246a20 {name = CDVCallKitCallsChangedNotification; object = <SrixM1.CDVCallManager: 0x600000424dc0>}
RECEIVED CALL CHANGED NOTIFICATION: NSConcreteNotification 0x608000246a20 {name = CDVCallKitCallsChangedNotification; object = <SrixM1.CDVCallManager: 0x600000424dc0>}
RECEIVED CALL CHANGED NOTIFICATION: NSConcreteNotification 0x608000246a20 {name = CDVCallKitCallsChangedNotification; object = <SrixM1.CDVCallManager: 0x600000424dc0>}
RECEIVED CALL CHANGED NOTIFICATION: NSConcreteNotification 0x608000246a20 {name = CDVCallKitCallsChangedNotification; object = <SrixM1.CDVCallManager: 0x600000424dc0>}
RECEIVED CALL CHANGED NOTIFICATION: NSConcreteNotification 0x608000246a20 {name = CDVCallKitCallsChangedNotification; object = <SrixM1.CDVCallManager: 0x600000424dc0>}
RECEIVED CALL CHANGED NOTIFICATION: NSConcreteNotification 0x608000246a20 {name = CDVCallKitCallsChangedNotification; object = <SrixM1.CDVCallManager: 0x600000424dc0>}
Taracque commented 7 years ago

Once you got the Success callback on reportIncomingCall you should intialize AVAudioSession but don't set it to active. Apple docs says that you need only do this once you got the configureAudio callback, but this seems bugy: http://www.openradar.me/27674736 CallKit should display the call screen even if the app is on foreground.

stormbkk87 commented 7 years ago

Ok thanks I'll give that a try and report back. I'm using the iosrtc Cordova plugin.

stormbkk87 commented 7 years ago

Well, nothing seems to work on the Simulator, even the SpeakerBox example app. Can you even call it a Simulator if it doesn't simulate certain things. ;)

Works fine on a device. Thanks for the well organized plugin. :)