From 548b4e645a638faa462b97f6ae9e2c7a38df8154 Mon Sep 17 00:00:00 2001
From: 464027401@qq.com <464027401@qq.com>
Date: 星期二, 14 十二月 2021 13:45:01 +0800
Subject: [PATCH] 设置为随机端口

---
 HDLLinPhoneSDK(OC)/HDLLinPhoneSDK/HDLLinphoneManager.m |   15 ++++++++++++++-
 HDLLinPhoneSDK(OC)/HDLLinPhoneSDK/HDLLinPhoneSDK.m     |    1 +
 2 files changed, 15 insertions(+), 1 deletions(-)

diff --git "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinPhoneSDK.m" "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinPhoneSDK.m"
index 75db80f..b0c8eed 100644
--- "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinPhoneSDK.m"
+++ "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinPhoneSDK.m"
@@ -43,6 +43,7 @@
 }
 
 -(void)login:(NSString*)username password:(NSString*)pwd domain:(NSString*) domain{
+    NSLog(@"sipDomain:%@",domain);
     [HDLLinphoneManager.instance login:username password:pwd domain:domain];
 }
 
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 b158f2b..cd5681e 100644
--- "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinphoneManager.m"
+++ "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinphoneManager.m"
@@ -1991,10 +1991,12 @@
 
 	signal(SIGPIPE, SIG_IGN);
 
+    NSLog(@"willCreateLinphoneCore");
 	// create linphone core
 	[self createLinphoneCore];
 	[self.providerDelegate config];
 //	_iapManager = [[InAppProductsManager alloc] init];
+    NSLog(@"CreatedLinphoneCore");
 
 	// - Security fix - remove multi transport migration, because it enables tcp or udp, if by factoring settings only
 	// tls is enabled. 	This is a problem for new installations.
@@ -2096,6 +2098,7 @@
 		return;
 	}
 
+    NSLog(@"Creating linphonecore");
 
 	// Set audio assets
 	NSString *ring =
@@ -2132,11 +2135,21 @@
 	linphone_core_cbs_set_version_update_check_result_received(cbs, linphone_iphone_version_update_check_result_received);
 	linphone_core_cbs_set_qrcode_found(cbs, linphone_iphone_qr_code_found);
 	linphone_core_cbs_set_user_data(cbs, (__bridge void *)(self));
+//    NSLog(@"Creating linphonecore1:%@",_configDb);
+    
+    lp_config_set_int(_configDb, [@"app" UTF8String], [@"random_port_preference" UTF8String], 1);
 
+    
 	theLinphoneCore = linphone_factory_create_core_with_config_3(factory, _configDb, NULL);
 	linphone_core_add_callbacks(theLinphoneCore, cbs);
 	linphone_core_start(theLinphoneCore);
-
+    //璁剧疆涓洪殢鏈虹鍙�
+    LinphoneSipTransports transportValue = {-1, -1, -1, -1};
+    // will also update the sip_*_port section of the config
+    if (linphone_core_set_sip_transports(theLinphoneCore, &transportValue)) {
+        LOGE(@"cannot set transport");
+    }
+    
     [self removeAllAccounts];
 	// Let the core handle cbs
 	linphone_core_cbs_unref(cbs);

--
Gitblit v1.8.0