From cb9232b3ab413fae7bcc2b94abd70f18ca02b263 Mon Sep 17 00:00:00 2001 From: wxr <wxr@hdlchina.com.cn> Date: 星期二, 03 十二月 2024 11:20:32 +0800 Subject: [PATCH] 增加铃声;增加TCP/UDP连接选择 --- HDLLinPhoneSDK(OC)/HDLLinPhoneSDK/HDLLinPhoneSDK.m | 172 ++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 158 insertions(+), 14 deletions(-) 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..e6f7446 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 @@ -46,6 +46,14 @@ [HDLLinphoneManager.instance login:username password:pwd domain:domain]; } +-(void)tcpLogin:(NSString*)username password:(NSString*)pwd domain:(NSString*) domain { + [HDLLinphoneManager.instance tcpLogin:username password:pwd domain:domain ]; +} + +-(void)udpLogin:(NSString*)username password:(NSString*)pwd domain:(NSString*) domain { + [HDLLinphoneManager.instance udpLogin:username password:pwd domain:domain ]; +} + - (void)registrationUpdate:(NSNotification *)notif { LinphoneRegistrationState state = [[notif.userInfo objectForKey:@"state"] intValue]; if (state == LinphoneRegistrationFailed){ @@ -70,18 +78,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]; } } } @@ -99,12 +108,37 @@ vc.modalPresentationStyle = UIModalPresentationFullScreen; vc.userName=username; vc.titleName=title; + [HDLLinphoneManager instance].deviceType=HDLLPType_Default; + [HDLLinphoneManager instance].isResettingVideoEnable=NO; // self.CallVC=vc; [[HDLLinPhoneCommon topMostController] presentViewController:vc animated:YES completion:^{ }]; } + +/** +* 鍛煎彨锛堣嚜鐮斿彲瑙嗗璁诧級 +* +* @param username 鐢ㄦ埛璐﹀彿 +* @param title 椤甸潰鏍囬 +*/ +-(void)callHDLSRWithUserName:(NSString*)username title:(NSString *)title{ + HDLLPOnMonitorViewController *vc=[[HDLLPOnMonitorViewController alloc]init]; +// vc.CallId=callId; +// vc.hasVideo=YES; + vc.hdlLinphoneCallDelegate=self.hdlLinphoneCallDelegate; + vc.modalPresentationStyle = UIModalPresentationFullScreen; + vc.userName=username; + vc.titleName=title; + [HDLLinphoneManager instance].deviceType=HDLLPType_HDLSR; + [HDLLinphoneManager instance].isResettingVideoEnable=NO; +// self.CallVC=vc; + [[HDLLinPhoneCommon topMostController] presentViewController:vc animated:YES completion:^{ + + }]; +} + /** * 璺宠浆鍛煎彨椤甸潰 * @@ -114,16 +148,126 @@ // 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 deviceType:HDLLPType_Default userName:@""]; + }]; + }else if ([topVC isKindOfClass:[HDLLinphoneIntercomVC class]]) { + [topVC dismissViewControllerAnimated:NO completion:^{ + [weakSelf toLinphoneIntercomVC:titleName deviceType:HDLLPType_Default userName:@""]; + }]; + } + }]; + } +// UIViewController *topVC=[HDLLinPhoneCommon topMostController]; +// if ([topVC isKindOfClass:[HDLLinphoneIntercomVC class]]) { +// [topVC dismissViewControllerAnimated:NO completion:nil]; +// } + return; + } + [self toLinphoneIntercomVC:titleName deviceType:HDLLPType_Default userName:@""]; + +// 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:^{ +// +// }]; +} + +/** +* 璺宠浆鑷爺鍛煎彨椤甸潰 +* +* @param titleName 鏍囬 +*/ +-(void)gotoHDLSRLinphoneIntercomVC:(NSString*)titleName userName:(NSString*)username{ + 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 deviceType:HDLLPType_HDLSR userName:username]; + }]; + }else if ([topVC isKindOfClass:[HDLLinphoneIntercomVC class]]) { + [topVC dismissViewControllerAnimated:NO completion:^{ + [weakSelf toLinphoneIntercomVC:titleName deviceType:HDLLPType_HDLSR userName:username]; + }]; + } + }]; + } + return; + } + + [self toLinphoneIntercomVC:titleName deviceType:HDLLPType_HDLSR userName:username]; +} + +-(void)hideIntercomeVC{ + if ([[HDLLinPhoneCommon topMostController] isKindOfClass:[HDLLinphoneIntercomVC class]]) { + [[HDLLinPhoneCommon topMostController] dismissViewControllerAnimated:YES completion:^{ + + }]; + } +} +/** + 鍙戦�乻ip message + */ +-(void)sendMessage:(NSString*)message sipAccount:(NSString*)sipAccount domain:(NSString*)domain{ + LinphoneAddress *tmpAddr = linphone_address_new([NSString stringWithFormat:@"sip:%@@%@",sipAccount,domain].UTF8String); + LinphoneChatRoom *chatRomm=linphone_core_get_chat_room([HDLLinphoneManager getLc], tmpAddr); + [[HDLLinphoneManager instance] send:message toChatRoom:chatRomm]; +} + + + +-(void)toLinphoneIntercomVC:(NSString*)titleName deviceType:(HDLLPType)deviceType userName:(NSString *)userName{ HDLLinphoneIntercomVC *vc=[[HDLLinphoneIntercomVC alloc]init]; // vc.CallId=callId; vc.hasVideo=YES; vc.hdlLinphoneCallDelegate=self.hdlLinphoneCallDelegate; - vc.titleName=titleName; + if (titleName) { + vc.titleName=titleName; + } + vc.deviceType=deviceType; + vc.userName=userName; vc.modalPresentationStyle = UIModalPresentationFullScreen; -// self.IntercomVC=vc; + + [HDLLinphoneManager instance].deviceType=deviceType; + [HDLLinphoneManager instance].isResettingVideoEnable=NO; +// self.presentingIntercomVC=vc; [[HDLLinPhoneCommon topMostController] presentViewController:vc animated:YES completion:^{ - + }]; } -- Gitblit v1.8.0