diff --git a/Classes/LinphoneManager.h b/Classes/LinphoneManager.h
index bd25e7351..b8c0b1c9f 100644
--- a/Classes/LinphoneManager.h
+++ b/Classes/LinphoneManager.h
@@ -51,6 +51,7 @@ extern NSString *const kLinphoneBluetoothAvailabilityUpdate;
extern NSString *const kLinphoneConfiguringStateUpdate;
extern NSString *const kLinphoneGlobalStateUpdate;
extern NSString *const kLinphoneNotifyReceived;
+extern NSString *const kLinphoneCallEncryptionChanged;
extern NSString *const kLinphoneFileTransferSendUpdate;
extern NSString *const kLinphoneFileTransferRecvUpdate;
diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m
index 631eb0b6f..bf6f8f7be 100644
--- a/Classes/LinphoneManager.m
+++ b/Classes/LinphoneManager.m
@@ -71,6 +71,7 @@ NSString *const kLinphoneBluetoothAvailabilityUpdate = @"LinphoneBluetoothAvaila
NSString *const kLinphoneConfiguringStateUpdate = @"LinphoneConfiguringStateUpdate";
NSString *const kLinphoneGlobalStateUpdate = @"LinphoneGlobalStateUpdate";
NSString *const kLinphoneNotifyReceived = @"LinphoneNotifyReceived";
+NSString *const kLinphoneCallEncryptionChanged = @"LinphoneCallEncryptionChanged";
NSString *const kLinphoneFileTransferSendUpdate = @"LinphoneFileTransferSendUpdate";
NSString *const kLinphoneFileTransferRecvUpdate = @"LinphoneFileTransferRecvUpdate";
@@ -986,6 +987,28 @@ static void linphone_iphone_notify_received(LinphoneCore *lc, LinphoneEvent *lev
content:body];
}
+static void linphone_iphone_call_encryption_changed(LinphoneCore *lc, LinphoneCall *call, bool_t on,
+ const char *authentication_token) {
+ [(__bridge LinphoneManager *)linphone_core_get_user_data(lc) onCallEncryptionChanged:lc
+ call:call
+ on:on
+ token:authentication_token];
+}
+
+- (void)onCallEncryptionChanged:(LinphoneCore *)lc
+ call:(LinphoneCall *)call
+ on:(BOOL)on
+ token:(const char *)authentication_token {
+ // Post event
+ NSMutableDictionary *dict = [NSMutableDictionary dictionary];
+ [dict setObject:[NSValue valueWithPointer:call] forKey:@"call"];
+ [dict setObject:[NSNumber numberWithBool:on] forKey:@"on"];
+ [dict setObject:[NSString stringWithUTF8String:authentication_token] forKey:@"token"];
+ [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneCallEncryptionChanged
+ object:self
+ userInfo:dict];
+}
+
#pragma mark - Message composition start
- (void)onMessageComposeReceived:(LinphoneCore *)core forRoom:(LinphoneChatRoom *)room {
@@ -1258,25 +1281,27 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach
#pragma mark - VTable
-static LinphoneCoreVTable linphonec_vtable = {.show = NULL,
- .call_state_changed =
- (LinphoneCoreCallStateChangedCb)linphone_iphone_call_state,
- .registration_state_changed = linphone_iphone_registration_state,
- .notify_presence_received = NULL,
- .new_subscription_requested = NULL,
- .auth_info_requested = linphone_iphone_popup_password_request,
- .display_status = linphone_iphone_display_status,
- .display_message = linphone_iphone_log_user_info,
- .display_warning = linphone_iphone_log_user_warning,
- .display_url = NULL,
- .text_received = NULL,
- .message_received = linphone_iphone_message_received,
- .dtmf_received = NULL,
- .transfer_state_changed = linphone_iphone_transfer_state_changed,
- .is_composing_received = linphone_iphone_is_composing_received,
- .configuring_status = linphone_iphone_configuring_status_changed,
- .global_state_changed = linphone_iphone_global_state_changed,
- .notify_received = linphone_iphone_notify_received};
+static LinphoneCoreVTable linphonec_vtable = {
+ .show = NULL,
+ .call_state_changed = (LinphoneCoreCallStateChangedCb)linphone_iphone_call_state,
+ .registration_state_changed = linphone_iphone_registration_state,
+ .notify_presence_received = NULL,
+ .new_subscription_requested = NULL,
+ .auth_info_requested = linphone_iphone_popup_password_request,
+ .display_status = linphone_iphone_display_status,
+ .display_message = linphone_iphone_log_user_info,
+ .display_warning = linphone_iphone_log_user_warning,
+ .display_url = NULL,
+ .text_received = NULL,
+ .message_received = linphone_iphone_message_received,
+ .dtmf_received = NULL,
+ .transfer_state_changed = linphone_iphone_transfer_state_changed,
+ .is_composing_received = linphone_iphone_is_composing_received,
+ .configuring_status = linphone_iphone_configuring_status_changed,
+ .global_state_changed = linphone_iphone_global_state_changed,
+ .notify_received = linphone_iphone_notify_received,
+ .call_encryption_changed = linphone_iphone_call_encryption_changed,
+};
#pragma mark -
diff --git a/Classes/LinphoneUI/StatusBarView.m b/Classes/LinphoneUI/StatusBarView.m
index 1ee4629c9..14b2c41c8 100644
--- a/Classes/LinphoneUI/StatusBarView.m
+++ b/Classes/LinphoneUI/StatusBarView.m
@@ -60,6 +60,10 @@
selector:@selector(callUpdate:)
name:kLinphoneCallUpdate
object:nil];
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(onCallEncryptionChanged:)
+ name:kLinphoneCallEncryptionChanged
+ object:nil];
// Update to default state
LinphoneProxyConfig *config = linphone_core_get_default_proxy_config([LinphoneManager getLc]);
@@ -101,6 +105,17 @@
[self registrationUpdate:notif];
}
+- (void)onCallEncryptionChanged:(NSNotification *)notif {
+ LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]);
+ ;
+
+ if (call && (linphone_call_params_get_media_encryption(linphone_call_get_current_params(call)) ==
+ LinphoneMediaEncryptionZRTP) &&
+ (!linphone_call_get_authentication_token_verified(call))) {
+ [self onSecurityClick:nil];
+ }
+}
+
- (void)notifyReceived:(NSNotification *)notif {
const LinphoneContent *content = [[notif.userInfo objectForKey:@"content"] pointerValue];
@@ -135,12 +150,6 @@
// show voice mail only when there is no call
[self updateUI:linphone_core_get_calls([LinphoneManager getLc]) != NULL];
[self updateVoicemail];
-
- LinphoneCall *currentCall = linphone_core_get_current_call([LinphoneManager getLc]);
- if (currentCall && !linphone_call_get_authentication_token_verified(currentCall) &&
- linphone_call_get_state(currentCall) == LinphoneCallStreamsRunning) {
- [self onSecurityClick:nil];
- }
}
#pragma mark -
diff --git a/Classes/LinphoneUI/UIConfirmationDialog.m b/Classes/LinphoneUI/UIConfirmationDialog.m
index 1e9246d10..88f72dac1 100644
--- a/Classes/LinphoneUI/UIConfirmationDialog.m
+++ b/Classes/LinphoneUI/UIConfirmationDialog.m
@@ -19,6 +19,7 @@
UIConfirmationDialog *dialog =
[[UIConfirmationDialog alloc] initWithNibName:NSStringFromClass(self.class) bundle:NSBundle.mainBundle];
+ dialog.view.frame = PhoneMainView.instance.mainViewController.view.frame;
[PhoneMainView.instance.mainViewController.view addSubview:dialog.view];
[PhoneMainView.instance.mainViewController addChildViewController:dialog];
diff --git a/Classes/LinphoneUI/UIConfirmationDialog.xib b/Classes/LinphoneUI/UIConfirmationDialog.xib
index d0046cd28..b9f970d63 100644
--- a/Classes/LinphoneUI/UIConfirmationDialog.xib
+++ b/Classes/LinphoneUI/UIConfirmationDialog.xib
@@ -16,22 +16,22 @@
-
+
-
+
-
+