From 44466fb57f887e24df3df96d92171250be70fcf6 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Wed, 17 Aug 2011 09:13:55 +0200 Subject: [PATCH] ios: enable TLS support --- Classes/LinphoneUI/LinphoneManager.m | 23 ++++++++++++++++------- Settings.bundle/Root.plist | 2 ++ linphone.xcodeproj/project.pbxproj | 4 ++++ submodules/externals/exosip | 2 +- submodules/externals/osip | 2 +- 5 files changed, 24 insertions(+), 9 deletions(-) diff --git a/Classes/LinphoneUI/LinphoneManager.m b/Classes/LinphoneUI/LinphoneManager.m index 7f93a6de0..84beb8fd5 100644 --- a/Classes/LinphoneUI/LinphoneManager.m +++ b/Classes/LinphoneUI/LinphoneManager.m @@ -364,6 +364,12 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach else { linphone_core_disable_logs(); } + + NSBundle* myBundle = [NSBundle mainBundle]; + + const char* lRootCa = [[myBundle pathForResource:@"rootca"ofType:@"pem"] cStringUsingEncoding:[NSString defaultCStringEncoding]]; + linphone_core_set_root_ca(theLinphoneCore, lRootCa); + NSString* transport = [[NSUserDefaults standardUserDefaults] stringForKey:@"transport_preference"]; @@ -376,9 +382,15 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach if ([transport isEqualToString:@"tcp"]) { if (transportValue.tcp_port == 0) transportValue.tcp_port=transportValue.udp_port; transportValue.udp_port=0; + transportValue.tls_port=0; } else if ([transport isEqualToString:@"udp"]){ if (transportValue.udp_port == 0) transportValue.udp_port=transportValue.tcp_port; transportValue.tcp_port=0; + transportValue.tls_port=0; + } else if ([transport isEqualToString:@"tls"]){ + if (transportValue.tls_port == 0) transportValue.tls_port=transportValue.udp_port; + transportValue.tcp_port=0; + transportValue.udp_port=0; } else { ms_error("unexpected trasnport [%s]",[transport cStringUsingEncoding:[NSString defaultCStringEncoding]]); } @@ -387,17 +399,14 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach } } - - - + + // Set audio assets - NSBundle* myBundle = [NSBundle mainBundle]; const char* lRing = [[myBundle pathForResource:@"oldphone-mono"ofType:@"wav"] cStringUsingEncoding:[NSString defaultCStringEncoding]]; linphone_core_set_ring(theLinphoneCore, lRing ); const char* lRingBack = [[myBundle pathForResource:@"ringback"ofType:@"wav"] cStringUsingEncoding:[NSString defaultCStringEncoding]]; linphone_core_set_ringback(theLinphoneCore, lRingBack); - - + //configure sip account @@ -435,7 +444,7 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach //possible valid config detected LinphoneProxyConfig* proxyCfg; proxyCfg = linphone_proxy_config_new(); - + // add username password LinphoneAddress *from = linphone_address_new(identity); LinphoneAuthInfo *info; diff --git a/Settings.bundle/Root.plist b/Settings.bundle/Root.plist index 5b703ede8..7715921d9 100644 --- a/Settings.bundle/Root.plist +++ b/Settings.bundle/Root.plist @@ -213,6 +213,7 @@ udp tcp + tls Type PSMultiValueSpecifier @@ -220,6 +221,7 @@ udp tcp + tls diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj index e2c019e64..5f286dc81 100755 --- a/linphone.xcodeproj/project.pbxproj +++ b/linphone.xcodeproj/project.pbxproj @@ -84,6 +84,7 @@ 22F254811073D99800AC9B3F /* ringback.wav in Resources */ = {isa = PBXBuildFile; fileRef = 22F254801073D99800AC9B3F /* ringback.wav */; }; 22F51EF6107FA66500F98953 /* untitled.plist in Resources */ = {isa = PBXBuildFile; fileRef = 22F51EF5107FA66500F98953 /* untitled.plist */; }; 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765FC0DF74451002DB57D /* CoreGraphics.framework */; }; + 70571E1A13FABCB000CDD3C2 /* rootca.pem in Resources */ = {isa = PBXBuildFile; fileRef = 70571E1913FABCB000CDD3C2 /* rootca.pem */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -394,6 +395,7 @@ 288765FC0DF74451002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 32CA4F630368D1EE00C91783 /* linphone_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = linphone_Prefix.pch; sourceTree = ""; }; + 70571E1913FABCB000CDD3C2 /* rootca.pem */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = rootca.pem; path = Resources/rootca.pem; sourceTree = ""; }; 8D1107310486CEB800E47090 /* linphone-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "linphone-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -833,6 +835,7 @@ 29B97317FDCFA39411CA2CEA /* Resources */ = { isa = PBXGroup; children = ( + 70571E1913FABCB000CDD3C2 /* rootca.pem */, 22E19E47138A67A000FBFE87 /* missed_call.png */, 228B19AE130290C500F154D3 /* iTunesArtwork */, 2242E312125235120061DDCE /* oldphone-mono-30s.caf */, @@ -970,6 +973,7 @@ 228B19AF130290C500F154D3 /* iTunesArtwork in Resources */, 2214783D1386A2030020F8B8 /* Localizable.strings in Resources */, 22E19E48138A67A000FBFE87 /* missed_call.png in Resources */, + 70571E1A13FABCB000CDD3C2 /* rootca.pem in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/submodules/externals/exosip b/submodules/externals/exosip index 361a5cfe2..ce927e6b8 160000 --- a/submodules/externals/exosip +++ b/submodules/externals/exosip @@ -1 +1 @@ -Subproject commit 361a5cfe25a31d503b0d9e46960d6908c6672aad +Subproject commit ce927e6b891a9d9129ab50d0666f6f22f37228a1 diff --git a/submodules/externals/osip b/submodules/externals/osip index 5a3da085c..7dbd4b443 160000 --- a/submodules/externals/osip +++ b/submodules/externals/osip @@ -1 +1 @@ -Subproject commit 5a3da085ca1dcf82a852cee1e191cab0b98ff1f1 +Subproject commit 7dbd4b443eed178480b76498173e7bffc7e73d00