diff --git a/Classes/CallView.m b/Classes/CallView.m
index 7fa271387..b78afd84d 100644
--- a/Classes/CallView.m
+++ b/Classes/CallView.m
@@ -232,6 +232,23 @@ static UICompositeViewDescription *compositeDescription = nil;
// reseting speaker button because no more call
_speakerButton.selected = FALSE;
}
+
+ NSString *address = [LinphoneManager.instance lpConfigStringForKey:@"sas_dialog_denied"];
+ if (address) {
+ UIConfirmationDialog *securityDialog = [UIConfirmationDialog ShowWithMessage:NSLocalizedString(@"Trust has been denied. Make a call to start the authentication process again.", nil)
+ cancelMessage:NSLocalizedString(@"CANCELL", nil)
+ confirmMessage:NSLocalizedString(@"CALL", nil)
+ onCancelClick:^() {
+ }
+ onConfirmationClick:^() {
+ LinphoneAddress *addr = linphone_address_new(address.UTF8String);
+ [LinphoneManager.instance doCallWithSas:addr isSas:TRUE];
+ linphone_address_unref(addr);
+ } ];
+ [securityDialog.securityImage setImage:[UIImage imageNamed:@"security_alert_indicator.png"]];
+ securityDialog.securityImage.hidden = FALSE;
+ [LinphoneManager.instance lpConfigSetString:nil forKey:@"sas_dialog_denied"];
+ }
}
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
diff --git a/Classes/ChatConversationView.m b/Classes/ChatConversationView.m
index e5bfa4f42..ebb32377b 100644
--- a/Classes/ChatConversationView.m
+++ b/Classes/ChatConversationView.m
@@ -575,19 +575,19 @@ static UICompositeViewDescription *compositeDescription = nil;
- (IBAction)onEncryptedDevicesClick:(id)sender {
BOOL isOneToOne = linphone_chat_room_get_capabilities(_chatRoom) & LinphoneChatRoomCapabilitiesOneToOne;
NSString *message = NSLocalizedString(@"Instant messages are end-to-end encrypted in secured conversations. It is possible to upgrade the security level of a conversation by authenticating participants. To do so, call the contact and follow the authentification process.",nil);
-
+ BOOL notAskAgain = [LinphoneManager.instance lpConfigBoolForKey:@"confirmation_dialog_before_sas_call_not_ask_again"];
if (isOneToOne) {
bctbx_list_t *participants = linphone_chat_room_get_participants(_chatRoom);
LinphoneParticipant *firstParticipant = participants ? (LinphoneParticipant *)participants->data : NULL;
const LinphoneAddress *addr = firstParticipant ? linphone_participant_get_address(firstParticipant) : linphone_chat_room_get_peer_address(_chatRoom);
if (bctbx_list_size(linphone_participant_get_devices(firstParticipant)) == 1) {
- if (securityDialog && securityDialog.notAskAgain) {
- [LinphoneManager.instance doCall:addr];
+ if (notAskAgain) {
+ [LinphoneManager.instance doCallWithSas:addr isSas:TRUE];
} else {
securityDialog = [UIConfirmationDialog ShowWithMessage:message cancelMessage:NSLocalizedString(@"CANCELL", nil) confirmMessage:NSLocalizedString(@"CALL", nil) onCancelClick:^() {
} onConfirmationClick:^() {
- [LinphoneManager.instance doCall:addr];
+ [LinphoneManager.instance doCallWithSas:addr isSas:TRUE];
}];
securityDialog.authView.hidden = FALSE;
}
@@ -595,15 +595,12 @@ static UICompositeViewDescription *compositeDescription = nil;
}
}
- if (securityDialog && securityDialog.notAskAgain) {
+ if (notAskAgain) {
[self goToDeviceListView];
} else {
securityDialog = [UIConfirmationDialog ShowWithMessage:message cancelMessage:NSLocalizedString(@"CANCELL", nil) confirmMessage:NSLocalizedString(@"OK", nil) onCancelClick:^() {
} onConfirmationClick:^() {
- DevicesListView *view = VIEW(DevicesListView);
- view.room = _chatRoom;
-
- [PhoneMainView.instance popToView:view.compositeViewDescription];
+ [self goToDeviceListView];
}];
securityDialog.authView.hidden = FALSE;
}
diff --git a/Classes/LinphoneManager.h b/Classes/LinphoneManager.h
index 9dd0454de..a986a04c7 100644
--- a/Classes/LinphoneManager.h
+++ b/Classes/LinphoneManager.h
@@ -165,6 +165,7 @@ typedef struct _LinphoneManagerSounds {
- (void)send:(NSString *)replyText toChatRoom:(LinphoneChatRoom *)room;
- (void)call:(const LinphoneAddress *)address;
- (BOOL)doCall:(const LinphoneAddress *)iaddr;
+- (BOOL)doCallWithSas:(const LinphoneAddress *)iaddr isSas:(BOOL)isSas;
+(id)getMessageAppDataForKey:(NSString*)key inMessage:(LinphoneChatMessage*)msg;
+(void)setValueInMessageAppData:(id)value forKey:(NSString*)key inMessage:(LinphoneChatMessage*)msg;
diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m
index 517fc8aef..fa225a499 100644
--- a/Classes/LinphoneManager.m
+++ b/Classes/LinphoneManager.m
@@ -2717,54 +2717,60 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
}
- (BOOL)doCall:(const LinphoneAddress *)iaddr {
- LinphoneAddress *addr = linphone_address_clone(iaddr);
- NSString *displayName = [FastAddressBook displayNameForAddress:addr];
+ return [self doCallWithSas:iaddr isSas:false];
+}
- // Finally we can make the call
- LinphoneCallParams *lcallParams = linphone_core_create_call_params(theLinphoneCore, NULL);
- if ([self lpConfigBoolForKey:@"edge_opt_preference"] && (self.network == network_2g)) {
- LOGI(@"Enabling low bandwidth mode");
- linphone_call_params_enable_low_bandwidth(lcallParams, YES);
- }
-
- if (displayName != nil) {
- linphone_address_set_display_name(addr, displayName.UTF8String);
- }
- if ([LinphoneManager.instance lpConfigBoolForKey:@"override_domain_with_default_one"]) {
- linphone_address_set_domain(
- addr, [[LinphoneManager.instance lpConfigStringForKey:@"domain" inSection:@"assistant"] UTF8String]);
- }
-
- LinphoneCall *call;
- if (LinphoneManager.instance.nextCallIsTransfer) {
- char *caddr = linphone_address_as_string(addr);
- call = linphone_core_get_current_call(theLinphoneCore);
- linphone_call_transfer(call, caddr);
- LinphoneManager.instance.nextCallIsTransfer = NO;
- ms_free(caddr);
- } else {
+- (BOOL)doCallWithSas:(const LinphoneAddress *)iaddr isSas:(BOOL)isSas {
+ LinphoneAddress *addr = linphone_address_clone(iaddr);
+ NSString *displayName = [FastAddressBook displayNameForAddress:addr];
+
+ // Finally we can make the call
+ LinphoneCallParams *lcallParams = linphone_core_create_call_params(theLinphoneCore, NULL);
+ if ([self lpConfigBoolForKey:@"edge_opt_preference"] && (self.network == network_2g)) {
+ LOGI(@"Enabling low bandwidth mode");
+ linphone_call_params_enable_low_bandwidth(lcallParams, YES);
+ }
+
+ if (displayName != nil) {
+ linphone_address_set_display_name(addr, displayName.UTF8String);
+ }
+ if ([LinphoneManager.instance lpConfigBoolForKey:@"override_domain_with_default_one"]) {
+ linphone_address_set_domain(
+ addr, [[LinphoneManager.instance lpConfigStringForKey:@"domain" inSection:@"assistant"] UTF8String]);
+ }
+
+ LinphoneCall *call;
+ if (LinphoneManager.instance.nextCallIsTransfer) {
+ char *caddr = linphone_address_as_string(addr);
+ call = linphone_core_get_current_call(theLinphoneCore);
+ linphone_call_transfer(call, caddr);
+ LinphoneManager.instance.nextCallIsTransfer = NO;
+ ms_free(caddr);
+ } else {
//We set the record file name here because we can't do it after the call is started.
NSString *writablePath = [LinphoneUtils recordingFilePathFromCall:addr];
LOGD(@"record file path: %@\n", writablePath);
linphone_call_params_set_record_file(lcallParams, [writablePath cStringUsingEncoding:NSUTF8StringEncoding]);
- call = linphone_core_invite_address_with_params(theLinphoneCore, addr, lcallParams);
- 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
- // We are NOT responsible for creating the AppData.
- LinphoneCallAppData *data = (__bridge LinphoneCallAppData *)linphone_call_get_user_data(call);
- if (data == nil) {
- LOGE(@"New call instanciated but app data was not set. Expect it to crash.");
- /* will be used later to notify user if video was not activated because of the linphone core*/
- } else {
- data->videoRequested = linphone_call_params_video_enabled(lcallParams);
- }
- }
- }
- linphone_address_destroy(addr);
- linphone_call_params_destroy(lcallParams);
-
- return TRUE;
+ if (isSas)
+ linphone_call_params_set_media_encryption(lcallParams, LinphoneMediaEncryptionZRTP);
+ call = linphone_core_invite_address_with_params(theLinphoneCore, addr, lcallParams);
+ 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
+ // We are NOT responsible for creating the AppData.
+ LinphoneCallAppData *data = (__bridge LinphoneCallAppData *)linphone_call_get_user_data(call);
+ if (data == nil) {
+ LOGE(@"New call instanciated but app data was not set. Expect it to crash.");
+ /* will be used later to notify user if video was not activated because of the linphone core*/
+ } else {
+ data->videoRequested = linphone_call_params_video_enabled(lcallParams);
+ }
+ }
+ }
+ linphone_address_destroy(addr);
+ linphone_call_params_destroy(lcallParams);
+
+ return TRUE;
}
#pragma mark - Property Functions
diff --git a/Classes/LinphoneUI/Base.lproj/UIConfirmationDialog.xib b/Classes/LinphoneUI/Base.lproj/UIConfirmationDialog.xib
index 156520643..85125beff 100644
--- a/Classes/LinphoneUI/Base.lproj/UIConfirmationDialog.xib
+++ b/Classes/LinphoneUI/Base.lproj/UIConfirmationDialog.xib
@@ -56,7 +56,7 @@
-
+
diff --git a/Classes/LinphoneUI/StatusBarView.m b/Classes/LinphoneUI/StatusBarView.m
index 28d143a4e..45f323ce4 100644
--- a/Classes/LinphoneUI/StatusBarView.m
+++ b/Classes/LinphoneUI/StatusBarView.m
@@ -330,7 +330,7 @@
myCode = [code substringFromIndex:2];
}
NSString *message =
- [NSString stringWithFormat:NSLocalizedString(@"Confirmation security\n\n"
+ [NSString stringWithFormat:NSLocalizedString(@"\nConfirmation security\n\n"
@"Say: %@\n"
@"Confirm that your interlocutor\n"
@"says: %@",
@@ -381,12 +381,14 @@
linphone_call_set_authentication_token_verified(call, NO);
}
weakSelf->securityDialog = nil;
+ [LinphoneManager.instance lpConfigSetString:[NSString stringWithUTF8String:linphone_call_get_remote_address_as_string(call)] forKey:@"sas_dialog_denied"];
}
onConfirmationClick:^() {
if (linphone_core_get_current_call(LC) == call) {
linphone_call_set_authentication_token_verified(call, YES);
}
weakSelf->securityDialog = nil;
+ [LinphoneManager.instance lpConfigSetString:nil forKey:@"sas_dialog_denied"];
} ];
securityDialog.securityImage.hidden = FALSE;
diff --git a/Classes/LinphoneUI/UIConfirmationDialog.h b/Classes/LinphoneUI/UIConfirmationDialog.h
index 89f52ff95..1469c9de4 100644
--- a/Classes/LinphoneUI/UIConfirmationDialog.h
+++ b/Classes/LinphoneUI/UIConfirmationDialog.h
@@ -38,7 +38,6 @@ typedef void (^UIConfirmationBlock)(void);
@property (weak, nonatomic) IBOutlet UIView *authView;
@property(weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UIButton *authButton;
-@property BOOL notAskAgain;
- (IBAction)onCancelClick:(id)sender;
- (IBAction)onConfirmationClick:(id)sender;
diff --git a/Classes/LinphoneUI/UIConfirmationDialog.m b/Classes/LinphoneUI/UIConfirmationDialog.m
index 909f605a5..468453f60 100644
--- a/Classes/LinphoneUI/UIConfirmationDialog.m
+++ b/Classes/LinphoneUI/UIConfirmationDialog.m
@@ -24,7 +24,6 @@
dialog->onCancelCb = onCancel;
dialog->onConfirmCb = onConfirm;
- dialog.notAskAgain = FALSE;
if (cancel) {
[dialog.cancelButton setTitle:cancel forState:UIControlStateNormal];
@@ -93,9 +92,10 @@
}
- (IBAction)onAuthClick:(id)sender {
- _notAskAgain = !_notAskAgain;
- UIImage *image = _notAskAgain ? [UIImage imageNamed:@"checkbox_checked.png"] : [UIImage imageNamed:@"checkbox_unchecked.png"];
+ BOOL notAskAgain = ![LinphoneManager.instance lpConfigBoolForKey:@"confirmation_dialog_before_sas_call_not_ask_again"];
+ UIImage *image = notAskAgain ? [UIImage imageNamed:@"checkbox_checked.png"] : [UIImage imageNamed:@"checkbox_unchecked.png"];
[_authButton setImage:image forState:UIControlStateNormal];
+ [LinphoneManager.instance lpConfigSetBool:notAskAgain forKey:@"confirmation_dialog_before_sas_call_not_ask_again"];
}
- (void)dismiss {
diff --git a/Classes/LinphoneUI/UIDeviceCell.m b/Classes/LinphoneUI/UIDeviceCell.m
index c1ad88c97..915b149f9 100644
--- a/Classes/LinphoneUI/UIDeviceCell.m
+++ b/Classes/LinphoneUI/UIDeviceCell.m
@@ -39,7 +39,7 @@
- (IBAction)onSecurityCallClick:(id)sender {
const LinphoneAddress *addr = linphone_participant_device_get_address(_device);
if (addr)
- [LinphoneManager.instance doCall:addr];
+ [LinphoneManager.instance doCallWithSas:addr isSas:TRUE];
else
LOGE(@"CallKit : No call address");
}
diff --git a/Classes/LinphoneUI/UIDevicesDetails.m b/Classes/LinphoneUI/UIDevicesDetails.m
index 84964d56d..66497d622 100644
--- a/Classes/LinphoneUI/UIDevicesDetails.m
+++ b/Classes/LinphoneUI/UIDevicesDetails.m
@@ -40,7 +40,7 @@
LinphoneParticipantDevice *device = (LinphoneParticipantDevice *)bctbx_list_nth_data(_devices, 0);
const LinphoneAddress *addr = linphone_participant_device_get_address(device);
if (addr)
- [LinphoneManager.instance doCall:addr];
+ [LinphoneManager.instance doCallWithSas:addr isSas:TRUE];
else
LOGE(@"CallKit : No call address");
}