diff --git a/Classes/AssistantView.m b/Classes/AssistantView.m index 25d759f4c..893a9baca 100644 --- a/Classes/AssistantView.m +++ b/Classes/AssistantView.m @@ -289,21 +289,11 @@ static UICompositeViewDescription *compositeDescription = nil; LinphoneCore *lc = [LinphoneManager getLc]; [self resetTextFields]; - LinphoneProxyConfig *current_conf = NULL; - linphone_core_get_default_proxy([LinphoneManager getLc], ¤t_conf); + LinphoneProxyConfig *current_conf = linphone_core_get_default_proxy_config([LinphoneManager getLc]); if (current_conf != NULL) { - const char *proxy_addr = linphone_proxy_config_get_identity(current_conf); - if (proxy_addr) { - LinphoneAddress *addr = linphone_address_new(proxy_addr); - if (addr) { - const LinphoneAuthInfo *auth = linphone_core_find_auth_info( - lc, NULL, linphone_address_get_username(addr), linphone_proxy_config_get_domain(current_conf)); - linphone_address_destroy(addr); - if (auth) { - LOGI(@"A proxy config was set up with the remote provisioning, skip assistant"); - [self onDialerClick:nil]; - } - } + if (linphone_proxy_config_find_auth_info(current_conf) != NULL) { + LOGI(@"A proxy config was set up with the remote provisioning, skip assistant"); + [self onDialerClick:nil]; } } diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m index 89c903af5..fe09e33a6 100644 --- a/Classes/LinphoneCoreSettingsStore.m +++ b/Classes/LinphoneCoreSettingsStore.m @@ -456,7 +456,7 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); } // possible valid config detected, try to modify current proxy or create new one if none existing - linphone_core_get_default_proxy(lc, &proxyCfg); + proxyCfg = linphone_core_get_default_proxy_config(lc); if (proxyCfg == NULL) { proxyCfg = linphone_core_create_proxy_config(lc); } else { diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index f1d2363a3..70c2d3159 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -332,12 +332,10 @@ static int check_should_migrate_images(void *data, int argc, char **argv, char * NSString *newDbPath = [LinphoneManager documentFile:kLinphoneInternalChatDBFilename]; BOOL shouldMigrate = [[NSFileManager defaultManager] fileExistsAtPath:oldDbPath]; BOOL shouldMigrateImages = FALSE; - LinphoneProxyConfig *default_proxy; const char *identity = NULL; BOOL migrated = FALSE; char *attach_stmt = NULL; - - linphone_core_get_default_proxy(lc, &default_proxy); + LinphoneProxyConfig *default_proxy = linphone_core_get_default_proxy_config(lc); if (sqlite3_open([newDbPath UTF8String], &newDb) != SQLITE_OK) { LOGE(@"Can't open \"%@\" sqlite3 database.", newDbPath); @@ -1124,8 +1122,7 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach kSCNetworkReachabilityFlagsConnectionOnDemand; if (theLinphoneCore != nil) { - LinphoneProxyConfig *proxy; - linphone_core_get_default_proxy(theLinphoneCore, &proxy); + LinphoneProxyConfig *proxy = linphone_core_get_default_proxy_config(theLinphoneCore); struct NetworkReachabilityContext *ctx = nilCtx ? ((struct NetworkReachabilityContext *)nilCtx) : 0; if ((flags == 0) || (flags & networkDownFlags)) { @@ -1612,8 +1609,7 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) { [[UIApplication sharedApplication] backgroundTimeRemaining]); } - (BOOL)enterBackgroundMode { - LinphoneProxyConfig *proxyCfg; - linphone_core_get_default_proxy(theLinphoneCore, &proxyCfg); + LinphoneProxyConfig *proxyCfg = linphone_core_get_default_proxy_config(theLinphoneCore); BOOL shouldEnterBgMode = FALSE; // handle proxy config if any @@ -1987,8 +1983,7 @@ static void audioRouteChangeListenerCallback(void *inUserData, // 1 if (apushNotificationToken != nil) { pushNotificationToken = apushNotificationToken; } - LinphoneProxyConfig *cfg = nil; - linphone_core_get_default_proxy(theLinphoneCore, &cfg); + LinphoneProxyConfig *cfg = linphone_core_get_default_proxy_config(theLinphoneCore); if (cfg) { linphone_proxy_config_edit(cfg); [self configurePushTokenForProxyConfig:cfg]; @@ -2279,8 +2274,7 @@ static void audioRouteChangeListenerCallback(void *inUserData, // 1 - (NSString *)contactFilter { NSString *filter = @"*"; if ([self lpConfigBoolForKey:@"contact_filter_on_default_domain"]) { - LinphoneProxyConfig *proxy_cfg; - linphone_core_get_default_proxy(theLinphoneCore, &proxy_cfg); + LinphoneProxyConfig *proxy_cfg = linphone_core_get_default_proxy_config(theLinphoneCore); if (proxy_cfg && linphone_proxy_config_get_addr(proxy_cfg)) { return [NSString stringWithCString:linphone_proxy_config_get_domain(proxy_cfg) encoding:[NSString defaultCStringEncoding]]; diff --git a/Classes/LinphoneUI/StatusBarView.m b/Classes/LinphoneUI/StatusBarView.m index f444f312f..a9377c59d 100644 --- a/Classes/LinphoneUI/StatusBarView.m +++ b/Classes/LinphoneUI/StatusBarView.m @@ -66,8 +66,7 @@ object:nil]; // Update to default state - LinphoneProxyConfig *config = NULL; - linphone_core_get_default_proxy([LinphoneManager getLc], &config); + LinphoneProxyConfig *config = linphone_core_get_default_proxy_config([LinphoneManager getLc]); messagesUnreadCount = lp_config_get_int(linphone_core_get_config([LinphoneManager getLc]), "app", "voice_mail_messages_count", 0); @@ -98,8 +97,7 @@ #pragma mark - Event Functions - (void)registrationUpdate:(NSNotification *)notif { - LinphoneProxyConfig *config = NULL; - linphone_core_get_default_proxy([LinphoneManager getLc], &config); + LinphoneProxyConfig *config = linphone_core_get_default_proxy_config([LinphoneManager getLc]); [self proxyConfigUpdate:config]; } diff --git a/Classes/LinphoneUI/UICallButton.m b/Classes/LinphoneUI/UICallButton.m index f6a7fd4d7..2bc5bd91e 100644 --- a/Classes/LinphoneUI/UICallButton.m +++ b/Classes/LinphoneUI/UICallButton.m @@ -59,38 +59,30 @@ #pragma mark - - (void)touchUp:(id)sender { - NSString *address = [addressField text]; + NSString *address = addressField.text; + if (address.length == 0) { + LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCallLog *log = linphone_core_get_last_outgoing_call_log(lc); + if (log) { + LinphoneAddress *to = linphone_call_log_get_to(log); + const char *domain = linphone_address_get_domain(to); + char *bis_address = NULL; + LinphoneProxyConfig *def_proxy = linphone_core_get_default_proxy_config(lc); - if ([address length] == 0) { - const MSList *logs = linphone_core_get_call_logs([LinphoneManager getLc]); - while (logs) { - LinphoneCallLog *log = logs->data; - if (linphone_call_log_get_dir(log) == LinphoneCallOutgoing) { - LinphoneProxyConfig *def_proxy = NULL; - LinphoneAddress *to = linphone_call_log_get_to(log); - const char *domain = linphone_address_get_domain(to); - char *bis_address = NULL; - - linphone_core_get_default_proxy([LinphoneManager getLc], &def_proxy); - - // if the 'to' address is on the default proxy, only present the username - if (def_proxy) { - const char *def_domain = linphone_proxy_config_get_domain(def_proxy); - if (def_domain && domain && !strcmp(domain, def_domain)) { - bis_address = ms_strdup(linphone_address_get_username(to)); - } + // if the 'to' address is on the default proxy, only present the username + if (def_proxy) { + const char *def_domain = linphone_proxy_config_get_domain(def_proxy); + if (def_domain && domain && !strcmp(domain, def_domain)) { + bis_address = ms_strdup(linphone_address_get_username(to)); } - - if (bis_address == NULL) { - bis_address = linphone_address_as_string_uri_only(to); - } - - [addressField setText:[NSString stringWithUTF8String:bis_address]]; - ms_free(bis_address); - // return after filling the address, let the user confirm the call by pressing again - return; } - logs = ms_list_next(logs); + if (bis_address == NULL) { + bis_address = linphone_address_as_string_uri_only(to); + } + [addressField setText:[NSString stringWithUTF8String:bis_address]]; + ms_free(bis_address); + // return after filling the address, let the user confirm the call by pressing again + return; } } diff --git a/Classes/PhoneMainView.m b/Classes/PhoneMainView.m index 99f43d259..275cbbce8 100644 --- a/Classes/PhoneMainView.m +++ b/Classes/PhoneMainView.m @@ -296,8 +296,7 @@ static RootViewManager *rootViewManagerInstance = nil; LinphoneGlobalState state = (LinphoneGlobalState)[[[notif userInfo] valueForKey:@"state"] integerValue]; static BOOL already_shown = FALSE; if (state == LinphoneGlobalOn && !already_shown && [LinphoneManager instance].wasRemoteProvisioned) { - LinphoneProxyConfig *conf = NULL; - linphone_core_get_default_proxy([LinphoneManager getLc], &conf); + LinphoneProxyConfig *conf = linphone_core_get_default_proxy_config([LinphoneManager getLc]); if ([[LinphoneManager instance] lpConfigBoolForKey:@"show_login_view" forSection:@"app"] && conf == NULL) { already_shown = TRUE; AssistantView *view = VIEW(AssistantView); @@ -627,8 +626,7 @@ static RootViewManager *rootViewManagerInstance = nil; NSString *lTitle; // get default proxy - LinphoneProxyConfig *proxyCfg; - linphone_core_get_default_proxy([LinphoneManager getLc], &proxyCfg); + LinphoneProxyConfig *proxyCfg = linphone_core_get_default_proxy_config([LinphoneManager getLc]); if (proxyCfg == nil) { lMessage = NSLocalizedString(@"Please make sure your device is connected to the internet and double check your " @"SIP account configuration in the settings.", diff --git a/submodules/linphone b/submodules/linphone index a95fde282..9d403f30b 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit a95fde282a07cb1e90a2c78f81ddc1a9451375e9 +Subproject commit 9d403f30b38514ef4e41963c3da78af2f31052ee