From 49188892f5a391586b334393177a1f2d29fa3f3d Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Thu, 15 Jan 2015 11:44:56 +0100 Subject: [PATCH] Fir #2009: Update linphone for SAL fix and use linphone_core_interpret_url() instead of linphone_address_new(). This simplifies the -call: method. --- Classes/LinphoneManager.m | 30 ++++++++---------------------- submodules/linphone | 2 +- 2 files changed, 9 insertions(+), 23 deletions(-) diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index fba329fc4..4677b742e 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -1863,8 +1863,6 @@ static void audioRouteChangeListenerCallback ( BOOL addressIsASCII = [address canBeConvertedToEncoding:[NSString defaultCStringEncoding]]; if ([address length] == 0) return; //just return - - if( !addressIsASCII ){ UIAlertView* error = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Invalid SIP address",nil) message:NSLocalizedString(@"The address should only contain ASCII data",nil) @@ -1874,9 +1872,11 @@ static void audioRouteChangeListenerCallback ( [error show]; [error release]; - } else if ([address hasPrefix:@"sip:"] || [address hasPrefix:@"sips:"]) { + } + LinphoneAddress* linphoneAddress = linphone_core_interpret_url(theLinphoneCore, [address cStringUsingEncoding:[NSString defaultCStringEncoding]]); + + if (linphoneAddress) { - LinphoneAddress* linphoneAddress = linphone_address_new([address cStringUsingEncoding:[NSString defaultCStringEncoding]]); if(displayName!=nil) { linphone_address_set_display_name(linphoneAddress,[displayName cStringUsingEncoding:[NSString defaultCStringEncoding]]); } @@ -1889,7 +1889,7 @@ static void audioRouteChangeListenerCallback ( } linphone_address_destroy(linphoneAddress); - } else if (proxyCfg==nil){ + } else { UIAlertView* error = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Invalid SIP address",nil) message:NSLocalizedString(@"Either configure a SIP proxy server from settings prior to place a call or use a valid SIP address (I.E sip:john@example.net)",nil) @@ -1899,23 +1899,9 @@ static void audioRouteChangeListenerCallback ( [error show]; [error release]; - } else { - char normalizedUserName[256]; - LinphoneAddress* linphoneAddress = linphone_address_new(linphone_core_get_identity(theLinphoneCore)); - linphone_proxy_config_normalize_number(proxyCfg,[address cStringUsingEncoding:[NSString defaultCStringEncoding]],normalizedUserName,sizeof(normalizedUserName)); - linphone_address_set_username(linphoneAddress, normalizedUserName); - if(displayName!=nil) { - linphone_address_set_display_name(linphoneAddress, [displayName cStringUsingEncoding:[NSString defaultCStringEncoding]]); - } - if ([[LinphoneManager instance] lpConfigBoolForKey:@"override_domain_with_default_one"]) - linphone_address_set_domain(linphoneAddress, [[[LinphoneManager instance] lpConfigStringForKey:@"domain" forSection:@"wizard"] cStringUsingEncoding:[NSString defaultCStringEncoding]]); - if(transfer) { - linphone_core_transfer_call(theLinphoneCore, linphone_core_get_current_call(theLinphoneCore), linphone_address_as_string_uri_only(linphoneAddress)); - } else { - call=linphone_core_invite_address_with_params(theLinphoneCore, linphoneAddress, lcallParams); - } - linphone_address_destroy(linphoneAddress); - } + } + + if (call) { // The LinphoneCallAppData object should be set on call creation with callback // - (void)onCall:StateChanged:withMessage:. If not, we are in big trouble and expect it to crash diff --git a/submodules/linphone b/submodules/linphone index c0870da1e..f2a4cb60d 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit c0870da1e7e360dadc511bc404f7f5a24f56e4f8 +Subproject commit f2a4cb60d2928f96b5300011aa8398d14c8e22a2