diff --git a/Classes/PhoneViewController.m b/Classes/PhoneViewController.m index aff6bf662..baa41c515 100644 --- a/Classes/PhoneViewController.m +++ b/Classes/PhoneViewController.m @@ -226,6 +226,12 @@ return self; } */ +- (void)viewDidAppear:(BOOL)animated { + [[UIApplication sharedApplication] setIdleTimerDisabled:true]; +} +- (void)viewDidDisappear:(BOOL)animated { + [[UIApplication sharedApplication] setIdleTimerDisabled:false]; +} // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. @@ -331,7 +337,8 @@ case GSTATE_CALL_IN_CONNECTED: case GSTATE_CALL_OUT_CONNECTED: { [self muteAction:false]; - [self speakerAction:false]; + // test if speaker must be unactivated after ring tone + if (!isSpeaker) [self speakerAction:false]; const LinphoneAddress* callAddress = linphone_core_get_remote_uri(mCore); const char* callDisplayName = linphone_address_get_display_name(callAddress)?linphone_address_get_display_name(callAddress):""; @@ -344,10 +351,10 @@ } // start scheduler durationRefreasher = [NSTimer scheduledTimerWithTimeInterval:1 - target:self - selector:@selector(updateCallDuration) - userInfo:nil - repeats:YES]; + target:self + selector:@selector(updateCallDuration) + userInfo:nil + repeats:YES]; [address setHidden:true]; [incallView setHidden:false]; [call setEnabled:false]; diff --git a/Classes/linphoneAppDelegate.h b/Classes/linphoneAppDelegate.h index 0e13bae87..2e5bbdb3d 100644 --- a/Classes/linphoneAppDelegate.h +++ b/Classes/linphoneAppDelegate.h @@ -20,6 +20,7 @@ #import #import +#import #include"linphonecore.h" @@ -45,7 +46,9 @@ bool isDebug; LinphoneCore* myLinphoneCore; - + SCNetworkReachabilityContext proxyReachabilityContext; + SCNetworkReachabilityRef proxyReachability; + } /********************************** @@ -63,6 +66,10 @@ -(PayloadType*) findPayload:(NSString*)type withRate:(int)rate from:(const MSList*)list; +/** + * return true if register is activated + */ +bool networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void * info); @property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic, retain) IBOutlet UITabBarController* myTabBarController; diff --git a/Classes/linphoneAppDelegate.m b/Classes/linphoneAppDelegate.m index 3f79607fa..f08d5026a 100644 --- a/Classes/linphoneAppDelegate.m +++ b/Classes/linphoneAppDelegate.m @@ -151,6 +151,8 @@ LinphoneCoreVTable linphonec_vtable = { [myPhoneViewController setLinphoneCore: myLinphoneCore]; + [ [UIDevice currentDevice] setProximityMonitoringEnabled:true]; + } -(void)selectDialerTab { @@ -262,10 +264,18 @@ LinphoneCoreVTable linphonec_vtable = { } linphone_proxy_config_set_dial_escape_plus(proxyCfg,TRUE); - linphone_proxy_config_enable_register(proxyCfg, TRUE); linphone_core_add_proxy_config(myLinphoneCore,proxyCfg); //set to default proxy linphone_core_set_default_proxy(myLinphoneCore,proxyCfg); + + LinphoneAddress* addr=linphone_address_new(linphone_proxy_config_get_addr(proxyCfg)); + proxyReachability=SCNetworkReachabilityCreateWithName(nil, linphone_address_get_domain(addr)); + proxyReachabilityContext.info=myLinphoneCore; + bool result=SCNetworkReachabilitySetCallback(proxyReachability, networkReachabilityCallBack,&proxyReachabilityContext); + SCNetworkReachabilityFlags reachabilityFlags; + result=SCNetworkReachabilityGetFlags (proxyReachability,&reachabilityFlags); + SCNetworkReachabilityScheduleWithRunLoop(proxyReachability, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); + } //Configure Codecs @@ -316,6 +326,7 @@ LinphoneCoreVTable linphonec_vtable = { } + // start scheduler [NSTimer scheduledTimerWithTimeInterval:0.1 target:self @@ -366,5 +377,21 @@ LinphoneCoreVTable linphonec_vtable = { } +bool networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void * info) { + LinphoneProxyConfig* proxyCfg; + linphone_core_get_default_proxy((LinphoneCore*)info,&proxyCfg); + linphone_proxy_config_edit(proxyCfg); + bool result = false; + if (flags) { + // register whatever connection type + linphone_proxy_config_enable_register(proxyCfg,TRUE); + result = true; + } else { + linphone_proxy_config_enable_register(proxyCfg,false); + result = false; + } + linphone_proxy_config_done(proxyCfg); + return result; +} @end diff --git a/linphone-Info.plist b/linphone-Info.plist index 31b172911..5716fe566 100644 --- a/linphone-Info.plist +++ b/linphone-Info.plist @@ -4,6 +4,8 @@ CFBundleDevelopmentRegion English + UIRequiresPersistentWiFi + CFBundleDisplayName ${PRODUCT_NAME} CFBundleExecutable @@ -24,8 +26,6 @@ 1.0 CFBundleShortVersionString 3.1.2 - LSRequiresIPhoneOS - NSMainNibFile PhoneMainView diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj index 8fc98bd8a..7573cb5a3 100755 --- a/linphone.xcodeproj/project.pbxproj +++ b/linphone.xcodeproj/project.pbxproj @@ -31,6 +31,7 @@ 2245667A10768B9000F10948 /* linphone.png in Resources */ = {isa = PBXBuildFile; fileRef = 2245667910768B9000F10948 /* linphone.png */; }; 2245671D107699F700F10948 /* Settings.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 2245671C107699F700F10948 /* Settings.bundle */; }; 224567C2107B968500F10948 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 224567C1107B968500F10948 /* AVFoundation.framework */; }; + 2264B6D211200342002C2C53 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2264B6D111200342002C2C53 /* SystemConfiguration.framework */; }; 2273785E10A3703300526073 /* libmsiounit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2273785D10A3703300526073 /* libmsiounit.a */; }; 2273798810A48EF000526073 /* oldphone.wav in Resources */ = {isa = PBXBuildFile; fileRef = 2273798710A48EF000526073 /* oldphone.wav */; }; 2274401A106F31BD006EC466 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 22744019106F31BD006EC466 /* CoreAudio.framework */; }; @@ -200,6 +201,7 @@ 2245667910768B9000F10948 /* linphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = linphone.png; path = ../linphone/pixmaps/linphone.png; sourceTree = SOURCE_ROOT; }; 2245671C107699F700F10948 /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = ""; }; 224567C1107B968500F10948 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; + 2264B6D111200342002C2C53 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; 2273785D10A3703300526073 /* libmsiounit.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libmsiounit.a; path = "../liblinphone-sdk/armv6-apple-darwin/lib/mediastreamer/plugins/libmsiounit.a"; sourceTree = SOURCE_ROOT; }; 2273798710A48EF000526073 /* oldphone.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = oldphone.wav; path = rings/oldphone.wav; sourceTree = ""; }; 22744019106F31BD006EC466 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; }; @@ -258,6 +260,7 @@ 2273785E10A3703300526073 /* libmsiounit.a in Frameworks */, 22B5EFA310CE50BD00777D97 /* AddressBookUI.framework in Frameworks */, 22B5F03510CE6B2F00777D97 /* AddressBook.framework in Frameworks */, + 2264B6D211200342002C2C53 /* SystemConfiguration.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -532,6 +535,7 @@ 22F51EF5107FA66500F98953 /* untitled.plist */, 22B5EFA210CE50BD00777D97 /* AddressBookUI.framework */, 22B5F03410CE6B2F00777D97 /* AddressBook.framework */, + 2264B6D111200342002C2C53 /* SystemConfiguration.framework */, ); name = CustomTemplate; sourceTree = "";