wxr
2024-12-03 cb9232b3ab413fae7bcc2b94abd70f18ca02b263
HDLLinPhoneSDK£¨OC£©/HDLLinPhoneSDK/HDLLinPhoneSDK.m
@@ -43,8 +43,15 @@
}
-(void)login:(NSString*)username password:(NSString*)pwd domain:(NSString*) domain{
    NSLog(@"sipDomain:%@",domain);
    [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 {
@@ -101,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:^{
    }];
}
/**
*  è·³è½¬å‘¼å«é¡µé¢
*
@@ -127,11 +159,11 @@
                UIViewController *topVC=[HDLLinPhoneCommon topMostController];
                if ([topVC isKindOfClass:[HDLLPOnMonitorViewController class]]) {
                    [topVC dismissViewControllerAnimated:NO completion:^{
                        [weakSelf toLinphoneIntercomVC:titleName];
                        [weakSelf toLinphoneIntercomVC:titleName deviceType:HDLLPType_Default userName:@""];
                    }];
                }else if ([topVC isKindOfClass:[HDLLinphoneIntercomVC class]]) {
                    [topVC dismissViewControllerAnimated:NO completion:^{
                        [weakSelf toLinphoneIntercomVC:titleName];
                        [weakSelf toLinphoneIntercomVC:titleName deviceType:HDLLPType_Default userName:@""];
                    }];
                }
            }];
@@ -143,7 +175,7 @@
        return;
    }
    [self toLinphoneIntercomVC:titleName];
    [self toLinphoneIntercomVC:titleName deviceType:HDLLPType_Default userName:@""];
    
//    if (self.presentingIntercomVC) {
//        __weak typeof(self) weakSelf = self;
@@ -171,7 +203,55 @@
//    }];
}
-(void)toLinphoneIntercomVC:(NSString*)titleName{
/**
*  è·³è½¬è‡ªç ”呼叫页面
*
*  @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:^{
        }];
    }
}
/**
 å‘送sip 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;
@@ -179,7 +259,12 @@
    if (titleName) {
        vc.titleName=titleName;
    }
    vc.deviceType=deviceType;
    vc.userName=userName;
    vc.modalPresentationStyle = UIModalPresentationFullScreen;
    [HDLLinphoneManager instance].deviceType=deviceType;
    [HDLLinphoneManager instance].isResettingVideoEnable=NO;
//    self.presentingIntercomVC=vc;
    [[HDLLinPhoneCommon topMostController] presentViewController:vc animated:YES completion:^{