diff --git a/.gitmodules b/.gitmodules index 997c89307..21941b57f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -19,3 +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 diff --git a/Classes/LinphoneUI/LinphoneManager.h b/Classes/LinphoneUI/LinphoneManager.h index d817f5964..a5b55dbd7 100644 --- a/Classes/LinphoneUI/LinphoneManager.h +++ b/Classes/LinphoneUI/LinphoneManager.h @@ -28,6 +28,7 @@ typedef enum _Connectivity { ,none } Connectivity; + @interface LinphoneManager : NSObject { @private SCNetworkReachabilityContext proxyReachabilityContext; diff --git a/Classes/LinphoneUI/LinphoneManager.m b/Classes/LinphoneUI/LinphoneManager.m index f97158161..748a5d191 100644 --- a/Classes/LinphoneUI/LinphoneManager.m +++ b/Classes/LinphoneUI/LinphoneManager.m @@ -25,18 +25,23 @@ #include #import #import +#include "TunnelManager.hh" + +using namespace belledonnecomm; static LinphoneCore* theLinphoneCore=nil; static LinphoneManager* theLinphoneManager=nil; +static TunnelManager* sTunnelMgr=NULL; -extern void libmsilbc_init(); - +extern "C" void libmsilbc_init(); @implementation LinphoneManager @synthesize callDelegate; @synthesize registrationDelegate; @synthesize connectivity; + + +(LinphoneManager*) instance { if (theLinphoneManager==nil) { theLinphoneManager = [LinphoneManager alloc]; @@ -223,21 +228,8 @@ static void linphone_iphone_call_state(LinphoneCore *lc, LinphoneCall* call, Lin static void linphone_iphone_registration_state(LinphoneCore *lc, LinphoneProxyConfig* cfg, LinphoneRegistrationState state,const char* message) { [(LinphoneManager*)linphone_core_get_user_data(lc) onRegister:lc cfg:cfg state:state message:message]; } -static LinphoneCoreVTable linphonec_vtable = { - .show =NULL, - .call_state_changed =(LinphoneCallStateCb)linphone_iphone_call_state, - .registration_state_changed = linphone_iphone_registration_state, - .notify_recv = NULL, - .new_subscription_request = NULL, - .auth_info_requested = NULL, - .display_status = linphone_iphone_display_status, - .display_message=linphone_iphone_log, - .display_warning=linphone_iphone_log, - .display_url=NULL, - .text_received=NULL, - .dtmf_received=NULL -}; +static LinphoneCoreVTable linphonec_vtable; -(void) configurePayloadType:(const char*) type fromPrefKey: (NSString*)key withRate:(int)rate { if ([[NSUserDefaults standardUserDefaults] boolForKey:key]) { @@ -414,6 +406,16 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach proxyReachability=SCNetworkReachabilityCreateWithName(nil, "linphone.org"); } proxyReachabilityContext.info=self; + //tunnel + BOOL lTunnelPrefEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:@"tunnel_enabled_preference"]; + NSString* lTunnelPrefAddress = [[NSUserDefaults standardUserDefaults] stringForKey:@"tunnel_address_preference"]; + + if (lTunnelPrefAddress && [lTunnelPrefAddress length]) { + sTunnelMgr->cleanServers(); + sTunnelMgr->addServer([lTunnelPrefAddress cStringUsingEncoding:[NSString defaultCStringEncoding]],443); + } + sTunnelMgr->enable(lTunnelPrefEnabled); + SCNetworkReachabilitySetCallback(proxyReachability, (SCNetworkReachabilityCallBack)networkReachabilityCallBack,&proxyReachabilityContext); SCNetworkReachabilityScheduleWithRunLoop(proxyReachability, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); @@ -456,11 +458,15 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach } } -(void) destroyLibLinphone { - [mIterateTimer invalidate]; + [mIterateTimer invalidate]; if (theLinphoneCore != nil) { //just in case application terminate before linphone core initialization linphone_core_destroy(theLinphoneCore); theLinphoneCore = nil; } + if (sTunnelMgr) { + delete sTunnelMgr; + sTunnelMgr=NULL; + } } //**********************BG mode management*************************/////////// @@ -559,9 +565,6 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach } - - - /************* *lib linphone init method */ @@ -573,7 +576,8 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *confiFileName = [[paths objectAtIndex:0] stringByAppendingString:@"/.linphonerc"]; connectivity=none; - signal(SIGPIPE, SIG_IGN); + + //log management if ([[NSUserDefaults standardUserDefaults] boolForKey:@"debugenable_preference"]) { @@ -590,10 +594,25 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach * Initialize linphone core */ + linphonec_vtable.show =NULL; + linphonec_vtable.call_state_changed =(LinphoneCallStateCb)linphone_iphone_call_state; + linphonec_vtable.registration_state_changed = linphone_iphone_registration_state; + linphonec_vtable.notify_recv = NULL; + linphonec_vtable.new_subscription_request = NULL; + linphonec_vtable.auth_info_requested = NULL; + linphonec_vtable.display_status = linphone_iphone_display_status; + linphonec_vtable.display_message=linphone_iphone_log; + linphonec_vtable.display_warning=linphone_iphone_log; + linphonec_vtable.display_url=NULL; + linphonec_vtable.text_received=NULL; + linphonec_vtable.dtmf_received=NULL; + theLinphoneCore = linphone_core_new (&linphonec_vtable , [confiFileName cStringUsingEncoding:[NSString defaultCStringEncoding]] , [factoryConfig cStringUsingEncoding:[NSString defaultCStringEncoding]] ,self); + sTunnelMgr = LinphoneCoreExtensionFactory::instance()->createTunnelManager(theLinphoneCore); + sTunnelMgr->enableLogs(linphone_iphone_log_handler); [[NSUserDefaults standardUserDefaults] synchronize];//sync before loading config [ self doLinphoneConfiguration:nil]; diff --git a/README.tunnel b/README.tunnel new file mode 100644 index 000000000..1e8f3108b --- /dev/null +++ b/README.tunnel @@ -0,0 +1,2 @@ +to build liblinphone sdk with tunnel, execute: +make -f builder-iphone-simulator.mk all build-tunnel && make -f builder-iphone-os.mk all build-tunnel &&make -f builder-iphone-os.mk delivery-sdk diff --git a/Settings.bundle/Root.plist b/Settings.bundle/Root.plist index 822a62a4c..5247438e7 100644 --- a/Settings.bundle/Root.plist +++ b/Settings.bundle/Root.plist @@ -160,6 +160,30 @@ DefaultValue + + Type + PSGroupSpecifier + Title + Tunnel + + + Type + PSTextFieldSpecifier + Title + Address + Key + tunnel_address_preference + + + Type + PSToggleSwitchSpecifier + Title + Enable + Key + tunnel_enabled_preference + DefaultValue + + Type PSGroupSpecifier diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj index 6c18177ba..af010f5bb 100755 --- a/linphone.xcodeproj/project.pbxproj +++ b/linphone.xcodeproj/project.pbxproj @@ -33,6 +33,7 @@ 222A483412F7176F0075F07F /* IncallViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 222A483112F7176F0075F07F /* IncallViewController.xib */; }; 223148E41178A08200637D6A /* libilbc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 223148E31178A08200637D6A /* libilbc.a */; }; 223148E61178A09900637D6A /* libmsilbc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 223148E51178A09900637D6A /* libmsilbc.a */; }; + 22323037132A28AE00F10886 /* TunnelManager.cc in Sources */ = {isa = PBXBuildFile; fileRef = 22323036132A28AE00F10886 /* TunnelManager.cc */; }; 2237D4091084D7A9001383EE /* oldphone-mono.wav in Resources */ = {isa = PBXBuildFile; fileRef = 2237D4081084D7A9001383EE /* oldphone-mono.wav */; }; 2242D91610D66BF300E9963F /* in_call.png in Resources */ = {isa = PBXBuildFile; fileRef = 2242D91410D66BF300E9963F /* in_call.png */; }; 2242D91710D66BF300E9963F /* out_call.png in Resources */ = {isa = PBXBuildFile; fileRef = 2242D91510D66BF300E9963F /* out_call.png */; }; @@ -64,6 +65,7 @@ 22B5EFA310CE50BD00777D97 /* AddressBookUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 22B5EFA210CE50BD00777D97 /* AddressBookUI.framework */; }; 22B5EFE510CE5E5800777D97 /* ContactPickerDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 22B5EFE410CE5E5800777D97 /* ContactPickerDelegate.m */; }; 22B5F03510CE6B2F00777D97 /* AddressBook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 22B5F03410CE6B2F00777D97 /* AddressBook.framework */; }; + 22BB1B9313311915005CD7AA /* libtunnel.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 22BB1B9213311915005CD7AA /* libtunnel.a */; }; 22C755601317E59C007BC101 /* UIBluetoothButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 22C7555F1317E59C007BC101 /* UIBluetoothButton.m */; }; 22C7564D13265CF8007BC101 /* libcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 22C7564C13265CF8007BC101 /* libcrypto.a */; }; 22C7564F13265CF8007BC101 /* libssl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 22C7564E13265CF8007BC101 /* libssl.a */; }; @@ -249,6 +251,11 @@ 222A483312F7176F0075F07F /* IncallViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IncallViewController.h; sourceTree = ""; }; 223148E31178A08200637D6A /* libilbc.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libilbc.a; path = "liblinphone-sdk/apple-darwin/lib/libilbc.a"; sourceTree = ""; }; 223148E51178A09900637D6A /* libmsilbc.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libmsilbc.a; path = "liblinphone-sdk/apple-darwin/lib/mediastreamer/plugins/libmsilbc.a"; sourceTree = ""; }; + 22323035132A28AE00F10886 /* TunnelManager.hh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = TunnelManager.hh; sourceTree = ""; }; + 22323036132A28AE00F10886 /* TunnelManager.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TunnelManager.cc; sourceTree = ""; }; + 22323039132A290F00F10886 /* eXosip_transport_hook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = eXosip_transport_hook.h; sourceTree = ""; }; + 22323045132A2F4400F10886 /* client.hh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = client.hh; sourceTree = ""; }; + 22323046132A2F4400F10886 /* common.hh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = common.hh; sourceTree = ""; }; 2237D4081084D7A9001383EE /* oldphone-mono.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = "oldphone-mono.wav"; path = "liblinphone-sdk/apple-darwin/share/sounds/linphone/rings/oldphone-mono.wav"; sourceTree = ""; }; 2242D91410D66BF300E9963F /* in_call.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = in_call.png; path = Resources/in_call.png; sourceTree = ""; }; 2242D91510D66BF300E9963F /* out_call.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = out_call.png; path = Resources/out_call.png; sourceTree = ""; }; @@ -262,7 +269,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; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LinphoneManager.m; sourceTree = ""; }; + 2248E99E12F801C200220D9C /* LinphoneManager.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; 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 = ""; }; @@ -288,6 +295,7 @@ 22B5EFE310CE5E5800777D97 /* ContactPickerDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContactPickerDelegate.h; sourceTree = ""; }; 22B5EFE410CE5E5800777D97 /* ContactPickerDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ContactPickerDelegate.m; sourceTree = ""; }; 22B5F03410CE6B2F00777D97 /* AddressBook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBook.framework; path = System/Library/Frameworks/AddressBook.framework; sourceTree = SDKROOT; }; + 22BB1B9213311915005CD7AA /* libtunnel.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libtunnel.a; path = "/Users/jehanmonnier/workspaces/workspace-iphone-port/linphone-iphone/liblinphone-sdk/apple-darwin/lib/libtunnel.a"; sourceTree = ""; }; 22C7555E1317E59C007BC101 /* UIBluetoothButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIBluetoothButton.h; sourceTree = ""; }; 22C7555F1317E59C007BC101 /* UIBluetoothButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIBluetoothButton.m; sourceTree = ""; }; 22C7560513265C6A007BC101 /* aes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aes.h; sourceTree = ""; }; @@ -411,6 +419,7 @@ 2252941412F6DAA400DD9BFB /* libmediastreamer.a in Frameworks */, 22C7564D13265CF8007BC101 /* libcrypto.a in Frameworks */, 22C7564F13265CF8007BC101 /* libssl.a in Frameworks */, + 22BB1B9313311915005CD7AA /* libtunnel.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -460,6 +469,7 @@ 220FAC77107654FC0068D98F /* include */ = { isa = PBXGroup; children = ( + 22323044132A2F4400F10886 /* tunnel */, 22C7560413265C6A007BC101 /* openssl */, 220FAC78107654FC0068D98F /* eXosip2 */, 220FAC82107654FC0068D98F /* gsm */, @@ -477,6 +487,7 @@ 220FAC78107654FC0068D98F /* eXosip2 */ = { isa = PBXGroup; children = ( + 22323039132A290F00F10886 /* eXosip_transport_hook.h */, 220FAC79107654FC0068D98F /* eX_call.h */, 220FAC7A107654FC0068D98F /* eX_message.h */, 220FAC7B107654FC0068D98F /* eX_options.h */, @@ -673,6 +684,25 @@ path = LinphoneUI; sourceTree = ""; }; + 22323023132A286700F10886 /* src */ = { + isa = PBXGroup; + children = ( + 22323035132A28AE00F10886 /* TunnelManager.hh */, + 22323036132A28AE00F10886 /* TunnelManager.cc */, + ); + name = src; + path = submodules/tunnel/src; + sourceTree = ""; + }; + 22323044132A2F4400F10886 /* tunnel */ = { + isa = PBXGroup; + children = ( + 22323045132A2F4400F10886 /* client.hh */, + 22323046132A2F4400F10886 /* common.hh */, + ); + path = tunnel; + sourceTree = ""; + }; 22A10D9F11F88C1F00373793 /* Products */ = { isa = PBXGroup; children = ( @@ -762,6 +792,7 @@ 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { isa = PBXGroup; children = ( + 22323023132A286700F10886 /* src */, 22A10D9E11F88C1F00373793 /* liblinphone.xcodeproj */, 223148E51178A09900637D6A /* libmsilbc.a */, 223148E31178A08200637D6A /* libilbc.a */, @@ -794,6 +825,7 @@ 22D1B68012A3E0BE001AE361 /* libresolv.dylib */, 22C7564C13265CF8007BC101 /* libcrypto.a */, 22C7564E13265CF8007BC101 /* libssl.a */, + 22BB1B9213311915005CD7AA /* libtunnel.a */, ); name = CustomTemplate; sourceTree = ""; @@ -971,6 +1003,7 @@ 22968A8812F87C2000588287 /* UIDuration.m in Sources */, 2218A92512FBE1340088A667 /* FirstLoginViewController.m in Sources */, 22C755601317E59C007BC101 /* UIBluetoothButton.m in Sources */, + 22323037132A28AE00F10886 /* TunnelManager.cc in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -998,6 +1031,7 @@ submodules/externals/osip/include, submodules/externals/exosip/include, submodules/externals/speex/include, + submodules/tunnel/include, ); INFOPLIST_FILE = "linphone-Info.plist"; LIBRARY_SEARCH_PATHS = ( diff --git a/submodules/build/builder-iphone-os.mk b/submodules/build/builder-iphone-os.mk index ba696b29b..3c35c0a72 100644 --- a/submodules/build/builder-iphone-os.mk +++ b/submodules/build/builder-iphone-os.mk @@ -218,7 +218,7 @@ build-msilbc: build-libilbc $(MSILBC_BUILD_DIR)/Makefile cd $(MSILBC_BUILD_DIR) && make && make install clean-msilbc: - cd $(MSILBC_BUILD_DIR) && make -f clean + cd $(MSILBC_BUILD_DIR) && make clean veryclean-msilbc: cd $(MSILBC_BUILD_DIR) && make distclean @@ -255,6 +255,9 @@ clean-makefile-libilbc: $(prefix)/include/openssl/ssl.h: cd $(prefix) \ && unzip $(BUILDER_SRC_DIR)/prebuilt/$(OPENSSL_ZIP) +#include extensions + +include builders.d/*.mk #sdk generation and distribution diff --git a/submodules/build/builders.d/tunnel.mk b/submodules/build/builders.d/tunnel.mk new file mode 100644 index 000000000..a40afd1f2 --- /dev/null +++ b/submodules/build/builders.d/tunnel.mk @@ -0,0 +1,26 @@ +TUNNEL_SRC_DIR?=$(BUILDER_SRC_DIR)/tunnel +TUNNEL_BUILD_DIR?=$(BUILDER_BUILD_DIR)/tunnel + +#############################TUNNEL############################ +$(TUNNEL_SRC_DIR)/configure: + cd $(TUNNEL_SRC_DIR) && ./autogen.sh + +$(TUNNEL_BUILD_DIR)/Makefile: $(TUNNEL_SRC_DIR)/configure + mkdir -p $(TUNNEL_BUILD_DIR) \ + && cd $(TUNNEL_BUILD_DIR) \ + && OPENSSL_CFLAGS="-I$(prefix)/include" OPENSSL_LIBS="-L$(prefix)/lib -lssl -lcrypto" CONFIG_SITE=$(BUILDER_SRC_DIR)/build/$(config_site) \ + $(TUNNEL_SRC_DIR)/configure -prefix=$(prefix) --host=$(host) ${library_mode} + +build-tunnel: $(TUNNEL_BUILD_DIR)/Makefile + cd $(TUNNEL_BUILD_DIR) && make && make install + +clean-tunnel: + cd $(TUNNEL_BUILD_DIR) && make clean + +veryclean-tunnel: + cd $(TUNNEL_BUILD_DIR) && make distclean + +clean-makefile-tunnel: + cd $(TUNNEL_BUILD_DIR) && rm -f Makefile + + diff --git a/submodules/externals/exosip b/submodules/externals/exosip index c498540b0..126211555 160000 --- a/submodules/externals/exosip +++ b/submodules/externals/exosip @@ -1 +1 @@ -Subproject commit c498540b054cc42f731c2dfd4f4c6b27e04330e0 +Subproject commit 1262115554eff2f900ff20ac992e47272017f429 diff --git a/submodules/tunnel b/submodules/tunnel new file mode 160000 index 000000000..c17f2142d --- /dev/null +++ b/submodules/tunnel @@ -0,0 +1 @@ +Subproject commit c17f2142dadfba0f7f0bc5a92c680c845b56686a