From 2dac2cef6b940f863edc69a4908260f80bb19045 Mon Sep 17 00:00:00 2001
From: "benoit.martins" <benoit.martins@belledonne-communications.com>
Date: Sun, 14 May 2023 23:00:17 +0200
Subject: [PATCH 1/2] Add bundle_mode_preference toggle in account settings

---
 Classes/LinphoneCoreSettingsStore.m         | 15 +++++++++++----
 Settings/InAppSettings.bundle/Account.plist | 10 ++++++++++
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m
index 604fb1fd0c..28a5c6d773 100644
--- a/Classes/LinphoneCoreSettingsStore.m
+++ b/Classes/LinphoneCoreSettingsStore.m
@@ -155,7 +155,8 @@
 	// default values
 	{
 		[self setBool:NO forKey:@"account_pushnotification_preference"];
-        [self setBool:YES forKey:@"account_push_presence_preference"];
+		[self setBool:YES forKey:@"account_push_presence_preference"];
+		[self setBool:NO forKey:@"account_bundle_mode_preference"];
 		[self setObject:@"" forKey:@"account_mandatory_username_preference"];
 		[self setObject:@"" forKey:@"account_mandatory_domain_preference"];
 		[self setCString:"" forKey:@"account_display_name_preference"];
@@ -185,10 +186,13 @@
 		{
 			BOOL pushEnabled = linphone_account_params_get_push_notification_allowed(accountParams);
 			[self setBool:pushEnabled forKey:@"account_pushnotification_preference"];
-            
+			
 			BOOL pushPresenceEnabled = linphone_account_params_get_publish_enabled(accountParams);
-            [self setBool:pushPresenceEnabled forKey:@"account_push_presence_preference"];
-
+			[self setBool:pushPresenceEnabled forKey:@"account_push_presence_preference"];
+			
+			BOOL bundleModeEnabled = linphone_account_params_rtp_bundle_enabled(accountParams);
+			[self setBool:bundleModeEnabled forKey:@"account_bundle_mode_preference"];
+			
 			const LinphoneAddress *identity_addr = linphone_account_params_get_identity_address(accountParams);
 			const char *server_addr = linphone_account_params_get_server_addr(accountParams);
 			LinphoneAddress *proxy_addr = linphone_core_interpret_url_2(LC, server_addr, false);
@@ -619,6 +623,7 @@
 		int expire = [self integerForKey:@"account_expire_preference"];
 		BOOL pushnotification = [self boolForKey:@"account_pushnotification_preference"];
 		BOOL publishPrensence = [self boolForKey:@"account_push_presence_preference"];
+		BOOL bundlemode = [self boolForKey:@"account_bundle_mode_preference"];
 		NSString *prefix = [self stringForKey:@"account_prefix_preference"];
 		BOOL use_prefix = [self boolForKey:@"apply_international_prefix_for_calls_and_chats"];
 		NSString *proxyAddress = [self stringForKey:@"account_proxy_preference"];
@@ -698,6 +703,8 @@
 
 		// use empty string "" instead of NULL to avoid being overwritten by default proxy config values
 		linphone_account_params_set_push_notification_allowed(newAccountParams, pushnotification);
+		linphone_account_params_enable_rtp_bundle(newAccountParams, bundlemode);
+		linphone_account_params_set_push_notification_allowed(newAccountParams, pushnotification);
 		linphone_account_params_set_remote_push_notification_allowed(newAccountParams, pushnotification);
 		
 		linphone_account_params_set_publish_enabled(newAccountParams, publishPrensence);
diff --git a/Settings/InAppSettings.bundle/Account.plist b/Settings/InAppSettings.bundle/Account.plist
index 528c6c96cf..95d8e338cb 100644
--- a/Settings/InAppSettings.bundle/Account.plist
+++ b/Settings/InAppSettings.bundle/Account.plist
@@ -298,6 +298,16 @@
 			<key>Type</key>
 			<string>PSToggleSwitchSpecifier</string>
 		</dict>
+		<dict>
+			<key>Title</key>
+			<string>Bundle Mode</string>
+			<key>Key</key>
+			<string>account_bundle_mode_preference</string>
+			<key>Type</key>
+			<string>PSToggleSwitchSpecifier</string>
+			<key>DefaultValue</key>
+			<false/>
+		</dict>
 		<dict>
 			<key>Key</key>
 			<string>account_mandatory_change_password</string>
-- 
GitLab


From 30dd6926e307754f20c2ef283bb154df42fee335 Mon Sep 17 00:00:00 2001
From: Benoit Martins <benoit.martins@belledonne-communications.com>
Date: Mon, 15 May 2023 11:16:55 +0200
Subject: [PATCH 2/2] Remove auto enable_rtp_bundle when app is launched

---
 Classes/LinphoneManager.m | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m
index 1b593a9208..f4f55473db 100644
--- a/Classes/LinphoneManager.m
+++ b/Classes/LinphoneManager.m
@@ -529,10 +529,12 @@ static int check_should_migrate_images(void *data, int argc, char **argv, char *
 				   }
 			   }
 			   
-			   if (!linphone_account_params_rtp_bundle_enabled(newAccountParams)) {
-				   linphone_account_params_enable_rtp_bundle(newAccountParams, true);
-				   linphone_account_set_params(account,newAccountParams);
-			   }
+			   	/*
+				if (!linphone_account_params_rtp_bundle_enabled(newAccountParams)) {
+					linphone_account_params_enable_rtp_bundle(newAccountParams, true);
+					linphone_account_set_params(account,newAccountParams);
+			   	}
+				*/
 			   
 			   LOGI(@"Setting the sip 'expires' parameters of existing account to 1 month (2629800 seconds)");
 			   linphone_account_params_set_expires(newAccountParams, 2629800);
-- 
GitLab