We are initiating a call from application(non voip app) by passing a tel url with phone number to document.location.href in javascript.
We are trying to implement a cordova plugin to get the call states once the call is completed.
In android we are using PhoneStateListener to achieve this
Do we have a simiar service in ios? I tried using the CXCallObserver as below
added property:
@property ( nonatomic ) CXCallObserver *callObserver;
In pluginInitialize added,
CXCallObserver *callObserver = [[CXCallObserver alloc] init];
[callObserver setDelegate:self queue:nil];
self.callObserver = callObserver;
and added the below method
(void)callObserver:(CXCallObserver *)callObserver callChanged:(CXCall *)call {
NSString* callstatus = @"Call Changed";
if (call == nil || call.hasEnded == YES) {
NSLog(@"CXCallState : Disconnected");
callstatus = @"Call Disconnected";
}
if (call.isOutgoing == YES && call.hasConnected == NO) {
NSLog(@"CXCallState : Dialing");
callstatus = @"Call Dialing";
}
if (call.isOutgoing == NO && call.hasConnected == NO && call.hasEnded == NO && call != nil) {
NSLog(@"CXCallState : Incoming");
callstatus = @"Call Incoming";
}
if (call.hasConnected == YES && call.hasEnded == NO) {
NSLog(@"CXCallState : Connected");
callstatus = @"Call Connected";
}
}
But callObserver method is not getting invoked when call state changes.
I am very new to ios. Is there anything I am missing to add? Can someone help to resolve this issue?
Issue was with logging using our framework. We are now able to see the call states using the above implementation