From bd58dca1e02672644b586485c61ea2661d9fae41 Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Fri, 21 Nov 2014 14:53:38 +0100 Subject: [PATCH] Fix for #1821: Entering a real SIP address in Proxy field makes it crash --- Classes/LinphoneCoreSettingsStore.m | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m index b48551168..003845045 100644 --- a/Classes/LinphoneCoreSettingsStore.m +++ b/Classes/LinphoneCoreSettingsStore.m @@ -293,6 +293,10 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); [alertview release]; } ++ (BOOL)hasSipPrefix:(NSString*)str { + return [str hasPrefix:@"sip:"] || [str hasPrefix:@"sips:"]; +} + - (void)synchronizeAccount { LinphoneCore *lc = [LinphoneManager getLc]; LpConfig* conf = linphone_core_get_config(lc); @@ -352,9 +356,11 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); if( isWifiOnly && [LinphoneManager instance].connectivity == wwan ) expire = 0; if ((!proxyAddress || [proxyAddress length] <1 ) && domain) { - proxyAddress = [NSString stringWithFormat:@"sip:%@",domain] ; - } else { - proxyAddress = [NSString stringWithFormat:@"sip:%@",proxyAddress] ; + proxyAddress = domain; + } + + if( ![LinphoneCoreSettingsStore hasSipPrefix:proxyAddress] ) { + proxyAddress = [NSString stringWithFormat:@"sip:%@",proxyAddress]; } char* proxy = ms_strdup([proxyAddress cStringUsingEncoding:[NSString defaultCStringEncoding]]);