From b469805b2d0c9b23ca020cf9356ff137205f856c Mon Sep 17 00:00:00 2001
From: 464027401@qq.com <464027401@qq.com>
Date: 星期一, 27 九月 2021 10:22:10 +0800
Subject: [PATCH] 修复来点页面重复呼叫时alert位置不对问题
---
HDLLinPhoneSDK(OC)/HDLLinPhoneSDK/HDLLinphoneProviderDelegate.m | 418 +++++++++++++++++-----------------
HDLLinPhoneSDK(OC)/HDLLinPhoneSDK.xcodeproj/project.pbxproj | 2
HDLLinPhoneSDK(OC)/HDLLinPhoneSDK/HDLLinphoneIntercomVC.m | 18 +
HDLLinPhoneSDK(OC)/HDLLinPhoneSDK/HDLLinphoneManager.m | 109 ++++----
HDLLinPhoneSDK(OC)/HDLLinPhoneSDK/HDLLinphoneProviderDelegate.h | 17
HDLLinPhoneSDK(OC)/HDLLinPhoneSDK/HDLLPOnMonitorViewController.m | 14
HDLLinPhoneSDK(OC)/HDLLinPhoneSDK/HDLLinPhoneCommon.h | 2
HDLLinPhoneSDK(OC)/HDLLinPhoneSDK/HDLLinPhoneCommon.m | 31 ++
HDLLinPhoneSDK(OC)/HDLLinPhoneSDK.xcodeproj/xcshareddata/xcschemes/HDLLinPhoneSDK.xcscheme | 2
Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/Library/libHDLLinPhoneSDK.a | 0
HDLLinPhoneSDK(OC)/HDLLinPhoneSDK/HDLLinPhoneSDK.m | 86 ++++++-
11 files changed, 405 insertions(+), 294 deletions(-)
diff --git "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK.xcodeproj/project.pbxproj" "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK.xcodeproj/project.pbxproj"
index 7626b8e..9ee6882 100644
--- "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK.xcodeproj/project.pbxproj"
+++ "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK.xcodeproj/project.pbxproj"
@@ -375,6 +375,7 @@
AE9CC93926B8DD3F00FD514C /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = V39C74NPHU;
ENABLE_BITCODE = NO;
@@ -398,6 +399,7 @@
AE9CC93A26B8DD3F00FD514C /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = V39C74NPHU;
ENABLE_BITCODE = NO;
diff --git "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK.xcodeproj/xcshareddata/xcschemes/HDLLinPhoneSDK.xcscheme" "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK.xcodeproj/xcshareddata/xcschemes/HDLLinPhoneSDK.xcscheme"
index a196c2f..28965b4 100644
--- "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK.xcodeproj/xcshareddata/xcschemes/HDLLinPhoneSDK.xcscheme"
+++ "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK.xcodeproj/xcshareddata/xcschemes/HDLLinPhoneSDK.xcscheme"
@@ -31,7 +31,7 @@
</Testables>
</TestAction>
<LaunchAction
- buildConfiguration = "Debug"
+ buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
diff --git "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLPOnMonitorViewController.m" "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLPOnMonitorViewController.m"
index 0be0912..2e13e73 100644
--- "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLPOnMonitorViewController.m"
+++ "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLPOnMonitorViewController.m"
@@ -10,7 +10,7 @@
#import <Photos/Photos.h>
#import "HDLLinphoneUtlis.h"
#import "HDLLinphoneManager.h"
-
+#import "HDLLinPhoneCommon.h"
//#import "HDLLinPhoneSDK-Swift.h"
//#import "LCUtlis.h"
//#import "LCApiKit.h"
@@ -37,7 +37,7 @@
@property (nonatomic,strong) dispatch_source_t openDoorTimer;
@property (nonatomic, assign) int openDoorTimeout;
-
+@property (nonatomic, assign) BOOL isHangUpByRemote;//鏄惁瀵规柟杩滅▼鎸傛柇
/// 鎾斁鍣�
//@property (nonatomic, strong) LCOpenSDK_PlayWindow *playWindow;
@@ -101,6 +101,7 @@
int state = [[notif.userInfo objectForKey:@"state"] intValue];
if ((state == LinphoneCallEnd || state == LinphoneCallError)){//鎸傛柇浜�
NSLog(@"鎸傛柇鎴栧嚭閿欎簡");
+ self.isHangUpByRemote=YES;
[self showUIAlertViewWithBack:@"鐩戣缁撴潫"];
}
@@ -450,8 +451,9 @@
[alertController addAction:[UIAlertAction actionWithTitle:okStr style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
[self backAction];
}]];
-
[self presentViewController:alertController animated:YES completion:nil];
+// [[HDLLinPhoneCommon rootController] presentViewController:alertController animated:YES completion:nil];
+
}
@@ -469,14 +471,16 @@
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
-
+
}
-(void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
//1.鏆傚仠SDK鐩稿叧鎾斁
- [self stopPlay];
+ if (!self.isHangUpByRemote) {
+ [self stopPlay];
+ }
//2.Delegate閲婃斁
// self.mLCCallDelegate = nil;
//3.瀹氭椂鍣ㄩ噴鏀�
diff --git "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinPhoneCommon.h" "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinPhoneCommon.h"
index 7c54af7..c4cd0a0 100644
--- "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinPhoneCommon.h"
+++ "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinPhoneCommon.h"
@@ -12,6 +12,8 @@
@interface HDLLinPhoneCommon : NSObject
+(UIViewController *) topMostController;//鑾峰彇椤跺眰瑙嗗浘
++(UIViewController *) rootController;//鑾峰彇鏍规帶鍒跺櫒
++(BOOL)rootPresentVCContent:(Class)vcClass;//鍒ゆ柇鎵�鏈塸resent鐨勬帶鍒跺櫒鏄惁鍚湁VC
+(UIWindow*)appWindow;
+(NSString *)temporarySaveImagePath;//涓存椂淇濆瓨鍥剧墖鐨勮矾鍔�
+(void)saveImageToPhotosAlbum:(UIImage *)savedImage;//淇濆瓨鍥剧墖鍒扮浉鍐�
diff --git "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinPhoneCommon.m" "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinPhoneCommon.m"
index d643489..87139e4 100644
--- "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinPhoneCommon.m"
+++ "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinPhoneCommon.m"
@@ -22,6 +22,37 @@
return topController;
}
++(UIViewController *) rootController {
+ UIViewController*topController ;
+ if ([UIApplication sharedApplication].delegate.window) {
+ topController= [UIApplication sharedApplication].delegate.window.rootViewController;
+ }else{
+ topController=[self appWindow].rootViewController;
+ }
+// while(topController.presentedViewController){
+// topController=topController.presentedViewController;
+// }
+ return topController;
+}
+
++(BOOL)rootPresentVCContent:(Class)vcClass{
+ UIViewController*roootVC ;
+ if ([UIApplication sharedApplication].delegate.window) {
+ roootVC= [UIApplication sharedApplication].delegate.window.rootViewController;
+ }else{
+ roootVC=[self appWindow].rootViewController;
+ }
+ while(roootVC.presentedViewController){
+ if ([roootVC.presentedViewController isKindOfClass:vcClass]) {
+ return YES;
+ break;
+ }
+ roootVC=roootVC.presentedViewController;
+ }
+
+ return NO;
+}
+
+(UIWindow*)appWindow{
UIWindow *window;
if (@available(iOS 13.0, *)) {
diff --git "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinPhoneSDK.m" "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinPhoneSDK.m"
index 4befa5a..75db80f 100644
--- "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinPhoneSDK.m"
+++ "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinPhoneSDK.m"
@@ -13,7 +13,7 @@
#import "HDLLPOnMonitorViewController.h"
@interface HDLLinPhoneSDK()
-
+@property (strong, nonatomic) HDLLinphoneIntercomVC* presentingIntercomVC;//褰撳墠灞曠ず鐨勬潵鐐规帶鍒跺櫒锛岀敤浜庡瓨鏀炬鍦ㄥ睍绀虹殑鏉ョ偣鎺у埗鍣紝閬垮厤閲嶅寮瑰嚭鐣岄潰
@end
@implementation HDLLinPhoneSDK
@@ -70,18 +70,19 @@
if (state == LinphoneCallIncomingReceived) {
[self.hdlLinphoneCallDelegate onIncomingCall:userName];
if(self.IsAutoJumpCallView){
-// NSString *callId=[NSString stringWithFormat:@"%@",[notif.userInfo objectForKey:@"callID"]];
-// BOOL hasVideo=(BOOL)[notif.userInfo objectForKey:@"hasVideo"];
+
- HDLLinphoneIntercomVC *vc=[[HDLLinphoneIntercomVC alloc]init];
-// vc.CallId=callId;
- vc.hasVideo=YES;
- vc.hdlLinphoneCallDelegate=self.hdlLinphoneCallDelegate;
- vc.modalPresentationStyle = UIModalPresentationFullScreen;
-// self.IntercomVC=vc;
- [[HDLLinPhoneCommon topMostController] presentViewController:vc animated:YES completion:^{
+// HDLLinphoneIntercomVC *vc=[[HDLLinphoneIntercomVC alloc]init];
+//// vc.CallId=callId;
+// vc.hasVideo=YES;
+// vc.hdlLinphoneCallDelegate=self.hdlLinphoneCallDelegate;
+// vc.modalPresentationStyle = UIModalPresentationFullScreen;
+//// self.IntercomVC=vc;
+// [[HDLLinPhoneCommon topMostController] presentViewController:vc animated:YES completion:^{
+//
+// }];
- }];
+ [self gotoHDLLinphoneIntercomVC:nil];
}
}
}
@@ -114,16 +115,73 @@
// NSString *callId=[NSString stringWithFormat:@"%@",[notif.userInfo objectForKey:@"callID"]];
// BOOL hasVideo=(BOOL)[notif.userInfo objectForKey:@"hasVideo"];
+// NSLog(@"椤跺眰瑙嗗浘锛�%@",[HDLLinPhoneCommon topMostController]);
+
+ if ([HDLLinPhoneCommon rootPresentVCContent:[HDLLinphoneIntercomVC class]]||[HDLLinPhoneCommon rootPresentVCContent:[HDLLPOnMonitorViewController class]]) {
+ if ([[HDLLinPhoneCommon topMostController] isKindOfClass:[UIAlertController class]]) {
+ NSLog(@"椤跺眰瑙嗗浘鏄棰戦�氳瘽椤�");
+ __weak typeof(self) weakSelf = self;
+
+ [[HDLLinPhoneCommon topMostController] dismissViewControllerAnimated:NO completion:^{
+ UIViewController *topVC=[HDLLinPhoneCommon topMostController];
+ if ([topVC isKindOfClass:[HDLLPOnMonitorViewController class]]) {
+ [topVC dismissViewControllerAnimated:NO completion:^{
+ [weakSelf toLinphoneIntercomVC:titleName];
+ }];
+ }else if ([topVC isKindOfClass:[HDLLinphoneIntercomVC class]]) {
+ [topVC dismissViewControllerAnimated:NO completion:^{
+ [weakSelf toLinphoneIntercomVC:titleName];
+ }];
+ }
+ }];
+ }
+// UIViewController *topVC=[HDLLinPhoneCommon topMostController];
+// if ([topVC isKindOfClass:[HDLLinphoneIntercomVC class]]) {
+// [topVC dismissViewControllerAnimated:NO completion:nil];
+// }
+ return;
+ }
+ [self toLinphoneIntercomVC:titleName];
+
+// if (self.presentingIntercomVC) {
+// __weak typeof(self) weakSelf = self;
+// [self.presentingIntercomVC dismissViewControllerAnimated:NO completion:^{
+// NSLog(@"椤甸潰閫�鍑轰簡");
+// weakSelf.presentingIntercomVC=nil;
+// [weakSelf toLinphoneIntercomVC:titleName];
+// }];
+//
+// return;
+// }
+// NSLog(@"鎵ц鍒版垜浜�");
+// [self toLinphoneIntercomVC:titleName];
+// HDLLinphoneIntercomVC *vc=[[HDLLinphoneIntercomVC alloc]init];
+//// vc.CallId=callId;
+// vc.hasVideo=YES;
+// vc.hdlLinphoneCallDelegate=self.hdlLinphoneCallDelegate;
+// if (titleName) {
+// vc.titleName=titleName;
+// }
+// vc.modalPresentationStyle = UIModalPresentationFullScreen;
+// self.presentingIntercomVC=vc;
+// [[HDLLinPhoneCommon topMostController] presentViewController:vc animated:YES completion:^{
+//
+// }];
+}
+
+-(void)toLinphoneIntercomVC:(NSString*)titleName{
HDLLinphoneIntercomVC *vc=[[HDLLinphoneIntercomVC alloc]init];
// vc.CallId=callId;
vc.hasVideo=YES;
vc.hdlLinphoneCallDelegate=self.hdlLinphoneCallDelegate;
- vc.titleName=titleName;
+ if (titleName) {
+ vc.titleName=titleName;
+ }
vc.modalPresentationStyle = UIModalPresentationFullScreen;
-// self.IntercomVC=vc;
+// self.presentingIntercomVC=vc;
[[HDLLinPhoneCommon topMostController] presentViewController:vc animated:YES completion:^{
-
+
}];
}
diff --git "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinphoneIntercomVC.m" "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinphoneIntercomVC.m"
index 1ea7374..2b91526 100644
--- "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinphoneIntercomVC.m"
+++ "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinphoneIntercomVC.m"
@@ -35,6 +35,9 @@
@property (nonatomic,strong) dispatch_source_t openDoorTimer;
@property (nonatomic, assign) int openDoorTimeout;
@property (nonatomic, assign) int callTimeout;
+
+@property (nonatomic, assign) BOOL isHangUpByRemote;//鏄惁瀵规柟杩滅▼鎸傛柇
+
@end
@implementation HDLLinphoneIntercomVC{
@@ -90,11 +93,15 @@
}
+
- (void)linphoneCallUpdate:(NSNotification *)notif {
int state = [[notif.userInfo objectForKey:@"state"] intValue];
- if ((state == LinphoneCallEnd || state == LinphoneCallError)) {//鎸傛柇浜�
+ if ((state == LinphoneCallEnd || state == LinphoneCallError)) {//鎸傛柇浜�(铏界劧鑷繁鎸傛柇涔熶細璧癓inphoneCallUpdate閫氱煡锛屼絾鑷繁鎸傛柇鐨勮瘽椤甸潰宸查攢姣侊紝涓嶄細瑙﹀彂璇ユ柟娉�)
NSLog(@"鎸傛柇鎴栧嚭閿欎簡");
+ [self stopPlaySystemSound];
+ self.isHangUpByRemote=YES;
[self showUIAlertViewWithBack:@"閫氳瘽缁撴潫"];
+
}
}
@@ -331,6 +338,7 @@
}
return _hangUpTextBtn;
}
+
//鎺ュ惉 鍥炬爣鎸夐挳
- (UIButton *)answerImgBtn{
if (_answerImgBtn == nil) {
@@ -653,7 +661,9 @@
[self stopPlaySystemSound];
//闃叉鐢ㄦ埛涓嶆寜鎸傛柇锛屾垨鑰呬笉绛夋敹鍒板鏂圭殑鎸傛柇锛岀偣鍑昏繑鍥炴寜閽��
//1.鏆傚仠SDK鐩稿叧鎾斁
- [self stopPlay];
+ if (!self.isHangUpByRemote) {
+ [self stopPlay];
+ }
//2.Delegate閲婃斁
self.hdlLinphoneCallDelegate = nil;
//3.瀹氭椂鍣ㄩ噴鏀�
@@ -672,8 +682,8 @@
}
-(void)dealloc{
- NSLog(@"==============dealloc 1");
- [[NSNotificationCenter defaultCenter] removeObserver:self];
+ NSLog(@"==============dealloc 瀵硅薄閿�姣佷簡");
+// [[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (void)willEnterForeground:(NSNotification*)notification{
NSLog(@"willEnterForeground");
diff --git "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinphoneManager.m" "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinphoneManager.m"
index 3826803..b158f2b 100644
--- "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinphoneManager.m"
+++ "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinphoneManager.m"
@@ -559,6 +559,8 @@
linphone_core_set_preferred_video_size([HDLLinphoneManager getLc], vsize);
linphone_core_set_video_preset([HDLLinphoneManager getLc], [@"custom" UTF8String]);
linphone_core_set_preferred_framerate([HDLLinphoneManager getLc], 5);
+// linphone_core_enable_video_capture([HDLLinphoneManager getLc], false);
+// linphone_core_enable_video_preview([HDLLinphoneManager getLc], FALSE);
}
@@ -1063,45 +1065,45 @@
: @"";
NSUUID *uuid = (NSUUID *)[self.providerDelegate.uuids objectForKey:callId2];
if (uuid) {
- LinphoneCall *callKit_call = (LinphoneCall *)linphone_core_get_calls(LC)
+ LinphoneCall *callK_call = (LinphoneCall *)linphone_core_get_calls(LC)
? linphone_core_get_calls(LC)->data
: NULL;
- const char *callKit_callId = callKit_call
- ? linphone_call_log_get_call_id(linphone_call_get_call_log(callKit_call))
+ const char *call_callId = callK_call
+ ? linphone_call_log_get_call_id(linphone_call_get_call_log(callK_call))
: NULL;
- if (callKit_callId && !_conf) {
+ if (call_callId && !_conf) {
// Create a CallKit call because there's not !
- NSString *callKit_callIdNS = [NSString stringWithUTF8String:callKit_callId];
- NSUUID *callKit_uuid = [NSUUID UUID];
- [HDLLinphoneManager.instance.providerDelegate.uuids setObject:callKit_uuid forKey:callKit_callIdNS];
- [HDLLinphoneManager.instance.providerDelegate.calls setObject:callKit_callIdNS forKey:callKit_uuid];
+ NSString *callK_callIdNS = [NSString stringWithUTF8String:call_callId];
+ NSUUID *callK_uuid = [NSUUID UUID];
+ [HDLLinphoneManager.instance.providerDelegate.uuids setObject:callK_uuid forKey:callK_callIdNS];
+ [HDLLinphoneManager.instance.providerDelegate.calls setObject:callK_callIdNS forKey:callK_uuid];
// NSString *address = [FastAddressBook displayNameForAddress:linphone_call_get_remote_address(callKit_call)];
- NSString *address=@"";
- CXHandle *handle = [[CXHandle alloc] initWithType:CXHandleTypeGeneric value:address];
- CXStartCallAction *act = [[CXStartCallAction alloc] initWithCallUUID:callKit_uuid handle:handle];
- CXTransaction *tr = [[CXTransaction alloc] initWithAction:act];
- [HDLLinphoneManager.instance.providerDelegate.controller requestTransaction:tr completion:^(NSError *err){}];
- [HDLLinphoneManager.instance.providerDelegate.provider reportOutgoingCallWithUUID:callKit_uuid startedConnectingAtDate:nil];
- [HDLLinphoneManager.instance.providerDelegate.provider reportOutgoingCallWithUUID:callKit_uuid connectedAtDate:nil];
+// NSString *address=@"";
+// CXHandle *handle = [[CXHandle alloc] initWithType:CXHandleTypeGeneric value:address];
+// CXStartCallAction *act = [[CXStartCallAction alloc] initWithCallUUID:callKit_uuid handle:handle];
+// CXTransaction *tr = [[CXTransaction alloc] initWithAction:act];
+// [HDLLinphoneManager.instance.providerDelegate.controller requestTransaction:tr completion:^(NSError *err){}];
+// [HDLLinphoneManager.instance.providerDelegate.provider reportOutgoingCallWithUUID:callKit_uuid startedConnectingAtDate:nil];
+// [HDLLinphoneManager.instance.providerDelegate.provider reportOutgoingCallWithUUID:callKit_uuid connectedAtDate:nil];
}
- CXEndCallAction *act = [[CXEndCallAction alloc] initWithCallUUID:uuid];
- CXTransaction *tr = [[CXTransaction alloc] initWithAction:act];
- [HDLLinphoneManager.instance.providerDelegate.controller requestTransaction:tr completion:^(NSError *err){}];
- LOGI(@"CallKit - clearing CK as call ended on uuid %@",uuid);
- [HDLLinphoneManager.instance.providerDelegate.provider reportOutgoingCallWithUUID:uuid connectedAtDate:[NSDate date]];
- [self.providerDelegate.uuids removeObjectForKey:callId2];
- [self.providerDelegate.calls removeObjectForKey:uuid];
- [self.providerDelegate.provider reportCallWithUUID:uuid endedAtDate:[NSDate date] reason:(state == LinphoneCallError ? CXCallEndedReasonFailed : CXCallEndedReasonRemoteEnded)];
+// CXEndCallAction *act = [[CXEndCallAction alloc] initWithCallUUID:uuid];
+// CXTransaction *tr = [[CXTransaction alloc] initWithAction:act];
+// [HDLLinphoneManager.instance.providerDelegate.controller requestTransaction:tr completion:^(NSError *err){}];
+// LOGI(@"CallKit - clearing CK as call ended on uuid %@",uuid);
+// [HDLLinphoneManager.instance.providerDelegate.provider reportOutgoingCallWithUUID:uuid connectedAtDate:[NSDate date]];
+// [self.providerDelegate.uuids removeObjectForKey:callId2];
+// [self.providerDelegate.calls removeObjectForKey:uuid];
+// [self.providerDelegate.provider reportCallWithUUID:uuid endedAtDate:[NSDate date] reason:(state == LinphoneCallError ? CXCallEndedReasonFailed : CXCallEndedReasonRemoteEnded)];
} else { // Can happen when Call-ID changes (Replaces header)
if (linphone_core_get_calls_nb(LC) ==0) { // Need to clear all CK calls
- for (NSUUID *myUuid in self.providerDelegate.calls) {
- [self.providerDelegate.provider reportCallWithUUID:myUuid
- endedAtDate:NULL
- reason:(state == LinphoneCallError
- ? CXCallEndedReasonFailed
- : CXCallEndedReasonRemoteEnded)];
- }
+// for (NSUUID *myUuid in self.providerDelegate.calls) {
+// [self.providerDelegate.provider reportCallWithUUID:myUuid
+// endedAtDate:NULL
+// reason:(state == LinphoneCallError
+// ? CXCallEndedReasonFailed
+// : CXCallEndedReasonRemoteEnded)];
+// }
[self.providerDelegate.uuids removeAllObjects];
[self.providerDelegate.calls removeAllObjects];
}
@@ -2804,29 +2806,30 @@
return;
}
- if (linphone_core_get_calls_nb(theLinphoneCore) < 1 &&
- floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_9_x_Max &&
- self.providerDelegate.callKitCalls < 1) {
- NSLog(@"杩涜繖閲屽懠鍙簡");
- self.providerDelegate.callKitCalls++;
- NSUUID *uuid = [NSUUID UUID];
- [HDLLinphoneManager.instance.providerDelegate.uuids setObject:uuid forKey:@""];
- [HDLLinphoneManager.instance.providerDelegate.calls setObject:@"" forKey:uuid];
- HDLLinphoneManager.instance.providerDelegate.pendingAddr = linphone_address_clone(iaddr);
-// NSString *address = [FastAddressBook displayNameForAddress:iaddr];
- NSString *address =@"unknow";
-
- CXHandle *handle = [[CXHandle alloc] initWithType:CXHandleTypeGeneric value:address];
- CXStartCallAction *act = [[CXStartCallAction alloc] initWithCallUUID:uuid handle:handle];
- CXTransaction *tr = [[CXTransaction alloc] initWithAction:act];
- [HDLLinphoneManager.instance.providerDelegate.controller requestTransaction:tr
- completion:^(NSError *err){
- NSLog(@"鍛煎彨error:%@",err);
- }];
- } else {
- NSLog(@"杩沝oCall鍛煎彨浜�");
- [self doCall:iaddr];
- }
+// if (linphone_core_get_calls_nb(theLinphoneCore) < 1 &&
+// floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_9_x_Max &&
+// self.providerDelegate.callKitCalls < 1) {
+// NSLog(@"杩涜繖閲屽懠鍙簡");
+// self.providerDelegate.callKitCalls++;
+// NSUUID *uuid = [NSUUID UUID];
+// [HDLLinphoneManager.instance.providerDelegate.uuids setObject:uuid forKey:@""];
+// [HDLLinphoneManager.instance.providerDelegate.calls setObject:@"" forKey:uuid];
+// HDLLinphoneManager.instance.providerDelegate.pendingAddr = linphone_address_clone(iaddr);
+//// NSString *address = [FastAddressBook displayNameForAddress:iaddr];
+// NSString *address =@"unknow";
+//
+// CXHandle *handle = [[CXHandle alloc] initWithType:CXHandleTypeGeneric value:address];
+// CXStartCallAction *act = [[CXStartCallAction alloc] initWithCallUUID:uuid handle:handle];
+// CXTransaction *tr = [[CXTransaction alloc] initWithAction:act];
+// [HDLLinphoneManager.instance.providerDelegate.controller requestTransaction:tr
+// completion:^(NSError *err){
+// NSLog(@"鍛煎彨error:%@",err);
+// }];
+// } else {
+// NSLog(@"杩沝oCall鍛煎彨浜�");
+// [self doCall:iaddr];
+// }
+ [self doCall:iaddr];
}
- (BOOL)doCall:(const LinphoneAddress *)iaddr {
diff --git "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinphoneProviderDelegate.h" "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinphoneProviderDelegate.h"
index 43c3137..ab69322 100644
--- "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinphoneProviderDelegate.h"
+++ "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinphoneProviderDelegate.h"
@@ -16,23 +16,24 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-
-#import <CallKit/CallKit.h>
+#import <Foundation/Foundation.h>
+//#import <CallKit/CallKit.h>
+#import <AVFoundation/AVAudioSession.h>
#include <linphone/core.h>
#ifndef ProviderDelegate_h
#define ProviderDelegate_h
-@interface HDLLinphoneProviderDelegate : NSObject <CXProviderDelegate, CXCallObserverDelegate>
-
-@property CXProvider *provider;
-@property CXCallObserver *observer;
-@property CXCallController *controller;
+@interface HDLLinphoneProviderDelegate : NSObject
+// <CXProviderDelegate, CXCallObserverDelegate>
+//@property CXProvider *provider;
+//@property CXCallObserver *observer;
+//@property CXCallController *controller;
@property NSMutableDictionary *calls;
@property NSMutableDictionary *uuids;
@property(nonatomic) LinphoneCall *pendingCall;
@property LinphoneAddress *pendingAddr;
@property BOOL pendingCallVideo;
-@property int callKitCalls;
+@property int callKCalls;
- (void)reportIncomingCall:(LinphoneCall *) call withUUID:(NSUUID *)uuid handle:(NSString *)handle video:(BOOL)video;
- (void)config;
diff --git "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinphoneProviderDelegate.m" "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinphoneProviderDelegate.m"
index 36ef23d..fa0b143 100644
--- "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinphoneProviderDelegate.m"
+++ "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinphoneProviderDelegate.m"
@@ -35,10 +35,10 @@
self.pendingCall = NULL;
self.pendingAddr = NULL;
self.pendingCallVideo = FALSE;
- CXCallController *callController = [[CXCallController alloc] initWithQueue:dispatch_get_main_queue()];
- [callController.callObserver setDelegate:self queue:dispatch_get_main_queue()];
- self.controller = callController;
- self.callKitCalls = 0;
+// CXCallController *callController = [[CXCallController alloc] initWithQueue:dispatch_get_main_queue()];
+// [callController.callObserver setDelegate:self queue:dispatch_get_main_queue()];
+// self.controller = callController;
+ self.callKCalls = 0;
if (!self) {
NSLog(@"ProviderDelegate not initialized...");
@@ -47,21 +47,21 @@
}
- (void)config {
- CXProviderConfiguration *config = [[CXProviderConfiguration alloc]
- initWithLocalizedName:[NSBundle.mainBundle objectForInfoDictionaryKey:@"CFBundleDisplayName"]];
- config.ringtoneSound = @"notes_of_the_optimistic.caf";
- config.supportsVideo = TRUE;
- config.iconTemplateImageData = UIImagePNGRepresentation([UIImage imageNamed:@"callkit_logo"]);
-
- NSArray *ar = @[ [NSNumber numberWithInt:(int)CXHandleTypeGeneric] ];
- NSSet *handleTypes = [[NSSet alloc] initWithArray:ar];
- [config setSupportedHandleTypes:handleTypes];
- [config setMaximumCallGroups:2];
- [config setMaximumCallsPerCallGroup:1];
- //not show app's calls in tel's history
- //config.includesCallsInRecents = NO;
- self.provider = [[CXProvider alloc] initWithConfiguration:config];
- [self.provider setDelegate:self queue:dispatch_get_main_queue()];
+// CXProviderConfiguration *config = [[CXProviderConfiguration alloc]
+// initWithLocalizedName:[NSBundle.mainBundle objectForInfoDictionaryKey:@"CFBundleDisplayName"]];
+// config.ringtoneSound = @"notes_of_the_optimistic.caf";
+// config.supportsVideo = TRUE;
+// config.iconTemplateImageData = UIImagePNGRepresentation([UIImage imageNamed:@"callkit_logo"]);
+//
+// NSArray *ar = @[ [NSNumber numberWithInt:(int)CXHandleTypeGeneric] ];
+// NSSet *handleTypes = [[NSSet alloc] initWithArray:ar];
+// [config setSupportedHandleTypes:handleTypes];
+// [config setMaximumCallGroups:2];
+// [config setMaximumCallsPerCallGroup:1];
+// //not show app's calls in tel's history
+// //config.includesCallsInRecents = NO;
+// self.provider = [[CXProvider alloc] initWithConfiguration:config];
+// [self.provider setDelegate:self queue:dispatch_get_main_queue()];
}
- (void)configAudioSession:(AVAudioSession *)audioSession {
@@ -87,32 +87,32 @@
}
}
-- (void)reportIncomingCall:(LinphoneCall *) call withUUID:(NSUUID *)uuid handle:(NSString *)handle video:(BOOL)video; {
- // Create update to describe the incoming call and caller
- CXCallUpdate *update = [[CXCallUpdate alloc] init];
- update.remoteHandle = [[CXHandle alloc] initWithType:CXHandleTypeGeneric value:handle];
- update.supportsDTMF = TRUE;
- update.supportsHolding = TRUE;
- update.supportsGrouping = TRUE;
- update.supportsUngrouping = TRUE;
- update.hasVideo = _pendingCallVideo = video;
-
- // Report incoming call to system
-// LOGD(@"CallKit: report new incoming call with call-id: [%@] and UUID: [%@]", [_calls objectForKey:uuid], uuid);
- [self.provider reportNewIncomingCallWithUUID:uuid
- update:update
- completion:^(NSError *error) {
- if (error) {
-// LOGE(@"CallKit: cannot complete incoming call with call-id: [%@] and UUID: [%@] from [%@] caused by [%@]",
-// [_calls objectForKey:uuid], uuid, handle, [error localizedDescription]);
- if ([error code] == CXErrorCodeIncomingCallErrorFilteredByDoNotDisturb ||
- [error code] == CXErrorCodeIncomingCallErrorFilteredByBlockList)
- linphone_call_decline(call,LinphoneReasonBusy); /*to give a chance for other devices to answer*/
- else
- linphone_call_decline(call,LinphoneReasonUnknown);
- }
- }];
-}
+//- (void)reportIncomingCall:(LinphoneCall *) call withUUID:(NSUUID *)uuid handle:(NSString *)handle video:(BOOL)video; {
+// // Create update to describe the incoming call and caller
+// CXCallUpdate *update = [[CXCallUpdate alloc] init];
+// update.remoteHandle = [[CXHandle alloc] initWithType:CXHandleTypeGeneric value:handle];
+// update.supportsDTMF = TRUE;
+// update.supportsHolding = TRUE;
+// update.supportsGrouping = TRUE;
+// update.supportsUngrouping = TRUE;
+// update.hasVideo = _pendingCallVideo = video;
+//
+// // Report incoming call to system
+//// LOGD(@"CallKit: report new incoming call with call-id: [%@] and UUID: [%@]", [_calls objectForKey:uuid], uuid);
+// [self.provider reportNewIncomingCallWithUUID:uuid
+// update:update
+// completion:^(NSError *error) {
+// if (error) {
+//// LOGE(@"CallKit: cannot complete incoming call with call-id: [%@] and UUID: [%@] from [%@] caused by [%@]",
+//// [_calls objectForKey:uuid], uuid, handle, [error localizedDescription]);
+// if ([error code] == CXErrorCodeIncomingCallErrorFilteredByDoNotDisturb ||
+// [error code] == CXErrorCodeIncomingCallErrorFilteredByBlockList)
+// linphone_call_decline(call,LinphoneReasonBusy); /*to give a chance for other devices to answer*/
+// else
+// linphone_call_decline(call,LinphoneReasonUnknown);
+// }
+// }];
+//}
- (void)setPendingCall:(LinphoneCall *)pendingCall {
if (pendingCall) {
@@ -127,177 +127,177 @@
#pragma mark - CXProviderDelegate Protocol
-- (void)provider:(CXProvider *)provider performAnswerCallAction:(CXAnswerCallAction *)action {
- NSUUID *uuid = action.callUUID;
- NSString *callID = [self.calls objectForKey:uuid]; // first, make sure this callid is not already involved in a call
-// LOGD(@"CallKit: Answering call with call-id: [%@] and UUID: [%@]", callID, uuid);
- [self configAudioSession:[AVAudioSession sharedInstance]];
- [action fulfill];
- LinphoneCall *call = [HDLLinphoneManager.instance callByCallId:callID];
- if (!call)
- return;
+//- (void)provider:(CXProvider *)provider performAnswerCallAction:(CXAnswerCallAction *)action {
+// NSUUID *uuid = action.callUUID;
+// NSString *callID = [self.calls objectForKey:uuid]; // first, make sure this callid is not already involved in a call
+//// LOGD(@"CallKit: Answering call with call-id: [%@] and UUID: [%@]", callID, uuid);
+// [self configAudioSession:[AVAudioSession sharedInstance]];
+// [action fulfill];
+// LinphoneCall *call = [HDLLinphoneManager.instance callByCallId:callID];
+// if (!call)
+// return;
+//
+// self.callKitCalls++;
+// self.pendingCall = call;
+//}
- self.callKitCalls++;
- self.pendingCall = call;
-}
-
-- (void)provider:(CXProvider *)provider performStartCallAction:(CXStartCallAction *)action {
- NSUUID *uuid = action.callUUID;
- NSString *callID = [self.calls objectForKey:uuid]; // first, make sure this callid is not already involved in a call
- NSLog(@"CallKit: Starting Call with call-id: [%@] and UUID: [%@]", callID, uuid);
- // To restart Audio Unit
- [self configAudioSession:[AVAudioSession sharedInstance]];
- [action fulfill];
- LinphoneCall *call;
- if (![callID isEqualToString:@""]) {
- call = linphone_core_get_current_call(LC);
- } else {
- call = [HDLLinphoneManager.instance callByCallId:callID];
- }
- if (call != NULL) {
- self.callKitCalls++;
- self.pendingCall = call;
- }
-}
-
-- (void)provider:(CXProvider *)provider performEndCallAction:(CXEndCallAction *)action {
- self.callKitCalls--;
- [action fulfill];
- if (linphone_core_is_in_conference(LC)) {
- HDLLinphoneManager.instance.conf = TRUE;
- linphone_core_terminate_conference(LC);
-// LOGD(@"CallKit: Ending the conference");
- } else if (linphone_core_get_calls_nb(LC) > 1) {
- HDLLinphoneManager.instance.conf = TRUE;
- linphone_core_terminate_all_calls(LC);
-// LOGD(@"CallKit: Ending all the ongoing calls");
- } else {
- NSUUID *uuid = action.callUUID;
- NSString *callID = [self.calls objectForKey:uuid];
- if (callID) {
-// LOGD(@"CallKit: Ending the call with call-id: [%@] and UUID: [%@]", callID, uuid);
- LinphoneCall *call = [HDLLinphoneManager.instance callByCallId:callID];
- if (call) {
- linphone_call_terminate((LinphoneCall *)call);
- }
- [self.uuids removeObjectForKey:callID];
- [self.calls removeObjectForKey:uuid];
- }
- }
-}
-
-- (void)provider:(CXProvider *)provider performSetMutedCallAction:(nonnull CXSetMutedCallAction *)action {
- [action fulfill];
-// if ([[PhoneMainView.instance currentView] equal:CallView.compositeViewDescription]) {
-// CallView *view = (CallView *)[PhoneMainView.instance popToView:CallView.compositeViewDescription];
-// [view.microButton toggle];
+//- (void)provider:(CXProvider *)provider performStartCallAction:(CXStartCallAction *)action {
+// NSUUID *uuid = action.callUUID;
+// NSString *callID = [self.calls objectForKey:uuid]; // first, make sure this callid is not already involved in a call
+// NSLog(@"CallKit: Starting Call with call-id: [%@] and UUID: [%@]", callID, uuid);
+// // To restart Audio Unit
+// [self configAudioSession:[AVAudioSession sharedInstance]];
+// [action fulfill];
+// LinphoneCall *call;
+// if (![callID isEqualToString:@""]) {
+// call = linphone_core_get_current_call(LC);
+// } else {
+// call = [HDLLinphoneManager.instance callByCallId:callID];
// }
-}
+// if (call != NULL) {
+// self.callKitCalls++;
+// self.pendingCall = call;
+// }
+//}
-- (void)provider:(CXProvider *)provider performSetHeldCallAction:(nonnull CXSetHeldCallAction *)action {
- [action fulfill];
- if (linphone_core_is_in_conference(LC) && action.isOnHold) {
- linphone_core_leave_conference(LC);
-// LOGD(@"CallKit: Leaving conference");
- [NSNotificationCenter.defaultCenter postNotificationName:kLinphoneCallUpdate object:self];
- return;
- }
+//- (void)provider:(CXProvider *)provider performEndCallAction:(CXEndCallAction *)action {
+// self.callKitCalls--;
+// [action fulfill];
+// if (linphone_core_is_in_conference(LC)) {
+// HDLLinphoneManager.instance.conf = TRUE;
+// linphone_core_terminate_conference(LC);
+//// LOGD(@"CallKit: Ending the conference");
+// } else if (linphone_core_get_calls_nb(LC) > 1) {
+// HDLLinphoneManager.instance.conf = TRUE;
+// linphone_core_terminate_all_calls(LC);
+//// LOGD(@"CallKit: Ending all the ongoing calls");
+// } else {
+// NSUUID *uuid = action.callUUID;
+// NSString *callID = [self.calls objectForKey:uuid];
+// if (callID) {
+//// LOGD(@"CallKit: Ending the call with call-id: [%@] and UUID: [%@]", callID, uuid);
+// LinphoneCall *call = [HDLLinphoneManager.instance callByCallId:callID];
+// if (call) {
+// linphone_call_terminate((LinphoneCall *)call);
+// }
+// [self.uuids removeObjectForKey:callID];
+// [self.calls removeObjectForKey:uuid];
+// }
+// }
+//}
- if (linphone_core_get_calls_nb(LC) > 1 && action.isOnHold) {
- linphone_core_pause_all_calls(LC);
-// LOGD(@"CallKit: Pausing all ongoing calls");
- return;
- }
+//- (void)provider:(CXProvider *)provider performSetMutedCallAction:(nonnull CXSetMutedCallAction *)action {
+// [action fulfill];
+//// if ([[PhoneMainView.instance currentView] equal:CallView.compositeViewDescription]) {
+//// CallView *view = (CallView *)[PhoneMainView.instance popToView:CallView.compositeViewDescription];
+//// [view.microButton toggle];
+//// }
+//}
- NSUUID *uuid = action.callUUID;
- NSString *callID = [self.calls objectForKey:uuid];
- if (!callID) {
- return;
- }
+//- (void)provider:(CXProvider *)provider performSetHeldCallAction:(nonnull CXSetHeldCallAction *)action {
+// [action fulfill];
+// if (linphone_core_is_in_conference(LC) && action.isOnHold) {
+// linphone_core_leave_conference(LC);
+//// LOGD(@"CallKit: Leaving conference");
+// [NSNotificationCenter.defaultCenter postNotificationName:kLinphoneCallUpdate object:self];
+// return;
+// }
+//
+// if (linphone_core_get_calls_nb(LC) > 1 && action.isOnHold) {
+// linphone_core_pause_all_calls(LC);
+//// LOGD(@"CallKit: Pausing all ongoing calls");
+// return;
+// }
+//
+// NSUUID *uuid = action.callUUID;
+// NSString *callID = [self.calls objectForKey:uuid];
+// if (!callID) {
+// return;
+// }
+//
+//// LOGD(@"CallKit: Call with call-id: [%@] and UUID: [%@] paused status changed to: []", callID, uuid, action.isOnHold ? @"Paused" : @"Resumed");
+// LinphoneCall *call = [HDLLinphoneManager.instance callByCallId:callID];
+// if (!call)
+// return;
+//
+// if (action.isOnHold) {
+// HDLLinphoneManager.instance.speakerBeforePause = HDLLinphoneManager.instance.speakerEnabled;
+// linphone_call_pause((LinphoneCall *)call);
+// } else {
+// if (linphone_core_get_conference(LC)) {
+// linphone_core_enter_conference(LC);
+// [NSNotificationCenter.defaultCenter postNotificationName:kLinphoneCallUpdate object:self];
+// } else {
+// [self configAudioSession:[AVAudioSession sharedInstance]];
+// self.pendingCall = call;
+// }
+// }
+//}
-// LOGD(@"CallKit: Call with call-id: [%@] and UUID: [%@] paused status changed to: []", callID, uuid, action.isOnHold ? @"Paused" : @"Resumed");
- LinphoneCall *call = [HDLLinphoneManager.instance callByCallId:callID];
- if (!call)
- return;
+//- (void)provider:(CXProvider *)provider performPlayDTMFCallAction:(CXPlayDTMFCallAction *)action {
+// [action fulfill];
+// NSUUID *uuid = action.callUUID;
+// NSString *callID = [self.calls objectForKey:uuid];
+//// LOGD(@"CallKit: playing DTMF for call with call-id: [%@] and UUID: [%@]", callID, uuid);
+// LinphoneCall *call = [HDLLinphoneManager.instance callByCallId:callID];
+// char digit = action.digits.UTF8String[0];
+// linphone_call_send_dtmf((LinphoneCall *)call, digit);
+//}
- if (action.isOnHold) {
- HDLLinphoneManager.instance.speakerBeforePause = HDLLinphoneManager.instance.speakerEnabled;
- linphone_call_pause((LinphoneCall *)call);
- } else {
- if (linphone_core_get_conference(LC)) {
- linphone_core_enter_conference(LC);
- [NSNotificationCenter.defaultCenter postNotificationName:kLinphoneCallUpdate object:self];
- } else {
- [self configAudioSession:[AVAudioSession sharedInstance]];
- self.pendingCall = call;
- }
- }
-}
+//- (void)provider:(CXProvider *)provider didActivateAudioSession:(AVAudioSession *)audioSession {
+// NSLog(@"CallKit: Audio session activated");
+// // Now we can (re)start the call
+// if (self.pendingCall) {
+// LinphoneCallState state = linphone_call_get_state(self.pendingCall);
+// switch (state) {
+// case LinphoneCallIncomingReceived:
+// [HDLLinphoneManager.instance acceptCall:(LinphoneCall *)self.pendingCall evenWithVideo:_pendingCallVideo];
+// break;
+// case LinphoneCallPaused:
+// linphone_call_resume((LinphoneCall *)self.pendingCall);
+// break;
+// case LinphoneCallStreamsRunning:
+// // May happen when multiple calls
+// break;
+// default:
+// break;
+// }
+// } else {
+// if (_pendingAddr) {
+// [HDLLinphoneManager.instance doCall:_pendingAddr];
+// } else {
+//// LOGE(@"CallKit: No pending call");
+// }
+// }
+//
+// [self setPendingCall:NULL];
+// if (_pendingAddr)
+// linphone_address_unref(_pendingAddr);
+// _pendingAddr = NULL;
+// _pendingCallVideo = FALSE;
+//}
+//
+//- (void)provider:(CXProvider *)provider didDeactivateAudioSession:(nonnull AVAudioSession *)audioSession {
+// NSLog(@"CallKit : Audio session deactivated");
+// [self setPendingCall:NULL];
+// if (_pendingAddr)
+// linphone_address_unref(_pendingAddr);
+// _pendingAddr = NULL;
+// _pendingCallVideo = FALSE;
+//}
-- (void)provider:(CXProvider *)provider performPlayDTMFCallAction:(CXPlayDTMFCallAction *)action {
- [action fulfill];
- NSUUID *uuid = action.callUUID;
- NSString *callID = [self.calls objectForKey:uuid];
-// LOGD(@"CallKit: playing DTMF for call with call-id: [%@] and UUID: [%@]", callID, uuid);
- LinphoneCall *call = [HDLLinphoneManager.instance callByCallId:callID];
- char digit = action.digits.UTF8String[0];
- linphone_call_send_dtmf((LinphoneCall *)call, digit);
-}
-
-- (void)provider:(CXProvider *)provider didActivateAudioSession:(AVAudioSession *)audioSession {
- NSLog(@"CallKit: Audio session activated");
- // Now we can (re)start the call
- if (self.pendingCall) {
- LinphoneCallState state = linphone_call_get_state(self.pendingCall);
- switch (state) {
- case LinphoneCallIncomingReceived:
- [HDLLinphoneManager.instance acceptCall:(LinphoneCall *)self.pendingCall evenWithVideo:_pendingCallVideo];
- break;
- case LinphoneCallPaused:
- linphone_call_resume((LinphoneCall *)self.pendingCall);
- break;
- case LinphoneCallStreamsRunning:
- // May happen when multiple calls
- break;
- default:
- break;
- }
- } else {
- if (_pendingAddr) {
- [HDLLinphoneManager.instance doCall:_pendingAddr];
- } else {
-// LOGE(@"CallKit: No pending call");
- }
- }
-
- [self setPendingCall:NULL];
- if (_pendingAddr)
- linphone_address_unref(_pendingAddr);
- _pendingAddr = NULL;
- _pendingCallVideo = FALSE;
-}
-
-- (void)provider:(CXProvider *)provider didDeactivateAudioSession:(nonnull AVAudioSession *)audioSession {
- NSLog(@"CallKit : Audio session deactivated");
- [self setPendingCall:NULL];
- if (_pendingAddr)
- linphone_address_unref(_pendingAddr);
- _pendingAddr = NULL;
- _pendingCallVideo = FALSE;
-}
-
-- (void)providerDidReset:(CXProvider *)provider {
-// LOGD(@"CallKit: Provider reset");
- HDLLinphoneManager.instance.conf = TRUE;
- linphone_core_terminate_all_calls(LC);
- [self.calls removeAllObjects];
- [self.uuids removeAllObjects];
-}
-
-#pragma mark - CXCallObserverDelegate Protocol
-
-- (void)callObserver:(CXCallObserver *)callObserver callChanged:(CXCall *)call {
- NSLog(@"CallKit: Call changed");
-}
+//- (void)providerDidReset:(CXProvider *)provider {
+//// LOGD(@"CallKit: Provider reset");
+// HDLLinphoneManager.instance.conf = TRUE;
+// linphone_core_terminate_all_calls(LC);
+// [self.calls removeAllObjects];
+// [self.uuids removeAllObjects];
+//}
+//
+//#pragma mark - CXCallObserverDelegate Protocol
+//
+//- (void)callObserver:(CXCallObserver *)callObserver callChanged:(CXCall *)call {
+// NSLog(@"CallKit: Call changed");
+//}
@end
diff --git a/Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/Library/libHDLLinPhoneSDK.a b/Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/Library/libHDLLinPhoneSDK.a
index a94bb2e..a408ad0 100644
--- a/Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/Library/libHDLLinPhoneSDK.a
+++ b/Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/Library/libHDLLinPhoneSDK.a
Binary files differ
--
Gitblit v1.8.0