Closed holospeed closed 7 years ago
Did you tried it on a simulator or on a real device? CallKit doesn't work on iOS Simulator. Also you should make a new instance of CallKit:
var callUUID = '';
myCallKit = new CallKit();
myCallKit.register( callChanged, audioSystem );
var name = 'John calling';
var params = {
supportsVideo : true,
supportsGroup: false,
supportsUngroup: false,
supportsDTMF: false,
supportsHold: true
};
var onSuccess = function(uuid) {
callUUID = uuid;
console.log('call reported. returned uuid: ' + uuid);
}
myCallKit.reportIncomingCall( name, params, onSuccess );
myCallKit.endCall(callUUID,false);
try something like this:
var callUUID = '';
var myCallKit;
function callChanged(data) {
console.log("onCallChanged: "+JSON.stringify(data));
}
function audioSystem(data) {
console.log("onAudioSystem: "+JSON.stringify(data));
}
function onDeviceReady() {
myCallKit = new CallKit();
myCallKit.register( callChanged, audioSystem );
}
function incomingCall() {
var name = 'John calling';
var params = {
supportsVideo : true,
supportsGroup: false,
supportsUngroup: false,
supportsDTMF: false,
supportsHold: true
};
var onSuccess = function(uuid) {
callUUID = uuid;
console.log('call reported. returned uuid: ' + uuid);
}
myCallKit.reportIncomingCall( name, params, onSuccess );
}
function endCall() {
myCallKit.endCall(callUUID,false);
}
document.addEventListener("deviceready", onDeviceReady, false);
fire incomingCall() and endCall() from a button.
WORKING !!!! thank you so much for your help!!! THANK YOU 👯 👯 👯
Hi! I love to use the plugin in my non ionic project (non angular) for detecting incoming and outgoing calls on iOS. I imported <Cordova/CDV.h> in the myAppName-Bridging-Header.h ( #import <Cordova/CDV.h> ) If I understood well I have to use the following codes in the deviceready listener:
/// Register
CallKit.register(onCallChanged, onAudioSystem);
onCallChanged = function(data){ console.log("onCallChanged: "+JSON.stringify(data)); }; onAudioSystem = function(data){ console.log("onAudioSystem: "+JSON.stringify(data)); };
/// incomeingCall
CallKit.prototype.reportIncomingCall(name,params,onSuccess);
name = function(name){ console.log("name: "+JSON.stringify(name)); }; params = function(params){ console.log("params: "+JSON.stringify(params)); }; onSuccess = function(onSuccess){ console.log("onSuccess: "+JSON.stringify(onSuccess)); };
Did I misunderstand something ? Because from some reason the callback not fired at all :(