| | |
| | | #import "HDLLinphoneIntercomVC.h" |
| | | #import "HDLLinPhoneCommon.h" |
| | | #import "HDLLPOnMonitorViewController.h" |
| | | |
| | | @interface HDLLinPhoneSDK() |
| | | //@property (nonatomic, strong) HDLLinphoneIntercomVC *IntercomVC; |
| | | //@property (nonatomic, strong) HDLLPOnMonitorViewController *CallVC; |
| | | @end |
| | | |
| | | @implementation HDLLinPhoneSDK |
| | | |
| | | + (instancetype)instance{ |
| | |
| | | selector:@selector(registrationUpdate:) |
| | | name:@"LinphoneRegistrationUpdate" |
| | | object:nil]; |
| | | // service.CallVC=nil; |
| | | // service.IntercomVC=nil; |
| | | |
| | | }); |
| | | return service; |
| | |
| | | - (void)registrationUpdate:(NSNotification *)notif { |
| | | LinphoneRegistrationState state = [[notif.userInfo objectForKey:@"state"] intValue]; |
| | | if (state == LinphoneRegistrationFailed){ |
| | | |
| | | NSLog(@"登失败"); |
| | | }else if (state == LinphoneRegistrationCleared){ |
| | | NSLog(@"登录清空"); |
| | | } else if (state == LinphoneRegistrationOk) { |
| | | |
| | | // HDLLinphoneIntercomVC *vc=[[HDLLinphoneIntercomVC alloc]init]; |
| | |
| | | // }]; |
| | | NSLog(@"登录成功啦"); |
| | | }else if (state==10){//接收到呼叫通知 |
| | | self.IsAutoJumpCallView=YES; |
| | | // self.IsAutoJumpCallView=YES; |
| | | NSString *userName=[NSString stringWithFormat:@"%@",[notif.userInfo objectForKey:@"userName"]]; |
| | | [self.hdlLinphoneCallDelegate onIncomingCall:userName]; |
| | | |
| | | if(self.IsAutoJumpCallView){ |
| | | NSString *callId=[NSString stringWithFormat:@"%@",[notif.userInfo objectForKey:@"callID"]]; |
| | | BOOL hasVideo=(BOOL)[notif.userInfo objectForKey:@"hasVideo"]; |
| | |
| | | vc.CallId=callId; |
| | | vc.hasVideo=hasVideo; |
| | | vc.hdlLinphoneCallDelegate=self.hdlLinphoneCallDelegate; |
| | | vc.modalPresentationStyle = UIModalPresentationFullScreen; |
| | | // self.IntercomVC=vc; |
| | | [[HDLLinPhoneCommon topMostController] presentViewController:vc animated:YES completion:^{ |
| | | |
| | | }]; |
| | | } |
| | | |
| | | |
| | | }else if(state==11){//挂断了 |
| | | // NSLog(@"挂断或出错了"); |
| | | // if (self.IntercomVC) { |
| | | // __weak typeof(self) weakSelf = self; |
| | | // [self.IntercomVC dismissViewControllerAnimated:YES completion:^{ |
| | | // weakSelf.IntercomVC=nil; |
| | | // }]; |
| | | // } |
| | | // |
| | | // if (self.CallVC) { |
| | | // __weak typeof(self) weakSelf = self; |
| | | // [self.CallVC dismissViewControllerAnimated:YES completion:^{ |
| | | // weakSelf.CallVC=nil; |
| | | // }]; |
| | | // } |
| | | |
| | | }else if(state==12){//占线了 |
| | | // NSLog(@"占线了"); |
| | | // if (self.CallVC) { |
| | | // [self.CallVC showUIAlertViewWithBack:@"监视结束"]; |
| | | // } |
| | | } |
| | | } |
| | | |
| | |
| | | vc.modalPresentationStyle = UIModalPresentationFullScreen; |
| | | vc.userName=username; |
| | | vc.titleName=title; |
| | | // self.CallVC=vc; |
| | | [[HDLLinPhoneCommon topMostController] presentViewController:vc animated:YES completion:^{ |
| | | |
| | | }]; |
| | |
| | | vc.hdlLinphoneCallDelegate=self.hdlLinphoneCallDelegate; |
| | | vc.titleName=titleName; |
| | | vc.modalPresentationStyle = UIModalPresentationFullScreen; |
| | | // self.IntercomVC=vc; |
| | | [[HDLLinPhoneCommon topMostController] presentViewController:vc animated:YES completion:^{ |
| | | |
| | | }]; |
| | | } |
| | | |
| | | -(void)logoutAllLinphoneUser{ |
| | | |
| | | [HDLLinphoneManager.instance removeAllAccounts]; |
| | | } |
| | | |
| | | -(void)clearAllConfigs{ |
| | | |
| | | } |
| | | |
| | | -(void)enterBackground{ |
| | | [HDLLinphoneManager.instance enterBackgroundMode]; |
| | | } |
| | | |
| | | -(void)becomactive{ |
| | | [HDLLinphoneManager.instance becomeActive]; |
| | | } |
| | | |
| | | -(void)willResignActive{ |
| | | [HDLLinphoneManager.instance willResignActive]; |
| | | } |
| | | @end |