diff --git a/Classes/LinphoneAppDelegate.h b/Classes/LinphoneAppDelegate.h index 0de437353..f13b8cb84 100644 --- a/Classes/LinphoneAppDelegate.h +++ b/Classes/LinphoneAppDelegate.h @@ -20,6 +20,7 @@ #import #import +#import "CoreTelephony/CTCallCenter.h" #define DIALER_TAB_INDEX 1 #define CONTACTS_TAB_INDEX 2 @@ -39,9 +40,14 @@ IBOutlet PhoneViewController* myPhoneViewController; CallHistoryTableViewController* myCallHistoryTableViewController; ContactPickerDelegate* myContactPickerDelegate; - + + CTCallCenter* callCenter; } +- (void) loadDefaultSettings:(NSDictionary *) appDefaults; +-(void) setupUI; +-(void) setupGSMInteraction; + @property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic, retain) IBOutlet UITabBarController* myTabBarController; @property (nonatomic, retain) ABPeoplePickerNavigationController* myPeoplePickerController; diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index 3f9ebdc61..c397dc18f 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -22,6 +22,9 @@ #import "ContactPickerDelegate.h" #import "AddressBook/ABPerson.h" +#import "CoreTelephony/CTCallCenter.h" +#import "CoreTelephony/CTCall.h" + #import "ConsoleViewController.h" #import "MoreViewController.h" #include "CallHistoryTableViewController.h" @@ -43,6 +46,24 @@ int __aeabi_idiv(int a, int b) { @synthesize myPeoplePickerController; @synthesize myPhoneViewController; +-(void) handleGSMCallInteration: (id) cCenter { + CTCallCenter* ct = (CTCallCenter*) cCenter; + + int callCount = [ct.currentCalls count]; + if (!callCount) { + NSLog(@"No GSM call -> enabling SIP calls"); + linphone_core_set_max_calls([LinphoneManager getLc], 3); + } else { + NSLog(@"%d GSM call(s) -> disabling SIP calls", callCount); + /* pause current call, if any */ + LinphoneCall* call = linphone_core_get_current_call([LinphoneManager getLc]); + if (call) { + NSLog(@"Pausing SIP call"); + linphone_core_pause_call([LinphoneManager getLc], call); + } + linphone_core_set_max_calls([LinphoneManager getLc], 0); + } +} -(void)applicationWillResignActive:(UIApplication *)application { LinphoneCore* lc = [LinphoneManager getLc]; @@ -62,11 +83,31 @@ int __aeabi_idiv(int a, int b) { } - (void)applicationDidEnterBackground:(UIApplication *)application { - [[LinphoneManager instance] enterBackgroundMode]; + if (![[LinphoneManager instance] enterBackgroundMode]) { + // destroying eventHandler if app cannot go in background. + // Otherwise if a GSM call happen and Linphone is resumed, + // the handler will be called before LinphoneCore is built. + // Then handler will be restored in appDidBecomeActive cb + callCenter.callEventHandler = nil; + [callCenter release]; + callCenter = nil; + } } - (void)applicationDidBecomeActive:(UIApplication *)application { [[LinphoneManager instance] becomeActive]; + if (callCenter == nil) { + callCenter = [[CTCallCenter alloc] init]; + callCenter.callEventHandler = ^(CTCall* call) { + // post on main thread + [self performSelectorOnMainThread:@selector(handleGSMCallInteration:) + withObject:callCenter + waitUntilDone:YES]; + }; + } + // check call state at startup + [self handleGSMCallInteration:callCenter]; + LinphoneCore* lc = [LinphoneManager getLc]; LinphoneCall* call = linphone_core_get_current_call(lc); if (call == NULL) @@ -84,7 +125,7 @@ int __aeabi_idiv(int a, int b) { } } -- (void) loadDefaultSettings { +- (void) loadDefaultSettings:(NSDictionary *) appDefaults { NSString *settingsBundle = [[NSBundle mainBundle] pathForResource:@"Settings" ofType:@"bundle"]; if(!settingsBundle) { @@ -108,32 +149,14 @@ int __aeabi_idiv(int a, int b) { [defaultsToRegister setObject:[prefSpecification objectForKey:@"DefaultValue"] forKey:key]; } } - - NSDictionary *appDefaults = [NSDictionary dictionaryWithObjectsAndKeys: - @"NO", @"enable_first_login_view_preference", // -#ifdef HAVE_AMR - @"YES",@"amr_8k_preference", // enable amr by default if compiled with -#endif -#ifdef HAVE_G729 - @"YES",@"g729_preference", // enable amr by default if compiled with -#endif - @"NO",@"debugenable_preference", - //@"+33",@"countrycode_preference", - nil]; - [defaultsToRegister addEntriesFromDictionary:appDefaults]; [[NSUserDefaults standardUserDefaults] registerDefaults:defaultsToRegister]; [defaultsToRegister release]; [[NSUserDefaults standardUserDefaults] synchronize]; - } -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ - - /* - *Custumization - */ - [self loadDefaultSettings]; - //as defined in PhoneMainView.xib + +-(void) setupUI { + //as defined in PhoneMainView.xib //dialer myPhoneViewController = (PhoneViewController*) [myTabBarController.viewControllers objectAtIndex: DIALER_TAB_INDEX]; myPhoneViewController.myTabBarController = myTabBarController; @@ -175,10 +198,44 @@ int __aeabi_idiv(int a, int b) { [window makeKeyAndVisible]; [[LinphoneManager instance] setCallDelegate:myPhoneViewController]; +} + +-(void) setupGSMInteraction { + callCenter = [[CTCallCenter alloc] init]; + callCenter.callEventHandler = ^(CTCall* call) { + // post on main thread + [self performSelectorOnMainThread:@selector(handleGSMCallInteration:) + withObject:callCenter + waitUntilDone:YES]; + }; +} + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ + NSDictionary *appDefaults = [NSDictionary dictionaryWithObjectsAndKeys: + @"NO", @"enable_first_login_view_preference", // +#ifdef HAVE_AMR + @"YES",@"amr_8k_preference", // enable amr by default if compiled with +#endif +#ifdef HAVE_G729 + @"YES",@"g729_preference", // enable amr by default if compiled with +#endif + //@"+33",@"countrycode_preference", + nil]; + + /* explicitely instanciate LinphoneManager */ + LinphoneManager* lm = [[LinphoneManager alloc] init]; + assert(lm == [LinphoneManager instance]); + + [self loadDefaultSettings: appDefaults]; + + [self setupUI]; + [[LinphoneManager instance] startLibLinphone]; - + [[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert|UIRemoteNotificationTypeSound]; - + + [self setupGSMInteraction]; + return YES; } diff --git a/Classes/LinphoneUI/LinphoneManager.h b/Classes/LinphoneUI/LinphoneManager.h index 42874fa8d..0977ce2ee 100644 --- a/Classes/LinphoneUI/LinphoneManager.h +++ b/Classes/LinphoneUI/LinphoneManager.h @@ -37,10 +37,16 @@ typedef struct _CallContext { bool_t cameraIsEnabled; } CallContext; +struct NetworkReachabilityContext { + bool_t testWifi, testWWan; + void (*networkStateChanged) (Connectivity newConnectivity); +}; + + @interface LinphoneManager : NSObject { -@private - SCNetworkReachabilityContext proxyReachabilityContext; +@protected SCNetworkReachabilityRef proxyReachability; +@private NSTimer* mIterateTimer; id mLogView; bool isbackgroundModeEnabled; @@ -70,13 +76,14 @@ typedef struct _CallContext { -(BOOL) isNotIphone3G; -(void) destroyLibLinphone; --(void) enterBackgroundMode; +-(BOOL) enterBackgroundMode; -(void) becomeActive; -(void) kickOffNetworkConnection; -(NSString*) getDisplayNameFromAddressBook:(NSString*) number andUpdateCallLog:(LinphoneCallLog*)log; -(UIImage*) getImageFromAddressBook:(NSString*) number; -(BOOL) reconfigureLinphoneIfNeeded:(NSDictionary *)oldSettings; +-(void) setupNetworkReachabilityCallback: (const char*) nodeName withContext:(SCNetworkReachabilityContext*) ctx; @property (nonatomic, retain) id callDelegate; @property (nonatomic, retain) id registrationDelegate; @@ -85,4 +92,3 @@ typedef struct _CallContext { @property (readonly) const char* backCamId; @end - diff --git a/Classes/LinphoneUI/LinphoneManager.m b/Classes/LinphoneUI/LinphoneManager.m index 3221ca359..cc9f0841e 100644 --- a/Classes/LinphoneUI/LinphoneManager.m +++ b/Classes/LinphoneUI/LinphoneManager.m @@ -57,14 +57,16 @@ extern void libmsbcg729_init(); @synthesize backCamId; -(id) init { + assert (!theLinphoneManager); if ((self= [super init])) { mFastAddressBook = [[FastAddressBook alloc] init]; + theLinphoneManager = self; } return self; } +(LinphoneManager*) instance { if (theLinphoneManager==nil) { - theLinphoneManager = [[LinphoneManager alloc] init]; + [[LinphoneManager alloc] init]; } return theLinphoneManager; } @@ -387,6 +389,7 @@ static void linphone_iphone_call_state(LinphoneCore *lc, LinphoneCall* call, Lin cancelButtonTitle:NSLocalizedString(@"Continue",nil) otherButtonTitles:nil ,nil]; [error show]; + [error release]; } } @@ -447,16 +450,21 @@ static LinphoneCoreVTable linphonec_vtable = { CFWriteStreamClose (writeStream); } -void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void * info) { +void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void* nilCtx) { ms_message("Network connection flag [%x]",flags); - LinphoneManager* lLinphoneMgr = (LinphoneManager*)info; + LinphoneManager* lLinphoneMgr = [LinphoneManager instance]; if ([LinphoneManager getLc] != nil) { + struct NetworkReachabilityContext* ctx = nilCtx ? ((struct NetworkReachabilityContext*)nilCtx) : 0; if ((flags == 0) | (flags & (kSCNetworkReachabilityFlagsConnectionRequired |kSCNetworkReachabilityFlagsConnectionOnTraffic))) { [[LinphoneManager instance] kickOffNetworkConnection]; linphone_core_set_network_reachable([LinphoneManager getLc],false); - ((LinphoneManager*)info).connectivity = none; + lLinphoneMgr.connectivity = none; } else { - Connectivity newConnectivity = flags & kSCNetworkReachabilityFlagsIsWWAN ? wwan:wifi; + Connectivity newConnectivity; + if (!ctx || ctx->testWWan) + newConnectivity = flags & kSCNetworkReachabilityFlagsIsWWAN ? wwan:wifi; + else + newConnectivity = wifi; if (lLinphoneMgr.connectivity == none) { linphone_core_set_network_reachable([LinphoneManager getLc],true); } else if (lLinphoneMgr.connectivity != newConnectivity) { @@ -467,7 +475,9 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach lLinphoneMgr.connectivity=newConnectivity; ms_message("new network connectivity of type [%s]",(newConnectivity==wifi?"wifi":"wwan")); } - + if (ctx && ctx->networkStateChanged) { + (*ctx->networkStateChanged)(lLinphoneMgr.connectivity); + } } } @@ -683,6 +693,15 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach } bool enableSrtp = [[NSUserDefaults standardUserDefaults] boolForKey:@"enable_srtp_preference"]; linphone_core_set_media_encryption(theLinphoneCore, enableSrtp?LinphoneMediaEncryptionSRTP:LinphoneMediaEncryptionZRTP); + + NSString* stun_server = [[NSUserDefaults standardUserDefaults] stringForKey:@"stun_preference"]; + if ([stun_server length]>0){ + linphone_core_set_stun_server(theLinphoneCore,[stun_server cStringUsingEncoding:[NSString defaultCStringEncoding]]); + linphone_core_set_firewall_policy(theLinphoneCore, LinphonePolicyUseStun); + }else{ + linphone_core_set_stun_server(theLinphoneCore, NULL); + linphone_core_set_firewall_policy(theLinphoneCore, LinphonePolicyNoFirewall); + } LinphoneVideoPolicy policy; policy.automatically_accept = [[NSUserDefaults standardUserDefaults] boolForKey:@"start_video_preference"];; @@ -732,10 +751,12 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach AVAudioSession *audioSession = [AVAudioSession sharedInstance]; [audioSession setDelegate:nil]; if (theLinphoneCore != nil) { //just in case application terminate before linphone core initialization + NSLog(@"Destroy linphonecore"); linphone_core_destroy(theLinphoneCore); theLinphoneCore = nil; SCNetworkReachabilityUnscheduleFromRunLoop(proxyReachability, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); - CFRelease(proxyReachability); + if (proxyReachability) + CFRelease(proxyReachability); proxyReachability=nil; } @@ -743,7 +764,7 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach } //**********************BG mode management*************************/////////// --(void) enterBackgroundMode { +-(BOOL) enterBackgroundMode { LinphoneProxyConfig* proxyCfg; linphone_core_get_default_proxy(theLinphoneCore, &proxyCfg); linphone_core_stop_dtmf_stream(theLinphoneCore); @@ -783,13 +804,13 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach if (linphone_core_get_sip_transports(theLinphoneCore, &transportValue)) { ms_error("cannot get current transport"); } - + return YES; } else { ms_warning("Entering lite bg mode"); [self destroyLibLinphone]; + return NO; } - } @@ -799,7 +820,30 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach } - +-(void) setupNetworkReachabilityCallback: (const char*) nodeName withContext:(SCNetworkReachabilityContext*) ctx { + if (proxyReachability) { + ms_message("Cancel old network reachability check"); + SCNetworkReachabilityUnscheduleFromRunLoop(proxyReachability, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); + CFRelease(proxyReachability); + proxyReachability = nil; + } + + proxyReachability = SCNetworkReachabilityCreateWithName(nil, nodeName); + + //initial state is network off should be done as soon as possible + SCNetworkReachabilityFlags flags; + if (!SCNetworkReachabilityGetFlags(proxyReachability, &flags)) { + ms_error("Cannot get reachability flags"); + }; + networkReachabilityCallBack(proxyReachability, flags, ctx ? ctx->info : 0); + + if (!SCNetworkReachabilitySetCallback(proxyReachability, (SCNetworkReachabilityCallBack)networkReachabilityCallBack, ctx)){ + ms_error("Cannot register reachability cb"); + }; + if(!SCNetworkReachabilityScheduleWithRunLoop(proxyReachability, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode)){ + ms_error("Cannot register schedule reachability cb"); + }; +} /************* @@ -841,6 +885,7 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach #endif /* Initialize linphone core*/ + NSLog(@"Create linphonecore"); theLinphoneCore = linphone_core_new (&linphonec_vtable , [confiFileName cStringUsingEncoding:[NSString defaultCStringEncoding]] , [factoryConfig cStringUsingEncoding:[NSString defaultCStringEncoding]] @@ -850,22 +895,8 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach linphone_core_set_zrtp_secrets_file(theLinphoneCore, [zrtpSecretsFileName cStringUsingEncoding:[NSString defaultCStringEncoding]]); - proxyReachability=SCNetworkReachabilityCreateWithName(nil, "linphone.org"); - proxyReachabilityContext.info=self; - //initial state is network off should be done as soon as possible - SCNetworkReachabilityFlags flags; - if (!SCNetworkReachabilityGetFlags(proxyReachability, &flags)) { - ms_error("Cannot get reachability flags"); - }; - networkReachabilityCallBack(proxyReachability,flags,self); + [self setupNetworkReachabilityCallback: "linphone.org" withContext:nil]; - if (!SCNetworkReachabilitySetCallback(proxyReachability, (SCNetworkReachabilityCallBack)networkReachabilityCallBack,&proxyReachabilityContext)){ - ms_error("Cannot register reachability cb"); - }; - if(!SCNetworkReachabilityScheduleWithRunLoop(proxyReachability, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode)){ - ms_error("Cannot register schedule reachability cb"); - }; - [self reconfigureLinphoneIfNeeded:nil]; // start scheduler @@ -930,13 +961,12 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach } -(void) becomeActive { - if (theLinphoneCore == nil) { //back from standby and background mode is disabled [self startLibLinphone]; } else { if (![self reconfigureLinphoneIfNeeded:currentSettings]) { - ms_message("becomming active with no config modification, make sure we are registered"); + ms_message("becoming active with no config modification, make sure we are registered"); linphone_core_refresh_registers(theLinphoneCore);//just to make sure REGISTRATION is up to date } diff --git a/Classes/LinphoneUI/UICallButton.m b/Classes/LinphoneUI/UICallButton.m index 39661926c..080912cd8 100644 --- a/Classes/LinphoneUI/UICallButton.m +++ b/Classes/LinphoneUI/UICallButton.m @@ -45,8 +45,10 @@ otherButtonTitles:nil]; [error show]; [error release]; + [ct release]; return; } + [ct release]; if (TRUE /*!linphone_core_in_call([LinphoneManager getLc])*/) { LinphoneProxyConfig* proxyCfg; diff --git a/Classes/StatusSubViewController.m b/Classes/StatusSubViewController.m index e0d1cadcb..f1eaa2423 100644 --- a/Classes/StatusSubViewController.m +++ b/Classes/StatusSubViewController.m @@ -60,7 +60,7 @@ } -(BOOL) updateWithRegistrationState:(LinphoneRegistrationState)state message:(NSString*) message { - + label.hidden = NO; switch(state) { case LinphoneRegistrationCleared: image.hidden = NO; diff --git a/Classes/StatusSubViewController.xib b/Classes/StatusSubViewController.xib index d93f8f7f6..9ce474c3b 100644 --- a/Classes/StatusSubViewController.xib +++ b/Classes/StatusSubViewController.xib @@ -39,7 +39,7 @@ - 292 + -2147483356 {{0, -1}, {25, 23}} @@ -66,7 +66,7 @@ - 292 + -2147483356 {{28, 0}, {280, 21}} @@ -76,7 +76,7 @@ 7 NO IBCocoaTouchFramework - No SIP account defined + CARAMBA 3 MC42NjY2NjY2NjY3AA diff --git a/Classes/VideoViewController-ipad.xib b/Classes/VideoViewController-ipad.xib index f1f29d7f1..3bad877cd 100644 --- a/Classes/VideoViewController-ipad.xib +++ b/Classes/VideoViewController-ipad.xib @@ -35,8 +35,10 @@ 274 - {768, 1004} + {768, 1024} + + 4 MAA @@ -50,9 +52,10 @@ 292 - {{-9, 0}, {777, 1004}} + {768, 1024} - + + _NS:569 NO IBIPadFramework @@ -69,7 +72,7 @@ 292 - {{329, 942}, {108, 62}} + {{329, 962}, {108, 62}} NO @@ -111,7 +114,7 @@ 292 - {{223, 942}, {108, 62}} + {{223, 962}, {108, 62}} NO @@ -131,8 +134,10 @@ 292 - {{598, 779}, {170, 225}} + {{598, 799}, {170, 225}} + + 3 MQA @@ -145,7 +150,7 @@ 292 - {{436, 942}, {108, 62}} + {{436, 962}, {108, 62}} NO @@ -164,8 +169,19 @@ + + + 292 + {{20, 976}, {28, 28}} + + + + _NS:567 + NO + IBIPadFramework + - {768, 1004} + {768, 1024} _NS:212 @@ -182,7 +198,7 @@ 292 - {1004, 768} + {1024, 768} _NS:569 @@ -192,7 +208,7 @@ 292 - {{779, 598}, {225, 170}} + {{799, 598}, {225, 170}} 3 @@ -204,7 +220,7 @@ 292 - {{341, 706}, {108, 62}} + {{351, 706}, {108, 62}} NO @@ -224,7 +240,7 @@ 292 - {{448, 706}, {108, 62}} + {{458, 706}, {108, 62}} NO @@ -245,7 +261,7 @@ 292 - {{555, 706}, {108, 62}} + {{565, 706}, {108, 62}} NO @@ -274,7 +290,7 @@ IBIPadFramework - {1004, 768} + {1024, 768} _NS:212 @@ -295,7 +311,7 @@ 292 - {1004, 768} + {1024, 768} _NS:569 @@ -305,7 +321,7 @@ 292 - {{779, 598}, {225, 170}} + {{799, 598}, {225, 170}} 3 @@ -317,7 +333,7 @@ 292 - {{341, 706}, {108, 62}} + {{351, 706}, {108, 62}} NO @@ -337,7 +353,7 @@ 292 - {{448, 706}, {108, 62}} + {{458, 706}, {108, 62}} NO @@ -358,7 +374,7 @@ 292 - {{555, 706}, {108, 62}} + {{565, 706}, {108, 62}} NO @@ -387,7 +403,7 @@ IBIPadFramework - {1004, 768} + {1024, 768} _NS:212 diff --git a/README b/README index b2deec6fc..096cfdadb 100644 --- a/README +++ b/README @@ -25,8 +25,10 @@ Link macport libtoolize to glibtoolize Link host's strings to simulator SDK - $ ln -s /usr/bin/strings /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/strings - + For Xcode prior to 4.3: + $ sudo ln -s /usr/bin/strings /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/strings + For newer XCode: + $ sudo ln -s /usr/bin/strings /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/strings BUILDING THE SDK @@ -34,19 +36,24 @@ BUILDING THE SDK * GPL third parties versus non GPL third parties -This sdk can be generated in 2 flavors. Firt is with GPL third parties, it means liblinphone includes GPL third parties like FFMPEG or x264. -If you choose this flavor, your final application must comply with GPL in any case. This is the default mode. + This sdk can be generated in 2 flavors. Firt is with GPL third parties, it means liblinphone includes GPL third parties like FFMPEG or x264. + If you choose this flavor, your final application must comply with GPL in any case. This is the default mode. -To generate the liblinphone multi arch sdk in GPL mode, do: + To generate the liblinphone multi arch sdk in GPL mode, do: $ cd submodules/build $ make all -ALTERNATIVELY, you can force liblinphone to use only non GPL code except for liblinphone, mediastremer2, ortp, exosip, osip. -If you choose this flavor, your final application is still subject to GPL except if you have a commercial license for liblinphone, mediastremer2, ortp, exosip, osip. + ALTERNATIVELY, you can force liblinphone to use only non GPL code except for liblinphone, mediastremer2, ortp, exosip, osip. + If you choose this flavor, your final application is still subject to GPL except if you have a commercial license for liblinphone, mediastremer2, ortp, exosip, osip. -To generate the liblinphone multi arch sdkin non GPL mode, do: + To generate the liblinphone multi arch sdkin non GPL mode, do: $ cd submodules/build $ make all enable_gpl_third_parties=no + + * ZRTP support + + You can enable ZRTP support in GPL mode only, by adding "enable_zrtp=yes" to the make command, for example: + $ make all enable_gpl_third_parties=yes enable_zrtp=yes The resulting sdk is in liblinphone-sdk/ directory. diff --git a/Settings.bundle/Advanced.plist b/Settings.bundle/Advanced.plist index 4aad4e2a9..977c1c36f 100644 --- a/Settings.bundle/Advanced.plist +++ b/Settings.bundle/Advanced.plist @@ -4,6 +4,20 @@ PreferenceSpecifiers + + Key + stun_preference + Title + Stun server + Type + PSTextFieldSpecifier + AutocapitalizationType + None + AutocorrectionType + No + DefaultValue + + DefaultValue diff --git a/nogpl-thirdparties/Settings.bundle/Advanced.plist b/nogpl-thirdparties/Settings.bundle/Advanced.plist index 4aad4e2a9..c4d0b1f69 100644 --- a/nogpl-thirdparties/Settings.bundle/Advanced.plist +++ b/nogpl-thirdparties/Settings.bundle/Advanced.plist @@ -4,6 +4,20 @@ PreferenceSpecifiers + + Key + stun_preference + Title + Stun server + Type + PSTextFieldSpecifier + AutocapitalizationType + None + AutocorrectionType + No + DefaultValue + + DefaultValue diff --git a/submodules/build/Makefile b/submodules/build/Makefile index 311aaa4fd..aa1fa2c70 100644 --- a/submodules/build/Makefile +++ b/submodules/build/Makefile @@ -20,6 +20,7 @@ # ############################################################################ enable_gpl_third_parties=yes +enable_zrtp=no .NOTPARALLEL all: build warning ifeq ($(enable_gpl_third_parties),yes) @@ -39,12 +40,18 @@ warning: @echo "*****linphone SDK without GPL code ******" @echo "*****************************************************************" @echo "*****************************************************************" + ifeq($(enable_zrtp),yes) + @echo "ZRTP is not available in non-gpl build." + enable_zrtp=no + endif endif +LINPHONE_OPTIONS="enable_gpl_third_parties=$(enable_gpl_third_parties) enable_zrtp=$(enable_zrtp)" + build: - 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 all $(LINPHONE_OPTIONS) \ + && make -f builder-iphone-simulator.mk all $(LINPHONE_OPTIONS) \ + && make -f builder-iphone-os.mk host=armv7-apple-darwin all $(LINPHONE_OPTIONS) \ && make -f builder-iphone-os.mk delivery-sdk ipa: build diff --git a/submodules/build/builder-iphone-os.mk b/submodules/build/builder-iphone-os.mk index e89de143d..20797a9f4 100644 --- a/submodules/build/builder-iphone-os.mk +++ b/submodules/build/builder-iphone-os.mk @@ -38,6 +38,12 @@ linphone_configure_controls= \ --disable-tests \ --with-srtp=$(prefix) +ifeq ($(enable_zrtp),yes) + linphone_configure_controls+= --enable-zrtp +else + linphone_configure_controls+= --disable-zrtp +endif + #path BUILDER_SRC_DIR?=$(shell pwd)/../ BUILDER_BUILD_DIR?=$(shell pwd)/../build-$(host) @@ -60,11 +66,11 @@ $(LINPHONE_BUILD_DIR)/disable_gpl_third_parties: cd $(LINPHONE_BUILD_DIR) && rm -f Makefile && rm -f oRTP/Makefile && rm -f mediastreamer2/Makefile ifeq ($(enable_gpl_third_parties),yes) -linphone_configure_controls+= --enable-ffmpeg --enable-zrtp +linphone_configure_controls+= --enable-ffmpeg detect_gpl_mode_switch: $(LINPHONE_BUILD_DIR)/enable_gpl_third_parties else -linphone_configure_controls+= --disable-ffmpeg --disable-zrtp +linphone_configure_controls+= --disable-ffmpeg detect_gpl_mode_switch: $(LINPHONE_BUILD_DIR)/disable_gpl_third_parties endif diff --git a/submodules/build/builders.d/libvpx.mk b/submodules/build/builders.d/libvpx.mk index f1acb950c..13e0aa62b 100644 --- a/submodules/build/builders.d/libvpx.mk +++ b/submodules/build/builders.d/libvpx.mk @@ -13,11 +13,16 @@ else endif libvpx_dir?=externals/libvpx -$(BUILDER_BUILD_DIR)/$(libvpx_dir)/config.mk: +$(BUILDER_SRC_DIR)/$(libvpx_dir)/patched.stamp: + cd $(BUILDER_SRC_DIR)/$(libvpx_dir) \ + && git apply $(BUILDER_SRC_DIR)/build/builders.d/libvpx.patch \ + && touch $@ + +$(BUILDER_BUILD_DIR)/$(libvpx_dir)/config.mk: $(BUILDER_SRC_DIR)/$(libvpx_dir)/patched.stamp mkdir -p $(BUILDER_BUILD_DIR)/$(libvpx_dir) cd $(BUILDER_BUILD_DIR)/$(libvpx_dir)/ \ && host_alias=${host} . $(BUILDER_SRC_DIR)/build/$(config_site) \ - && $(BUILDER_SRC_DIR)/$(libvpx_dir)/configure --prefix=$(prefix) $(libvpx_configure_options) + && SYSROOT_PATH=$$SYSROOT_PATH SDK_BIN_PATH=$$SDK_BIN_PATH $(BUILDER_SRC_DIR)/$(libvpx_dir)/configure --prefix=$(prefix) $(libvpx_configure_options) build-libvpx: $(BUILDER_BUILD_DIR)/$(libvpx_dir)/config.mk cd $(BUILDER_BUILD_DIR)/$(libvpx_dir) && PKG_CONFIG_PATH=$(prefix)/lib/pkgconfig CONFIG_SITE=$(BUILDER_SRC_DIR)/build/$(config_site) make && make install diff --git a/submodules/build/builders.d/libvpx.patch b/submodules/build/builders.d/libvpx.patch new file mode 100644 index 000000000..390ec4ecf --- /dev/null +++ b/submodules/build/builders.d/libvpx.patch @@ -0,0 +1,42 @@ +diff --git a/build/make/configure.sh b/build/make/configure.sh +index 0426f92..24fa04e 100755 +--- a/build/make/configure.sh ++++ b/build/make/configure.sh +@@ -624,6 +624,9 @@ process_common_toolchain() { + if [ -d "/Developer/SDKs/MacOSX10.7.sdk" ]; then + osx_sdk_dir="/Developer/SDKs/MacOSX10.7.sdk" + fi ++ if test -n "$SYSROOT_PATH" ; then ++ osx_sdk_dir=$SYSROOT_PATH ++ fi + + case ${toolchain} in + *-darwin8-*) +@@ -743,6 +746,14 @@ process_common_toolchain() { + darwin*) + SDK_PATH=/Developer/Platforms/iPhoneOS.platform/Developer + TOOLCHAIN_PATH=${SDK_PATH}/usr/bin ++ if test -n "$SYSROOT_PATH" ; then ++ SDK_FULL_PATH=$SYSROOT_PATH ++ else ++ SDK_FULL_PATH="${SDK_PATH}/SDKs/iPhoneOS5.0.sdk" ++ fi ++ if test -n "$SDK_BIN_PATH" ; then ++ TOOLCHAIN_PATH=$SDK_BIN_PATH ++ fi + CC=${TOOLCHAIN_PATH}/gcc + AR=${TOOLCHAIN_PATH}/ar + LD=${TOOLCHAIN_PATH}/arm-apple-darwin10-llvm-gcc-4.2 +@@ -759,10 +770,10 @@ process_common_toolchain() { + add_cflags -arch ${tgt_isa} + add_ldflags -arch_only ${tgt_isa} + +- add_cflags "-isysroot ${SDK_PATH}/SDKs/iPhoneOS5.0.sdk" ++ add_cflags "-isysroot $SDK_FULL_PATH" + + # This should be overridable +- alt_libc=${SDK_PATH}/SDKs/iPhoneOS5.0.sdk ++ alt_libc=$SDK_FULL_PATH + + # Add the paths for the alternate libc + for d in usr/include; do diff --git a/submodules/build/iphone-config.site b/submodules/build/iphone-config.site index c4c7840a8..4256d17ed 100644 --- a/submodules/build/iphone-config.site +++ b/submodules/build/iphone-config.site @@ -24,8 +24,15 @@ else fi echo "Loading config.site for iPhone platform=${PLATFORM} version=${SDK_VERSION}" -SDK_PATH_LIST=`ls -drt /Developer/Platforms/iPhone${PLATFORM}.platform/Developer/SDKs/iPhone${PLATFORM}*` -SDK_BIN_PATH=/Developer/Platforms/iPhone${PLATFORM}.platform/Developer/usr/bin +#new path with Xcode 4.3: +if test -d /Applications/Xcode.app/Contents/Developer/Platforms/iPhone${PLATFORM}.platform/Developer/SDKs ; then + SDK_PATH_LIST=`ls -drt /Applications/Xcode.app/Contents/Developer/Platforms/iPhone${PLATFORM}.platform/Developer/SDKs/iPhone${PLATFORM}*` + SDK_BIN_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhone${PLATFORM}.platform/Developer/usr/bin +else + SDK_PATH_LIST=`ls -drt /Developer/Platforms/iPhone${PLATFORM}.platform/Developer/SDKs/iPhone${PLATFORM}*` + SDK_BIN_PATH=/Developer/Platforms/iPhone${PLATFORM}.platform/Developer/usr/bin +fi + for SYSROOT_PATH in $SDK_PATH_LIST ; do echo $SYSROOT_PATH ; done ; echo "Selecting SDK path = ${SYSROOT_PATH}" COMMON_FLAGS=" -arch ${ARCH} ${MCPU} -isysroot ${SYSROOT_PATH} -miphoneos-version-min=${SDK_VERSION} -DTARGET_OS_IPHONE=1 -D__IOS" diff --git a/submodules/linphone b/submodules/linphone index c474ef27b..8ffeb3eb7 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit c474ef27bc1b6d2951bb3a4c8ad7343f7171bbea +Subproject commit 8ffeb3eb7c7e5738883f6c247330316753bf173e