From 8d81fc2ba11ded99ac347d08e0f484f0b8d2beba Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Tue, 20 Dec 2011 18:07:05 +0100 Subject: [PATCH] Multi call / conference tunnel support. --- .gitmodules | 3 --- Classes/LinphoneUI/LinphoneManager.m | 39 +++++++++++++-------------- linphone.xcodeproj/project.pbxproj | 6 ++++- submodules/build/Makefile | 18 ++++++------- submodules/build/builder-iphone-os.mk | 9 ++++--- submodules/build/builders.d/tunnel.mk | 4 +-- submodules/linphone | 2 +- submodules/tunnel | 1 - 8 files changed, 40 insertions(+), 42 deletions(-) delete mode 160000 submodules/tunnel diff --git a/.gitmodules b/.gitmodules index 43856086f..8ba0b2856 100644 --- a/.gitmodules +++ b/.gitmodules @@ -19,9 +19,6 @@ [submodule "submodules/libilbc-rfc3951"] path = submodules/libilbc-rfc3951 url = git://git.linphone.org/libilbc-rfc3951.git -[submodule "submodules/tunnel"] - path = submodules/tunnel - url = gitosis@git.linphone.org:tunnel.git [submodule "submodules/externals/opencore-amr"] path = submodules/externals/opencore-amr url = git://opencore-amr.git.sourceforge.net/gitroot/opencore-amr/opencore-amr diff --git a/Classes/LinphoneUI/LinphoneManager.m b/Classes/LinphoneUI/LinphoneManager.m index 9e0b9cd75..3cc0a437c 100644 --- a/Classes/LinphoneUI/LinphoneManager.m +++ b/Classes/LinphoneUI/LinphoneManager.m @@ -28,17 +28,14 @@ #import "FastAddressBook.h" #include -#include "tunnel/TunnelManager.hh" +#include "linphone_tunnel_manager.h" #import -using namespace belledonnecomm; - static LinphoneCore* theLinphoneCore=nil; static LinphoneManager* theLinphoneManager=nil; -static TunnelManager* sTunnelMgr=NULL; -extern "C" void libmsilbc_init(); +extern void libmsilbc_init(); #ifdef HAVE_AMR extern void libmsamr_init(); #endif @@ -397,12 +394,13 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach linphone_core_set_network_reachable([LinphoneManager getLc],false); ((LinphoneManager*)info).connectivity = none; } else { + LinphoneTunnelManager *tunnel=linphone_tunnel_get([LinphoneManager getLc]); Connectivity newConnectivity = flags & kSCNetworkReachabilityFlagsIsWWAN ? wwan:wifi; if (lLinphoneMgr.connectivity == none) { linphone_core_set_network_reachable([LinphoneManager getLc],true); } else if (lLinphoneMgr.connectivity != newConnectivity) { // connectivity has changed - if (sTunnelMgr) sTunnelMgr->reconnect(); //the reconnection will trigger re-registrations automatically + if (tunnel) linphone_tunnel_reconnect(tunnel); else { linphone_core_set_network_reachable([LinphoneManager getLc],false); linphone_core_set_network_reachable([LinphoneManager getLc],true); @@ -411,10 +409,10 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach lLinphoneMgr.connectivity=newConnectivity; switch (lLinphoneMgr.tunnelMode) { case wwan_only: - sTunnelMgr->enable(lLinphoneMgr.connectivity == wwan); + linphone_tunnel_enable(tunnel,lLinphoneMgr.connectivity == wwan); break; case autodetect: - sTunnelMgr->autoDetect(); + linphone_tunnel_auto_detect(tunnel); break; default: //nothing to do @@ -563,13 +561,16 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach NSString* lTunnelPrefEnabled = [[NSUserDefaults standardUserDefaults] stringForKey:@"tunnel_enabled_preference"]; NSString* lTunnelPrefAddress = [[NSUserDefaults standardUserDefaults] stringForKey:@"tunnel_address_preference"]; NSString* lTunnelPrefPort = [[NSUserDefaults standardUserDefaults] stringForKey:@"tunnel_port_preference"]; + LinphoneTunnelManager *tunnel=linphone_tunnel_get([LinphoneManager getLc]); int lTunnelPort = 443; if (lTunnelPrefPort && [lTunnelPrefPort length] > 0 && [lTunnelPrefPort intValue]) { lTunnelPort = [lTunnelPrefPort intValue]; } if (lTunnelPrefAddress && [lTunnelPrefAddress length]) { - sTunnelMgr->cleanServers(); - sTunnelMgr->addServer([lTunnelPrefAddress cStringUsingEncoding:[NSString defaultCStringEncoding]],lTunnelPort,12345/*default port*/,1000); + linphone_tunnel_clean_servers(tunnel); + linphone_tunnel_add_server_and_mirror(tunnel, + [lTunnelPrefAddress cStringUsingEncoding:[NSString defaultCStringEncoding]], + lTunnelPort,12345/*default port*/,1000); } if ([lTunnelPrefEnabled isEqualToString:@"off"]) { tunnelMode=off; @@ -583,19 +584,19 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach ms_error("Unexpected tunnel mode [%s]",[lTunnelPrefEnabled cStringUsingEncoding:[NSString defaultCStringEncoding]]); } switch (tunnelMode) { - case off: - sTunnelMgr->enable(false); + case off: + linphone_tunnel_enable(tunnel, false); break; case on: - sTunnelMgr->enable(true); + linphone_tunnel_enable(tunnel, true); break; case wwan_only: if (connectivity != wwan) { - sTunnelMgr->enable(false); + linphone_tunnel_enable(tunnel, false); } break; case autodetect: - sTunnelMgr->autoDetect(); + linphone_tunnel_auto_detect(tunnel); break; } @@ -692,10 +693,6 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach CFRelease(proxyReachability); proxyReachability=nil; } - if (sTunnelMgr) { - delete sTunnelMgr; - sTunnelMgr=NULL; - } } //**********************BG mode management*************************/////////// @@ -808,8 +805,8 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach , [confiFileName cStringUsingEncoding:[NSString defaultCStringEncoding]] , [factoryConfig cStringUsingEncoding:[NSString defaultCStringEncoding]] ,self); - sTunnelMgr = LinphoneCoreExtensionFactory::instance()->createTunnelManager(theLinphoneCore); - sTunnelMgr->enableLogs(linphone_iphone_log_handler); + + linphone_tunnel_enable_logs_with_handler(linphone_tunnel_get(theLinphoneCore),true,linphone_iphone_log_handler); [[NSUserDefaults standardUserDefaults] synchronize];//sync before loading config diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj index 455b9cd06..c9852bde6 100755 --- a/linphone.xcodeproj/project.pbxproj +++ b/linphone.xcodeproj/project.pbxproj @@ -236,6 +236,7 @@ 7066FC0C13E830E400EFC6DC /* libvpx.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7066FC0B13E830E400EFC6DC /* libvpx.a */; }; 70E542F313E147E3002BA2C0 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 70E542F213E147E3002BA2C0 /* OpenGLES.framework */; }; 70E542F513E147EB002BA2C0 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 70E542F413E147EB002BA2C0 /* QuartzCore.framework */; }; + F07EBD1D149F40A5006F61D2 /* libtunnel.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F07EBD1C149F40A5006F61D2 /* libtunnel.a */; }; F476004B147AAF2800FFF19B /* liblinphone.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2211DB911475562600DEE054 /* liblinphone.a */; }; F476004C147AAF4600FFF19B /* libmediastreamer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2211DB8F147555C800DEE054 /* libmediastreamer.a */; }; /* End PBXBuildFile section */ @@ -443,7 +444,7 @@ 2248E90C12F7E4CF00220D9C /* UIDigitButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIDigitButton.h; sourceTree = ""; }; 2248E90D12F7E4CF00220D9C /* UIDigitButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIDigitButton.m; sourceTree = ""; }; 2248E99D12F801C200220D9C /* LinphoneManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LinphoneManager.h; sourceTree = ""; }; - 2248E99E12F801C200220D9C /* LinphoneManager.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = LinphoneManager.m; sourceTree = ""; }; + 2248E99E12F801C200220D9C /* LinphoneManager.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.objc; fileEncoding = 4; path = LinphoneManager.m; sourceTree = ""; }; 2258633C11410BAC00C5A737 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = ""; }; 225CB2E811ABB51000628906 /* clavier-01-106px.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "clavier-01-106px.png"; path = "Resources/clavier-01-106px.png"; sourceTree = ""; }; 225CB2E911ABB51000628906 /* clavier-01-108px.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "clavier-01-108px.png"; path = "Resources/clavier-01-108px.png"; sourceTree = ""; }; @@ -598,6 +599,7 @@ 70E542F213E147E3002BA2C0 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; }; 70E542F413E147EB002BA2C0 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 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 = ""; }; + F07EBD1C149F40A5006F61D2 /* libtunnel.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libtunnel.a; path = "liblinphone-sdk/apple-darwin/lib/libtunnel.a"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -605,6 +607,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + F07EBD1D149F40A5006F61D2 /* libtunnel.a in Frameworks */, 344ABDF114850AE9007420B6 /* libc++.1.dylib in Frameworks */, 344ABDF214850AE9007420B6 /* libstdc++.6.dylib in Frameworks */, 344ABDE81484E723007420B6 /* libzrtpcpp.a in Frameworks */, @@ -1056,6 +1059,7 @@ 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { isa = PBXGroup; children = ( + F07EBD1C149F40A5006F61D2 /* libtunnel.a */, 5728D0B8149668000050AD1B /* TunnelManager.cc */, 344ABDEF14850AE9007420B6 /* libc++.1.dylib */, 344ABDF014850AE9007420B6 /* libstdc++.6.dylib */, diff --git a/submodules/build/Makefile b/submodules/build/Makefile index 6dbb02ecf..4f82677e2 100644 --- a/submodules/build/Makefile +++ b/submodules/build/Makefile @@ -43,21 +43,21 @@ warning: endif build: - make -f builder-iphone-os.mk all build-tunnel enable_gpl_third_parties=$(enable_gpl_third_parties) \ - && make -f builder-iphone-simulator.mk all build-tunnel enable_gpl_third_parties=$(enable_gpl_third_parties)\ - && make -f builder-iphone-os.mk host=armv7-apple-darwin all build-tunnel enable_gpl_third_parties=$(enable_gpl_third_parties)\ + make -f builder-iphone-os.mk all enable_gpl_third_parties=$(enable_gpl_third_parties) \ + && make -f builder-iphone-simulator.mk all enable_gpl_third_parties=$(enable_gpl_third_parties)\ + && make -f builder-iphone-os.mk host=armv7-apple-darwin all enable_gpl_third_parties=$(enable_gpl_third_parties)\ && make -f builder-iphone-os.mk delivery-sdk clean: - make -f builder-iphone-simulator.mk clean clean-tunnel\ - && make -f builder-iphone-os.mk clean clean-tunnel\ - && make -f builder-iphone-os.mk host=armv7-apple-darwin clean clean-tunnel + make -f builder-iphone-simulator.mk clean\ + && make -f builder-iphone-os.mk clean\ + && make -f builder-iphone-os.mk host=armv7-apple-darwin clean clean-makefile: make -f builder-iphone-simulator.mk clean-makefile \ && make -f builder-iphone-os.mk clean-makefile \ && make -f builder-iphone-os.mk host=armv7-apple-darwin clean-makefile veryclean: - make -f builder-iphone-simulator.mk veryclean veryclean-tunnel\ - && make -f builder-iphone-os.mk veryclean veryclean-tunnel\ - && make -f builder-iphone-os.mk host=armv7-apple-darwin veryclean veryclean-tunnel + make -f builder-iphone-simulator.mk veryclean\ + && make -f builder-iphone-os.mk veryclean\ + && make -f builder-iphone-os.mk host=armv7-apple-darwin veryclean diff --git a/submodules/build/builder-iphone-os.mk b/submodules/build/builder-iphone-os.mk index c55d0cc8e..e928ec64c 100644 --- a/submodules/build/builder-iphone-os.mk +++ b/submodules/build/builder-iphone-os.mk @@ -36,6 +36,7 @@ linphone_configure_controls= \ --disable-x11 \ --with-gsm=$(prefix) \ --disable-tests \ + --enable-tunnel \ --with-srtp=$(prefix) #path @@ -103,17 +104,17 @@ veryclean: veryclean-linphone rm -rf $(BUILDER_BUILD_DIR) -.NOTPARALLEL build-linphone: init build-openssl build-srtp build-zrtpcpp build-osip2 build-eXosip2 build-speex build-libgsm build-ffmpeg build-libvpx detect_gpl_mode_switch $(LINPHONE_BUILD_DIR)/Makefile +.NOTPARALLEL build-linphone: init build-openssl build-tunnel build-srtp build-zrtpcpp build-osip2 build-eXosip2 build-speex build-libgsm build-ffmpeg build-libvpx detect_gpl_mode_switch $(LINPHONE_BUILD_DIR)/Makefile cd $(LINPHONE_BUILD_DIR) && export PKG_CONFIG_PATH=$(prefix)/lib/pkgconfig export CONFIG_SITE=$(BUILDER_SRC_DIR)/build/$(config_site) make newdate && make && make install -clean-linphone: clean-osip2 clean-eXosip2 clean-speex clean-libgsm clean-srtp clean-zrtpcpp clean-msilbc clean-libilbc clean-openssl clean-msamr clean-mssilk clean-ffmpeg clean-libvpx clean-msx264 +clean-linphone: clean-osip2 clean-eXosip2 clean-speex clean-libgsm clean-srtp clean-zrtpcpp clean-msilbc clean-libilbc clean-tunnel clean-openssl clean-msamr clean-mssilk clean-ffmpeg clean-libvpx clean-msx264 cd $(LINPHONE_BUILD_DIR) && make clean -veryclean-linphone: veryclean-osip2 veryclean-eXosip2 veryclean-speex veryclean-srtp veryclean-zrtpcpp veryclean-libgsm veryclean-msilbc veryclean-libilbc veryclean-openssl veryclean-msamr veryclean-mssilk veryclean-msx264 +veryclean-linphone: veryclean-osip2 veryclean-eXosip2 veryclean-speex veryclean-srtp veryclean-zrtpcpp veryclean-libgsm veryclean-msilbc veryclean-libilbc veryclean-tunnel veryclean-openssl veryclean-msamr veryclean-mssilk veryclean-msx264 #-cd $(LINPHONE_BUILD_DIR) && make distclean -cd $(LINPHONE_SRC_DIR) && rm -f configure -clean-makefile-linphone: clean-makefile-osip2 clean-makefile-eXosip2 clean-makefile-speex clean-makefile-srtp clean-makefile-zrtpcpp clean-makefile-libilbc clean-makefile-msilbc clean-makefile-openssl clean-makefile-msamr clean-makefile-ffmpeg clean-makefile-libvpx clean-makefile-mssilk +clean-makefile-linphone: clean-makefile-osip2 clean-makefile-eXosip2 clean-makefile-speex clean-makefile-srtp clean-makefile-zrtpcpp clean-makefile-libilbc clean-makefile-msilbc clean-makefile-tunnel clean-makefile-openssl clean-makefile-msamr clean-makefile-ffmpeg clean-makefile-libvpx clean-makefile-mssilk cd $(LINPHONE_BUILD_DIR) && rm -f Makefile && rm -f oRTP/Makefile && rm -f mediastreamer2/Makefile diff --git a/submodules/build/builders.d/tunnel.mk b/submodules/build/builders.d/tunnel.mk index 4ba2a89b6..d9a4aeb64 100644 --- a/submodules/build/builders.d/tunnel.mk +++ b/submodules/build/builders.d/tunnel.mk @@ -1,5 +1,5 @@ -TUNNEL_SRC_DIR?=$(BUILDER_SRC_DIR)/tunnel -TUNNEL_BUILD_DIR?=$(BUILDER_BUILD_DIR)/tunnel +TUNNEL_SRC_DIR?=$(BUILDER_SRC_DIR)/linphone/tunnel +TUNNEL_BUILD_DIR?=$(BUILDER_BUILD_DIR)/linphone/tunnel #############################TUNNEL############################ $(TUNNEL_SRC_DIR)/configure: diff --git a/submodules/linphone b/submodules/linphone index 58edf8b15..851420c80 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 58edf8b150c3be8c55c21cc0db82f4779d8d3360 +Subproject commit 851420c800edfb57e38fc83075244f6e9f10dc1d diff --git a/submodules/tunnel b/submodules/tunnel deleted file mode 160000 index 8891cdc06..000000000 --- a/submodules/tunnel +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8891cdc06a4900121919387102aaa967747ed41b