From d5ed8a9d9e26c05c6cc579420c01d267e17c2d48 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Thu, 15 Oct 2015 11:14:47 +0200 Subject: [PATCH] Settings: add auto_answer for debugging purposes --- Classes/IncomingCallViewController.m | 5 +++++ Classes/LinphoneCoreSettingsStore.m | 5 +++++ Settings/InAppSettings.bundle/Root.plist | 10 ++++++++++ 3 files changed, 20 insertions(+) diff --git a/Classes/IncomingCallViewController.m b/Classes/IncomingCallViewController.m index efee13a35..2ee789c8e 100644 --- a/Classes/IncomingCallViewController.m +++ b/Classes/IncomingCallViewController.m @@ -91,6 +91,11 @@ static UICompositeViewDescription *compositeDescription = nil; if (call == acall && (astate == LinphoneCallEnd || astate == LinphoneCallError)) { [delegate incomingCallAborted:call]; [self dismiss]; + } else if ([LinphoneManager.instance lpConfigBoolForKey:@"auto_answer"]) { + LinphoneCallState state = linphone_call_get_state(call); + if (state == LinphoneCallIncomingReceived || state == LinphoneCallIncomingEarlyMedia) { + [self onAcceptClick:nil]; + } } } diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m index 0aae9d65b..8b194773c 100644 --- a/Classes/LinphoneCoreSettingsStore.m +++ b/Classes/LinphoneCoreSettingsStore.m @@ -161,6 +161,8 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); [self setBool:(linphone_proxy_config_get_route(cfg) != NULL)forKey:@"outbound_proxy_preference"]; [self setBool:linphone_proxy_config_avpf_enabled(cfg) forKey:@"avpf_preference"]; [self setBool:linphone_core_video_enabled(lc) forKey:@"enable_video_preference"]; + [self setBool:[LinphoneManager.instance lpConfigBoolForKey:@"auto_answer"] + forKey:@"enable_auto_answer_preference"]; // actually in Advanced section but proxy config dependent [self setInteger:linphone_proxy_config_get_expires(cfg) forKey:@"expire_preference"]; @@ -577,6 +579,9 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); bool enableVideo = [self boolForKey:@"enable_video_preference"]; linphone_core_enable_video(lc, enableVideo, enableVideo); + + bool enableAutoAnswer = [self boolForKey:@"enable_auto_answer_preference"]; + [LinphoneManager.instance lpConfigSetBool:enableAutoAnswer forKey:@"auto_answer"]; } // audio section diff --git a/Settings/InAppSettings.bundle/Root.plist b/Settings/InAppSettings.bundle/Root.plist index dedc25c2d..a636b84dd 100644 --- a/Settings/InAppSettings.bundle/Root.plist +++ b/Settings/InAppSettings.bundle/Root.plist @@ -288,6 +288,16 @@ Type IASKButtonSpecifier + + Type + PSToggleSwitchSpecifier + Title + Auto answer call immediately + Key + enable_auto_answer_preference + DefaultValue + + StringsTable Root