From 1f028da67990305bf40755ff9d4213abb8982fe0 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Tue, 11 Sep 2012 17:58:57 +0200 Subject: [PATCH 1/3] Add files to .gitignore --- .gitignore | 2 ++ linphone.xcodeproj/.gitignore | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 linphone.xcodeproj/.gitignore 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/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 From 3d3e7257dadc6239308a4d422bc8d707d4c58da9 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Wed, 12 Sep 2012 15:54:05 +0200 Subject: [PATCH 2/3] fix configuration issue --- Classes/LinphoneCoreSettingsStore.m | 13 ++++++++++--- Classes/LinphoneManager.m | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m index 655f6859e..6a820991e 100644 --- a/Classes/LinphoneCoreSettingsStore.m +++ b/Classes/LinphoneCoreSettingsStore.m @@ -102,7 +102,7 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); [self setString: linphone_address_get_username(addr) forKey:@"username_preference"]; [self setString: linphone_address_get_domain(addr) forKey:@"domain_preference"]; - [self setInteger: lp_config_get_int(linphone_core_get_config(lc),"default_values","reg_expires",600) forKey:@"expire_preference"]; + [self setInteger: linphone_proxy_config_get_expires(cfg) forKey:@"expire_preference"]; [self setString:linphone_proxy_config_get_dial_prefix(cfg) forKey:@"prefix_preference"]; if (strcmp(linphone_address_get_domain(addr),linphone_address_get_domain(proxy_addr))!=0 || port!=NULL){ @@ -119,6 +119,8 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); [self setBool:linphone_proxy_config_get_dial_escape_plus(cfg) forKey:@"substitute_+_by_00_preference"]; } + } else { + [self setInteger: lp_config_get_int(linphone_core_get_config(lc),"default_values","reg_expires",600) forKey:@"expire_preference"]; } { LinphoneAddress *parsed = linphone_core_get_primary_contact_parsed(lc); @@ -191,7 +193,8 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); [self setBool: lp_config_get_int(linphone_core_get_config(lc),"app","animations_preference", 1) forKey:@"animations_preference"]; [self setBool: lp_config_get_int(linphone_core_get_config(lc),"app","check_config_disable_preference", 0) forKey:@"check_config_disable_preference"]; [self setBool: lp_config_get_int(linphone_core_get_config(lc),"app","wifi_only_preference", 0) forKey:@"wifi_only_preference"]; - + [self setString: lp_config_get_string(linphone_core_get_config(lc),"app","file_upload_url_preference",NULL) forKey:@"file_upload_url_preference"]; + /*keep this one also in the standardUserDefaults so that it can be read before starting liblinphone*/ BOOL start_at_boot = TRUE; if ([[NSUserDefaults standardUserDefaults] objectForKey:@"start_at_boot_preference"]!=Nil) @@ -355,7 +358,7 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); int expire = [self integerForKey:@"expire_preference"]; - lp_config_set_int(linphone_core_get_config(lc),"default_values","reg_expires",expire); + linphone_proxy_config_expires(proxyCfg,expire); BOOL isWifiOnly = [self boolForKey:@"wifi_only_preference"]; @@ -505,6 +508,10 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); BOOL animations = [self boolForKey:@"animations_preference"]; lp_config_set_int(linphone_core_get_config(lc),"app","animations_preference", animations); + NSString* file_upload_url= [self stringForKey:@"file_upload_url_preference"]; + [[LinphoneManager instance] lpConfigSetString:file_upload_url forKey:@"file_upload_url_preference"]; + + /*keep this one also in the standardUserDefaults so that it can be read before starting liblinphone*/ BOOL start_at_boot = [self boolForKey:@"start_at_boot_preference"]; diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 8917def89..c1be9d34e 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -1067,7 +1067,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) { From 5e97c0c7e796ff7da3ace1fb947e149c1ee1ed43 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Wed, 12 Sep 2012 17:36:09 +0200 Subject: [PATCH 3/3] Small fixes --- Classes/LinphoneAppDelegate.m | 16 ++++++++-------- Classes/LinphoneManager.h | 5 ----- Classes/LinphoneManager.m | 33 ++++++++------------------------- Classes/LinphoneUI/UIStateBar.m | 8 +------- Classes/PhoneMainView.h | 4 ++++ Classes/PhoneMainView.m | 19 ++++++++++++++++--- Classes/Utils/FastAddressBook.m | 3 +++ 7 files changed, 40 insertions(+), 48 deletions(-) diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index 5f75c7652..ee31bfbf9 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -209,17 +209,17 @@ 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"]) { - [[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]; + } } } } diff --git a/Classes/LinphoneManager.h b/Classes/LinphoneManager.h index c63a76ca6..1ab4f74d1 100644 --- a/Classes/LinphoneManager.h +++ b/Classes/LinphoneManager.h @@ -33,7 +33,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; @@ -79,7 +78,6 @@ typedef struct _LinphoneManagerSounds { time_t lastRemoteNotificationTime; Connectivity connectivity; BOOL stopWaitingRegisters; - NSMutableArray *inhibitedEvent; @public CallContext currentCallContextBeforeGoingBackground; @@ -111,9 +109,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 c1be9d34e..ea7670878 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -40,7 +40,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"; NSString *const kLinphoneAddressBookUpdate = @"LinphoneAddressBookUpdate"; @@ -204,13 +203,12 @@ struct codec_name_pref_table codec_pref_table[]={ } } - inhibitedEvent = [[NSMutableArray alloc] init]; logs = [[NSMutableArray alloc] init]; database = NULL; speakerEnabled = FALSE; [self openDatabase]; [self copyDefaultSettings]; - lastRemoteNotificationTime=0; + lastRemoteNotificationTime=0; } return self; } @@ -223,7 +221,6 @@ struct codec_name_pref_table codec_pref_table[]={ AudioServicesDisposeSystemSoundID(sounds.message); } - [inhibitedEvent release]; [fastAddressBook release]; [self closeDatabase]; [logs release]; @@ -713,7 +710,6 @@ static LinphoneCoreVTable linphonec_vtable = { } } - - (void)destroyLibLinphone { [mIterateTimer invalidate]; AVAudioSession *audioSession = [AVAudioSession sharedInstance]; @@ -732,16 +728,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 { @@ -1009,19 +1005,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 diff --git a/Classes/LinphoneUI/UIStateBar.m b/Classes/LinphoneUI/UIStateBar.m index 25877646e..0ef68f27a 100644 --- a/Classes/LinphoneUI/UIStateBar.m +++ b/Classes/LinphoneUI/UIStateBar.m @@ -142,23 +142,17 @@ NSTimer *callSecurityTimer; message = NSLocalizedString(@"Registration failed", nil); break; case LinphoneRegistrationProgress: message = NSLocalizedString(@"Registration in progress", nil); break; - //case LinphoneRegistrationCleared: m= @"No SIP account"; break; default: break; } } registrationStateLabel.hidden = NO; switch(state) { - case LinphoneRegistrationCleared: - /* image.hidden = NO; - [image setImage:[UIImage imageNamed:@"status_orange.png"]]; - [spinner stopAnimating]; - [label setText:message != nil ? message : NSLocalizedString(@"No SIP account defined", nil)];*/ - break; case LinphoneRegistrationFailed: registrationStateImage.hidden = NO; image = [UIImage imageNamed:@"led_error.png"]; break; + case LinphoneRegistrationCleared: case LinphoneRegistrationNone: registrationStateImage.hidden = NO; image = [UIImage imageNamed:@"led_disconnected.png"]; diff --git a/Classes/PhoneMainView.h b/Classes/PhoneMainView.h index c3aee2c38..4d6c91ede 100644 --- a/Classes/PhoneMainView.h +++ b/Classes/PhoneMainView.h @@ -45,6 +45,7 @@ UIActionSheet *batteryActionSheet; int loadCount; NSMutableArray *viewStack; + NSMutableArray *inhibitedEvents; } @property (nonatomic, retain) IBOutlet UICompositeViewController *mainViewController; @@ -61,6 +62,9 @@ + (void)setOrientation:(UIInterfaceOrientation)orientation animated:(BOOL)animated; +- (void)addInhibitedEvent:(id)event; +- (BOOL)removeInhibitedEvent:(id)event; + + (PhoneMainView*) instance; @end diff --git a/Classes/PhoneMainView.m b/Classes/PhoneMainView.m index 95f08976c..9817aaa1c 100644 --- a/Classes/PhoneMainView.m +++ b/Classes/PhoneMainView.m @@ -43,6 +43,7 @@ static PhoneMainView* phoneMainViewInstance=nil; currentView = nil; viewStack = [[NSMutableArray alloc] init]; loadCount = 0; // For avoiding IOS 4 bug + inhibitedEvents = [[NSMutableArray alloc] init]; } - (id)init { @@ -73,7 +74,7 @@ static PhoneMainView* phoneMainViewInstance=nil; [[NSNotificationCenter defaultCenter] removeObserver:self]; [mainViewController release]; - + [inhibitedEvents release]; [viewStack release]; [super dealloc]; @@ -566,6 +567,18 @@ static PhoneMainView* phoneMainViewInstance=nil; } } +- (void)addInhibitedEvent:(id)event { + [inhibitedEvents addObject:event]; +} + +- (BOOL)removeInhibitedEvent:(id)event { + NSUInteger index = [inhibitedEvents indexOfObject:event]; + if(index != NSNotFound) { + [inhibitedEvents removeObjectAtIndex:index]; + return TRUE; + } + return FALSE; +} #pragma mark - ActionSheet Functions @@ -595,7 +608,7 @@ static PhoneMainView* phoneMainViewInstance=nil; [[UIApplication sharedApplication] presentLocalNotificationNow:notif]; } } else { - if(![[LinphoneManager instance] removeInhibitedEvent:kLinphoneTextReceivedSound]) { + if(![self removeInhibitedEvent:kLinphoneTextReceived]) { AudioServicesPlaySystemSound([LinphoneManager instance].sounds.message); } } @@ -634,7 +647,7 @@ static PhoneMainView* phoneMainViewInstance=nil; address = @"Unknown"; } if (![[LinphoneManager instance] shouldAutoAcceptCall]){ - // case where a remote notification is already received + // case where a remote notification is not already received // Create a new local notification appData->notification = [[UILocalNotification alloc] init]; if (appData->notification) { 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; }