From a616abd9b740e74eb7aea29cb692ca86ba1f7d7a Mon Sep 17 00:00:00 2001 From: wxr <wxr@hdlchina.com.cn> Date: 星期二, 27 八月 2024 15:24:54 +0800 Subject: [PATCH] 增加铃声功能 --- HDLLinPhoneSDK(OC)/HDLLinPhoneSDK/HDLLinphoneManager.m | 52 ++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 46 insertions(+), 6 deletions(-) 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 f914edc..f4a77b3 100644 --- "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinphoneManager.m" +++ "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinphoneManager.m" @@ -54,6 +54,8 @@ //#import "configManager.h" #import "HDLLinphoneLog.h" +#import "HDLLinphoneTimerManager.h" + #define LINPHONE_LOGS_MAX_ENTRY 5000 @@ -68,6 +70,9 @@ #define kIAPReady @"IAPReady" // no data #define IPAD (HDLLinphoneManager.runningOnIpad) + +#define RESET_VIDEO_ENABLE_TIMER_NAME @"hdlLinphoneVideoEnableTimer" //閲嶈瑙嗛寮�璁℃椂鍣ㄥ悕绉� +#define RESET_VIDEO_DISABLE_TIMER_NAME @"hdlLinphoneVideoDisableTimer" //閲嶈瑙嗛鍏宠鏃跺櫒鍚嶇О static LinphoneCore *theLinphoneCore = nil; static HDLLinphoneManager *theLinphoneManager = nil; @@ -684,7 +689,7 @@ // linphone_core_enable_mic(LC, false); } -- (void)login:(NSString*)username password:(NSString*)pwd domain:(NSString*) domain{ +- (void)login:(NSString*)username password:(NSString*)pwd domain:(NSString*) domain connectType:(NSString*)connectType{ // NSString *domain = [self findTextField:ViewElement_Domain].text; // NSString *username = username; NSString *displayName = @""; @@ -706,15 +711,15 @@ linphone_proxy_config_set_identity_address(config, addr); // set transport - NSString *type = @"UDP"; +// NSString *type = @"UDP"; // NSString *type = @"TCP"; linphone_proxy_config_set_route( config, - [NSString stringWithFormat:@"%s;transport=%s", domain.UTF8String, type.lowercaseString.UTF8String] + [NSString stringWithFormat:@"%s;transport=%s", domain.UTF8String, connectType.lowercaseString.UTF8String] .UTF8String); linphone_proxy_config_set_server_addr( config, - [NSString stringWithFormat:@"%s;transport=%s", domain.UTF8String, type.lowercaseString.UTF8String] + [NSString stringWithFormat:@"%s;transport=%s", domain.UTF8String, connectType.lowercaseString.UTF8String] .UTF8String); linphone_proxy_config_enable_publish(config, FALSE); @@ -832,7 +837,7 @@ - (void)onCall:(LinphoneCall *)call StateChanged:(LinphoneCallState)state withMessage:(const char *)message { - NSLog(@"鍛煎彨鐘舵�侊細%u",state); + NSLog(@"鍛煎彨鐘舵�侊細%u,淇℃伅锛�%s",state,message); HDLLinPhoneSDK.instance.IsIncomingReceivedCallState=false; // Handling wrapper @@ -1153,12 +1158,22 @@ speaker_already_enabled = TRUE; } } + + if( state == LinphoneCallConnected ){ + NSLog(@"杩炴帴浜�"); +// [self enableVideoPlay:TRUE]; + } + if (state == LinphoneCallStreamsRunning) { if (_speakerBeforePause) { _speakerBeforePause = FALSE; [self setSpeakerEnabled:TRUE]; speaker_already_enabled = TRUE; } + if (!self.isResettingVideoEnable&&self.deviceType==HDLLPType_HDLSR) { + self.isResettingVideoEnable=YES; + [self resetVideoEnable]; + } } if (state == LinphoneCallConnected && !mCallCenter) { /*only register CT call center CB for connected call*/ @@ -1179,6 +1194,31 @@ userInfo:dict]; } +/*閲嶆柊鎷夊彇瑙嗛娴侊紙瑙e喅鑷爺鍙瀵硅鍋跺皵鍑虹幇瑙嗛娴佹媺鍙栧緢鎱㈢殑闂锛� + */ +-(void)resetVideoEnable{ + NSLog(@"閲嶇疆瑙嗛寮�鍏�"); + __weak typeof(self) weakSelf = self; + [self enableVideoPlay:TRUE]; +// [self enableVideoPlay:FALSE]; +// [[HDLLinphoneTimerManager sharedInstance] scheduleTimerWithInterval:0.5 timerName:RESET_VIDEO_ENABLE_TIMER_NAME count:^(double count) { +// +// } finished:^{ +// NSLog(@"鎵撳紑瑙嗛"); +// [weakSelf enableVideoPlay:TRUE]; +// }]; +} + +/*鏄惁鍏佽瑙嗛鎾斁 + */ +-(void)enableVideoPlay:(bool_t)enable{ + LinphoneCall *call = linphone_core_get_current_call(LC); + LinphoneCallParams *call_params = linphone_core_create_call_params(LC,call); + linphone_call_params_enable_video(call_params, enable); + linphone_call_update(call, call_params); + linphone_call_params_unref(call_params); +} + static void linphone_iphone_call_state(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState state, const char *message) { [(__bridge HDLLinphoneManager *)linphone_core_cbs_get_user_data(linphone_core_get_current_callbacks(lc)) onCall:call StateChanged:state withMessage:message]; @@ -1196,7 +1236,7 @@ } - (void)onGlobalStateChanged:(LinphoneGlobalState)state withMessage:(const char *)message { -// LOGI(@"onGlobalStateChanged: %d (message: %s)", state, message); + LOGI(@"onGlobalStateChanged: %d (message: %s)", state, message); NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:state], @"state", -- Gitblit v1.8.0