mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
Don't allow non-ascii username/address when calling
This commit is contained in:
parent
b4da3874c2
commit
1980ff0ac1
1 changed files with 19 additions and 2 deletions
|
|
@ -1805,8 +1805,22 @@ static void audioRouteChangeListenerCallback (
|
|||
}
|
||||
LinphoneCall* call=NULL;
|
||||
|
||||
BOOL addressIsASCII = [address canBeConvertedToEncoding:[NSString defaultCStringEncoding]];
|
||||
|
||||
if ([address length] == 0) return; //just return
|
||||
if ([address hasPrefix:@"sip:"] || [address hasPrefix:@"sips:"]) {
|
||||
|
||||
|
||||
if( !addressIsASCII ){
|
||||
UIAlertView* error = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Invalid SIP address",nil)
|
||||
message:NSLocalizedString(@"The address should only contain ASCII data",nil)
|
||||
delegate:nil
|
||||
cancelButtonTitle:NSLocalizedString(@"Continue",nil)
|
||||
otherButtonTitles:nil];
|
||||
[error show];
|
||||
[error release];
|
||||
|
||||
} else if ([address hasPrefix:@"sip:"] || [address hasPrefix:@"sips:"]) {
|
||||
|
||||
LinphoneAddress* linphoneAddress = linphone_address_new([address cStringUsingEncoding:[NSString defaultCStringEncoding]]);
|
||||
if(displayName!=nil) {
|
||||
linphone_address_set_display_name(linphoneAddress,[displayName cStringUsingEncoding:[NSString defaultCStringEncoding]]);
|
||||
|
|
@ -1819,7 +1833,9 @@ static void audioRouteChangeListenerCallback (
|
|||
call=linphone_core_invite_address_with_params(theLinphoneCore, linphoneAddress, lcallParams);
|
||||
}
|
||||
linphone_address_destroy(linphoneAddress);
|
||||
|
||||
} else if (proxyCfg==nil){
|
||||
|
||||
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)
|
||||
delegate:nil
|
||||
|
|
@ -1827,7 +1843,8 @@ static void audioRouteChangeListenerCallback (
|
|||
otherButtonTitles:nil];
|
||||
[error show];
|
||||
[error release];
|
||||
} else {
|
||||
|
||||
} 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));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue