diff --git a/.gitignore b/.gitignore index 9c6145750..e2f3c65b2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ build-* *.locuser +.DS_Store +liblinphone-sdk diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index 74c374d17..f853437b4 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -245,6 +245,7 @@ - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { [LinphoneLogger log:LinphoneLoggerDebug format:@"PushNotification: Receive %@", userInfo]; + /* MODIFICATION: Remove remote notification NSDictionary *aps = [userInfo objectForKey:@"aps"]; if(aps != nil) { NSDictionary *alert = [aps objectForKey:@"alert"]; @@ -252,22 +253,21 @@ NSString *loc_key = [alert objectForKey:@"loc-key"]; /*if we receive a remote notification, it is because our TCP background socket was no more working. As a result, break it and refresh registers in order to make sure to receive incoming INVITE or MESSAGE*/ - LinphoneCore *lc=[LinphoneManager getLc]; - linphone_core_set_network_reachable(lc,FALSE); - linphone_core_set_network_reachable(lc,TRUE); + LinphoneCore *lc = [LinphoneManager getLc]; + linphone_core_set_network_reachable(lc, FALSE); + linphone_core_set_network_reachable(lc, TRUE); if(loc_key != nil) { if([loc_key isEqualToString:@"IM_MSG"]) { - /* MODIFICATION: Remove remote notification - [[LinphoneManager instance] addInhibitedEvent:kLinphoneTextReceivedSound]; + [[PhoneMainView instance] addInhibitedEvent:kLinphoneTextReceived]; [[PhoneMainView instance] changeCurrentView:[ChatViewController compositeViewDescription]]; - */ - }else{ - //it's a call - [[LinphoneManager instance] didReceiveRemoteNotification]; - } + } else if([loc_key isEqualToString:@"IC_MSG"]) { + //it's a call + [[LinphoneManager instance] didReceiveRemoteNotification]; + } } } } + */ } - (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification { diff --git a/Classes/LinphoneManager.h b/Classes/LinphoneManager.h index c80b11269..32dc60aa6 100644 --- a/Classes/LinphoneManager.h +++ b/Classes/LinphoneManager.h @@ -32,7 +32,6 @@ extern NSString *const kLinphoneDisplayStatusUpdate; extern NSString *const kLinphoneTextReceived; -extern NSString *const kLinphoneTextReceivedSound; extern NSString *const kLinphoneCallUpdate; extern NSString *const kLinphoneRegistrationUpdate; extern NSString *const kLinphoneMainViewChange; @@ -85,7 +84,6 @@ typedef struct _LinphoneManagerSounds { time_t lastRemoteNotificationTime; Connectivity connectivity; BOOL stopWaitingRegisters; - NSMutableArray *inhibitedEvent; /* MODIFICATION: Add NSUSerdefault settings */ NSDictionary *currentSettings; @@ -121,9 +119,6 @@ typedef struct _LinphoneManagerSounds { - (void)refreshRegisters; -- (void)addInhibitedEvent:(NSString*)event; -- (BOOL)removeInhibitedEvent:(NSString*)event; - + (BOOL)copyFile:(NSString*)src destination:(NSString*)dst override:(BOOL)override; + (NSString*)bundleFile:(NSString*)file; + (NSString*)documentFile:(NSString*)file; diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 1e2814205..e10a05f43 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -38,7 +38,6 @@ static LinphoneManager* theLinphoneManager = nil; NSString *const kLinphoneDisplayStatusUpdate = @"LinphoneDisplayStatusUpdate"; NSString *const kLinphoneTextReceived = @"LinphoneTextReceived"; -NSString *const kLinphoneTextReceivedSound = @"LinphoneTextReceivedSound"; NSString *const kLinphoneCallUpdate = @"LinphoneCallUpdate"; NSString *const kLinphoneRegistrationUpdate = @"LinphoneRegistrationUpdate"; /* MODIFICATION: Add buschjaeger configuration event */ @@ -213,7 +212,6 @@ struct codec_name_pref_table codec_pref_table[]={ sounds.level = 0; /**/ - inhibitedEvent = [[NSMutableArray alloc] init]; logs = [[NSMutableArray alloc] init]; database = NULL; speakerEnabled = FALSE; @@ -221,7 +219,7 @@ struct codec_name_pref_table codec_pref_table[]={ [self openDatabase]; /**/ [self copyDefaultSettings]; - + lastRemoteNotificationTime=0; /* MODIFICATION: Add buschjaeger configuration */ configuration = [[BuschJaegerConfiguration alloc] init]; [configuration loadFile:kLinphoneConfigurationPath]; @@ -238,7 +236,6 @@ struct codec_name_pref_table codec_pref_table[]={ AudioServicesDisposeSystemSoundID(sounds.message); } - [inhibitedEvent release]; [fastAddressBook release]; [self closeDatabase]; [logs release]; @@ -739,7 +736,6 @@ static LinphoneCoreVTable linphonec_vtable = { } } - - (void)destroyLibLinphone { [mIterateTimer invalidate]; AVAudioSession *audioSession = [AVAudioSession sharedInstance]; @@ -758,16 +754,16 @@ static LinphoneCoreVTable linphonec_vtable = { } - (void)didReceiveRemoteNotification{ - lastRemoteNotificationTime=time(NULL); + lastRemoteNotificationTime=time(NULL); } - (BOOL)shouldAutoAcceptCall{ - if (lastRemoteNotificationTime!=0){ - if ((time(NULL)-lastRemoteNotificationTime)<15) - return TRUE; - lastRemoteNotificationTime=0; - } - return FALSE; + if (lastRemoteNotificationTime!=0){ + if ((time(NULL)-lastRemoteNotificationTime)<15) + return TRUE; + lastRemoteNotificationTime=0; + } + return FALSE; } - (BOOL)resignActive { @@ -1037,19 +1033,6 @@ static void audioRouteChangeListenerCallback ( */ } -- (void)addInhibitedEvent:(NSString*)event { - [inhibitedEvent addObject:event]; -} - -- (BOOL)removeInhibitedEvent:(NSString*)event { - NSUInteger index = [inhibitedEvent indexOfObject:kLinphoneTextReceivedSound]; - if(index != NSNotFound) { - [inhibitedEvent removeObjectAtIndex:index]; - return TRUE; - } - return FALSE; -} - #pragma mark - Misc Functions @@ -1389,7 +1372,7 @@ static void audioRouteChangeListenerCallback ( -(void)lpConfigSetString:(NSString*) value forKey:(NSString*) key { - lp_config_set_string(linphone_core_get_config(theLinphoneCore),"app",value?[key UTF8String]:NULL, [value UTF8String]); + lp_config_set_string(linphone_core_get_config(theLinphoneCore),"app",[key UTF8String], value?[value UTF8String]:NULL); } -(NSString*)lpConfigStringForKey:(NSString*) key { if (!theLinphoneCore) { diff --git a/Classes/Utils/FastAddressBook.m b/Classes/Utils/FastAddressBook.m index 3994fb536..ee5d2ffeb 100644 --- a/Classes/Utils/FastAddressBook.m +++ b/Classes/Utils/FastAddressBook.m @@ -74,6 +74,9 @@ ret = [ret substringFromIndex:4]; } ret = [@"sip:" stringByAppendingString:ret]; + if([ret hasSuffix:@":5060"]) { + ret = [ret substringToIndex:[ret length] - 5]; + } } return ret; } diff --git a/linphone.xcodeproj/.gitignore b/linphone.xcodeproj/.gitignore new file mode 100644 index 000000000..7f42cdded --- /dev/null +++ b/linphone.xcodeproj/.gitignore @@ -0,0 +1,2 @@ +project.xcworkspace +xcuserdata