diff --git a/Classes/IncallViewController.m b/Classes/IncallViewController.m index 895299e67..bd43eb27b 100644 --- a/Classes/IncallViewController.m +++ b/Classes/IncallViewController.m @@ -667,8 +667,8 @@ void addAnimationFadeTransition(UIView* view, float duration) { dismissed = false; UIDevice *device = [UIDevice currentDevice]; device.proximityMonitoringEnabled = YES; - if ([speaker isOn]) - [speaker toggle]; + //if ([speaker isOn]) + // [speaker toggle]; [self updateUIFromLinphoneState: YES]; } @@ -681,7 +681,7 @@ void addAnimationFadeTransition(UIView* view, float duration) { UIDevice *device = [UIDevice currentDevice]; device.proximityMonitoringEnabled = YES; if (call !=nil && linphone_call_get_dir(call)==LinphoneCallIncoming) { - if ([speaker isOn]) [speaker toggle]; + //if ([speaker isOn]) [speaker toggle]; } [self updateUIFromLinphoneState: YES]; @@ -932,7 +932,11 @@ static void hideSpinner(LinphoneCall* call, void* user_data) { } else { switch (linphone_call_get_state(call)) { case LinphoneCallPaused: - [ms appendFormat:@"%@", NSLocalizedString(@"Paused (tap to resume)", nil), nil]; + if(!linphone_core_sound_resources_locked(linphone_call_get_core(call))) { + [ms appendFormat:@"%@", NSLocalizedString(@"Paused (tap to resume)", nil), nil]; + } else { + [ms appendFormat:@"%@", NSLocalizedString(@"Paused", nil), nil]; + } break; case LinphoneCallOutgoingInit: case LinphoneCallOutgoingProgress: @@ -1242,7 +1246,9 @@ static void hideSpinner(LinphoneCall* call, void* user_data) { if (linphone_core_is_in_conference(lc)) { linphone_core_leave_conference(lc); } - linphone_core_resume_call([LinphoneManager getLc], selectedCall); + if(!linphone_core_sound_resources_locked(lc)) { + linphone_core_resume_call([LinphoneManager getLc], selectedCall); + } } [self updateUIFromLinphoneState: YES]; diff --git a/Classes/LinphoneUI/LinphoneManager.h b/Classes/LinphoneUI/LinphoneManager.h index 754bf9808..84bb07bc0 100644 --- a/Classes/LinphoneUI/LinphoneManager.h +++ b/Classes/LinphoneUI/LinphoneManager.h @@ -92,7 +92,8 @@ typedef struct _LinphoneCallAppData { -(NSString*) getDisplayNameFromAddressBook:(NSString*) number andUpdateCallLog:(LinphoneCallLog*)log; -(UIImage*) getImageFromAddressBook:(NSString*) number; --(void) setupNetworkReachabilityCallback: (const char*) nodeName withContext:(SCNetworkReachabilityContext*) ctx; +-(BOOL) reconfigureLinphoneIfNeeded:(NSDictionary *)oldSettings; +-(void) setupNetworkReachabilityCallback; -(void) refreshRegisters; @property (nonatomic, retain) id callDelegate; diff --git a/Classes/LinphoneUI/LinphoneManager.m b/Classes/LinphoneUI/LinphoneManager.m index 35f77c04c..7719c38d9 100644 --- a/Classes/LinphoneUI/LinphoneManager.m +++ b/Classes/LinphoneUI/LinphoneManager.m @@ -178,6 +178,14 @@ struct codec_name_pref_table codec_pref_table[]={ } -(void) onCall:(LinphoneCall*) call StateChanged: (LinphoneCallState) new_state withMessage: (const char *) message { + if(new_state == LinphoneCallReleased) { + if(linphone_call_get_user_pointer(call) != NULL) { + free (linphone_call_get_user_pointer(call)); + linphone_call_set_user_pointer(call, NULL); + } + return; + } + const char* lUserNameChars=linphone_address_get_username(linphone_call_get_remote_address(call)); NSString* lUserName = lUserNameChars?[[[NSString alloc] initWithUTF8String:lUserNameChars] autorelease]:NSLocalizedString(@"Unknown",nil); if (new_state == LinphoneCallIncomingReceived) { @@ -306,9 +314,6 @@ struct codec_name_pref_table codec_pref_table[]={ [callDelegate displayInCall:call FromUI:mCurrentViewController forUser:lUserName withDisplayName:lDisplayName]; } break; - case LinphoneCallReleased: - free (linphone_call_get_user_pointer(call)); - break; default: break; } @@ -322,12 +327,9 @@ struct codec_name_pref_table codec_pref_table[]={ } +(LinphoneCore*) getLc { -#if 0 if (theLinphoneCore==nil) { @throw([NSException exceptionWithName:@"LinphoneCoreException" reason:@"Linphone core not initialized yet" userInfo:nil]); } -#else -#endif return theLinphoneCore; } @@ -468,6 +470,14 @@ static LinphoneCoreVTable linphonec_vtable = { }; +-(void) configurePayloadType:(const char*) type fromPrefKey: (NSString*)key withRate:(int)rate { + if ([[NSUserDefaults standardUserDefaults] boolForKey:key]) { + PayloadType* pt; + if((pt = linphone_core_find_payload_type(theLinphoneCore,type,rate))) { + linphone_core_enable_payload_type(theLinphoneCore,pt, TRUE); + } + } +} -(void) kickOffNetworkConnection { /*start a new thread to avoid blocking the main ui in case of peer host failure*/ [NSThread detachNewThreadSelector:@selector(runNetworkConnection) toTarget:self withObject:nil]; @@ -575,7 +585,9 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach // no proxy configured alert - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { - + if (buttonIndex == 1) { + [[NSUserDefaults standardUserDefaults] setBool:true forKey:@"check_config_disable_preference"]; + } } -(void) destroyLibLinphone { [mIterateTimer invalidate]; @@ -631,6 +643,10 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach } else { ms_warning("keepalive handler cannot be registered"); } + LCSipTransports transportValue; + if (linphone_core_get_sip_transports(theLinphoneCore, &transportValue)) { + ms_error("cannot get current transport"); + } return YES; } else { @@ -646,9 +662,12 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach linphone_core_iterate(theLinphoneCore); } --(void) setupNetworkReachabilityCallback: (const char*) nodeName withContext:(SCNetworkReachabilityContext*) ctx { +-(void) setupNetworkReachabilityCallback { + SCNetworkReachabilityContext *ctx=NULL; + const char *nodeName="linphone.org"; + if (proxyReachability) { - ms_message("Cancel old network reachability check"); + ms_message("Cancelling old network reachability"); SCNetworkReachabilityUnscheduleFromRunLoop(proxyReachability, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); CFRelease(proxyReachability); proxyReachability = nil; @@ -723,7 +742,9 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach linphone_core_set_zrtp_secrets_file(theLinphoneCore, [zrtpSecretsFileName cStringUsingEncoding:[NSString defaultCStringEncoding]]); - [self setupNetworkReachabilityCallback: "linphone.org" withContext:nil]; + [self setupNetworkReachabilityCallback]; + + [self reconfigureLinphoneIfNeeded:nil]; // start scheduler mIterateTimer = [NSTimer scheduledTimerWithTimeInterval:0.1 @@ -787,10 +808,14 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach linphone_core_enable_video(theLinphoneCore, FALSE, FALSE); } - ms_warning("Linphone [%s] started on [%s], running with [%u] processor(s)" + if ([LinphoneManager runningOnIpad]) + ms_set_cpu_count(2); + else + ms_set_cpu_count(1); + + ms_warning("Linphone [%s] started on [%s]" ,linphone_core_get_version() - ,[[UIDevice currentDevice].model cStringUsingEncoding:[NSString defaultCStringEncoding]], - cpucount); + ,[[UIDevice currentDevice].model cStringUsingEncoding:[NSString defaultCStringEncoding]] ); } @@ -799,9 +824,16 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach if (proxyReachability){ SCNetworkReachabilityFlags flags=0; if (!SCNetworkReachabilityGetFlags(proxyReachability, &flags)) { - ms_error("Cannot get reachability flags"); - }else - networkReachabilityCallBack(proxyReachability, flags, 0); + ms_error("Cannot get reachability flags, re-creating reachability context."); + [self setupNetworkReachabilityCallback]; + }else{ + networkReachabilityCallBack(proxyReachability, flags, 0); + if (flags==0){ + /*workaround iOS bug: reachability API cease to work after some time.*/ + /*when flags==0, either we have no network, or the reachability object lies. To workaround, create a new one*/ + [self setupNetworkReachabilityCallback]; + } + } }else ms_error("No proxy reachability context created !"); linphone_core_refresh_registers(theLinphoneCore);//just to make sure REGISTRATION is up to date } @@ -810,13 +842,11 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach if (theLinphoneCore == nil) { //back from standby and background mode is disabled [self startLibLinphone]; - } else { - [self refreshRegisters]; } /*IOS specific*/ linphone_core_start_dtmf_stream(theLinphoneCore); + } - -(void) registerLogView:(id) view { mLogView = view; } diff --git a/Classes/LinphoneUI/UISpeakerButton.m b/Classes/LinphoneUI/UISpeakerButton.m index 10fdf5b5f..1508f4cdf 100644 --- a/Classes/LinphoneUI/UISpeakerButton.m +++ b/Classes/LinphoneUI/UISpeakerButton.m @@ -22,6 +22,7 @@ #include "linphonecore.h" @implementation UISpeakerButton +static AudioSessionPropertyID routeChangeID = kAudioSessionProperty_AudioRouteChange; static void audioRouteChangeListenerCallback ( void *inUserData, // 1 @@ -36,7 +37,7 @@ static void audioRouteChangeListenerCallback ( -(void) initWithOnImage:(UIImage*) onImage offImage:(UIImage*) offImage debugName:(const char *)name{ [super initWithOnImage:onImage offImage:offImage debugName:name]; - AudioSessionPropertyID routeChangeID = kAudioSessionProperty_AudioRouteChange; + AudioSessionInitialize(NULL, NULL, NULL, NULL); OSStatus lStatus = AudioSessionAddPropertyListener(routeChangeID, audioRouteChangeListenerCallback, self); if (lStatus) { @@ -85,7 +86,11 @@ static void audioRouteChangeListenerCallback ( */ - (void)dealloc { - [super dealloc]; + OSStatus lStatus = AudioSessionRemovePropertyListenerWithUserData(routeChangeID, audioRouteChangeListenerCallback, self); + if (lStatus) { + ms_error ("cannot un register route change handler [%ld]",lStatus); + } + [super dealloc]; } diff --git a/Classes/PhoneViewController-ipad.xib b/Classes/PhoneViewController-ipad.xib index fc15c4af0..0b5db5b31 100644 --- a/Classes/PhoneViewController-ipad.xib +++ b/Classes/PhoneViewController-ipad.xib @@ -1,14 +1,14 @@ - 1280 - 11C74 - 1938 - 1138.23 - 567.00 + 1296 + 11E53 + 2182 + 1138.47 + 569.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 933 + 1181 IBUIViewController @@ -325,7 +325,7 @@ IBIPadFramework 0 0 - 4 + 6 1 @@ -371,7 +371,7 @@ IBIPadFramework 0 0 - 6 + 4 1 @@ -583,14 +583,6 @@ 47 - - - four - - - - 48 - hash @@ -623,14 +615,6 @@ 52 - - - six - - - - 53 - star @@ -727,6 +711,22 @@ 62 + + + four + + + + 63 + + + + six + + + + 64 + @@ -940,7 +940,7 @@ - 62 + 64 @@ -1121,6 +1121,10 @@ 0 IBIPadFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + YES 3 @@ -1131,6 +1135,6 @@ {60, 52} {60, 52} - 933 + 1181 diff --git a/Classes/PhoneViewController.m b/Classes/PhoneViewController.m index 34e842e5f..8ba6dff29 100644 --- a/Classes/PhoneViewController.m +++ b/Classes/PhoneViewController.m @@ -265,9 +265,9 @@ mIncomingCallActionSheet = [[UIActionSheet alloc] initWithTitle:[NSString stringWithFormat:NSLocalizedString(@" %@ is calling you",nil),[displayName length]>0?displayName:username] delegate:cd - cancelButtonTitle:NSLocalizedString(@"Decline",nil) + cancelButtonTitle:nil destructiveButtonTitle:NSLocalizedString(@"Answer",nil) - otherButtonTitles:nil]; + otherButtonTitles:NSLocalizedString(@"Decline",nil),nil]; mIncomingCallActionSheet.actionSheetStyle = UIActionSheetStyleDefault; if ([LinphoneManager runningOnIpad]) { @@ -315,8 +315,8 @@ -(void) displayInCall: (LinphoneCall*) call FromUI:(UIViewController*) viewCtrl forUser:(NSString*) username withDisplayName:(NSString*) displayName { [mMainScreenWithVideoPreview showPreview:NO]; - if (self.presentedViewController != (UIViewController*)mIncallViewController && (call == 0x0 || - linphone_call_get_dir(call)==LinphoneCallIncoming)){ + if (self.presentedViewController != (UIViewController*)mIncallViewController /*&& (call == 0x0 || + linphone_call_get_dir(call)==LinphoneCallIncoming)*/){ [self presentModalViewController:(UIViewController*)mIncallViewController animated:true]; } diff --git a/linphone-Info.plist b/linphone-Info.plist index 9558573e0..45828b413 100644 --- a/linphone-Info.plist +++ b/linphone-Info.plist @@ -24,11 +24,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 3.5.0 + 3.5.2 CFBundleSignature ???? CFBundleVersion - 1.1.2 + 1.3 NSMainNibFile PhoneMainView NSMainNibFile~ipad diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj index 97bdf99e3..6f3ff353f 100755 --- a/linphone.xcodeproj/project.pbxproj +++ b/linphone.xcodeproj/project.pbxproj @@ -1798,7 +1798,7 @@ HAVE_SILK, ); GCC_THUMB_SUPPORT = NO; - GCC_VERSION = com.apple.compilers.llvmgcc42; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; HEADER_SEARCH_PATHS = ( submodules/linphone/coreapi, submodules/linphone/mediastreamer2/include, @@ -1837,7 +1837,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 3.1; LIBRARY_SEARCH_PATHS = ""; LINK_WITH_STANDARD_LIBRARIES = YES; - PROVISIONING_PROFILE = "32E63D15-36ED-474A-8157-8DD0770DF063"; + PROVISIONING_PROFILE = "B8ED8915-B69D-40DA-9B89-1700C44B156B"; SDKROOT = iphoneos; }; name = DistributionAdhoc; @@ -1864,7 +1864,7 @@ HAVE_SILK, ); GCC_THUMB_SUPPORT = NO; - GCC_VERSION = com.apple.compilers.llvmgcc42; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; HEADER_SEARCH_PATHS = ( submodules/linphone/coreapi, submodules/linphone/mediastreamer2/include, @@ -2140,7 +2140,7 @@ HAVE_SILK, ); GCC_THUMB_SUPPORT = NO; - GCC_VERSION = com.apple.compilers.llvmgcc42; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; HEADER_SEARCH_PATHS = ( submodules/linphone/coreapi, submodules/linphone/mediastreamer2/include, @@ -2207,7 +2207,7 @@ HAVE_SILK, ); GCC_THUMB_SUPPORT = NO; - GCC_VERSION = com.apple.compilers.llvmgcc42; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; HEADER_SEARCH_PATHS = ( submodules/linphone/coreapi, submodules/linphone/mediastreamer2/include, diff --git a/submodules/linphone b/submodules/linphone index 23d589cec..630e26944 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 23d589cec01361b7c08528cd7433d5b01c0579bb +Subproject commit 630e26944dd6e5cca53787452b162ec6baf7ba48