update api

This commit is contained in:
Danmei Chen 2020-07-29 10:37:51 +02:00
parent 1492e59dca
commit 98449ef104
11 changed files with 62 additions and 62 deletions

View file

@ -602,7 +602,7 @@ static UICompositeViewDescription *compositeDescription = nil;
[self changeView:_remoteProvisioningLoginView back:FALSE animation:TRUE];
linphone_proxy_config_destroy(default_conf);
linphone_proxy_config_unref(default_conf);
}
- (void)resetTextFields {

View file

@ -445,12 +445,12 @@ class CoreManagerDelegate: CoreDelegate {
}
}
override func onCallStateChanged(lc: Core, call: Call, cstate: Call.State, message: String) {
override func onCallStateChanged(core: Core, call: Call, state cstate: Call.State, message: String) {
let addr = call.remoteAddress;
let displayName = FastAddressBook.displayName(for: addr?.getCobject) ?? "Unknow"
let callLog = call.callLog
let callId = callLog?.callId
let video = UIApplication.shared.applicationState == .active && (lc.videoActivationPolicy?.automaticallyAccept ?? false) && (call.remoteParams?.videoEnabled ?? false)
let video = UIApplication.shared.applicationState == .active && (core.videoActivationPolicy?.automaticallyAccept ?? false) && (call.remoteParams?.videoEnabled ?? false)
// we keep the speaker auto-enabled state in this static so that we don't
// force-enable it on ICE re-invite if the user disabled it.
CoreManagerDelegate.speaker_already_enabled = false

View file

@ -687,7 +687,7 @@ static void hideSpinner(LinphoneCall *call, void *user_data) {
if (call == linphone_core_get_current_call(LC)) {
LinphoneCallParams *params = linphone_core_create_call_params(LC, call);
linphone_call_accept_update(call, params);
linphone_call_params_destroy(params);
linphone_call_params_unref(params);
[videoDismissTimer invalidate];
videoDismissTimer = nil;
}
@ -698,7 +698,7 @@ static void hideSpinner(LinphoneCall *call, void *user_data) {
LinphoneCallParams *params = linphone_core_create_call_params(LC, call);
linphone_call_params_enable_video(params, TRUE);
linphone_call_accept_update(call, params);
linphone_call_params_destroy(params);
linphone_call_params_unref(params);
[videoDismissTimer invalidate];
videoDismissTimer = nil;
}

View file

@ -652,7 +652,7 @@
LinphoneCallParams *params = linphone_core_create_call_params(LC, call);
linphone_call_accept_update(call, params);
linphone_call_params_destroy(params);
linphone_call_params_unref(params);
} else if ([response.actionIdentifier isEqual:@"Accept"]) {
LOGI(@"User accept video proposal");
if (call != linphone_core_get_current_call(LC))
@ -663,7 +663,7 @@
LinphoneCallParams *params = linphone_core_create_call_params(LC, call);
linphone_call_params_enable_video(params, TRUE);
linphone_call_accept_update(call, params);
linphone_call_params_destroy(params);
linphone_call_params_unref(params);
} else if ([response.actionIdentifier isEqual:@"Confirm"]) {
if (linphone_core_get_current_call(LC) == call)
linphone_call_set_authentication_token_verified(call, YES);
@ -706,7 +706,7 @@
LinphoneCallParams *params = linphone_core_create_call_params(LC, call);
linphone_call_accept_update(call, params);
linphone_call_params_destroy(params);
linphone_call_params_unref(params);
[videoDismissTimer invalidate];
}
onConfirmationClick:^() {
@ -717,7 +717,7 @@
LinphoneCallParams *params = linphone_core_create_call_params(LC, call);
linphone_call_params_enable_video(params, TRUE);
linphone_call_accept_update(call, params);
linphone_call_params_destroy(params);
linphone_call_params_unref(params);
[videoDismissTimer invalidate];
}
inController:PhoneMainView.instance];

View file

@ -551,7 +551,7 @@
const char *password = [accountPassword UTF8String];
const char *ha1 = [accountHa1 UTF8String];
if (linphone_proxy_config_set_identity(proxyCfg, identity) == -1) {
if (linphone_proxy_config_set_identity_address(proxyCfg, linphoneAddress) == -1) {
error = NSLocalizedString(@"Invalid username or domain", nil);
goto bad_proxy;
}
@ -586,7 +586,7 @@
[LinphoneManager.instance configurePushTokenForProxyConfig:proxyCfg];
linphone_proxy_config_enable_register(proxyCfg, is_enabled);
linphone_proxy_config_enable_avpf(proxyCfg, use_avpf);
linphone_proxy_config_set_avpf_mode(proxyCfg, use_avpf);
linphone_proxy_config_set_expires(proxyCfg, expire);
if (is_default) {
linphone_core_set_default_proxy_config(LC, proxyCfg);

View file

@ -388,7 +388,7 @@ static int check_should_migrate_images(void *data, int argc, char **argv, char *
withDefault:@"sip.linphone.org"]
.UTF8String) != 0) {
LOGI(@"Migrating proxy config to use AVPF");
linphone_proxy_config_enable_avpf(proxy, TRUE);
linphone_proxy_config_set_avpf_mode(proxy, LinphoneAVPFEnabled);
}
proxies = proxies->next;
}
@ -511,7 +511,7 @@ static void migrateWizardToAssistant(const char *entry, void *user_data) {
+ (void)dumpLcConfig {
if (theLinphoneCore) {
LpConfig *conf = LinphoneManager.instance.configDb;
char *config = lp_config_dump(conf);
char *config = linphone_config_dump(conf);
LOGI(@"\n%s", config);
ms_free(config);
}
@ -1682,7 +1682,7 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
factory = factoryIpad;
}
_configDb = linphone_config_new_for_shared_core(kLinphoneMsgNotificationAppGroupId.UTF8String, @"linphonerc".UTF8String, factory.UTF8String);
lp_config_clean_entry(_configDb, "misc", "max_calls");
linphone_config_clean_entry(_configDb, "misc", "max_calls");
}
#pragma mark - Audio route Functions
@ -2015,7 +2015,7 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
- (void)configureVbrCodecs {
PayloadType *pt;
int bitrate = lp_config_get_int(
int bitrate = linphone_config_get_int(
_configDb, "audio", "codec_bitrate_limit",
kLinphoneAudioVbrCodecDefaultBitrate); /*default value is in linphonerc or linphonerc-factory*/
const MSList *audio_codecs = linphone_core_get_audio_codecs(theLinphoneCore);
@ -2070,7 +2070,7 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
- (void)lpConfigSetString:(NSString *)value forKey:(NSString *)key inSection:(NSString *)section {
if (!key)
return;
lp_config_set_string(_configDb, [section UTF8String], [key UTF8String], value ? [value UTF8String] : NULL);
linphone_config_set_string(_configDb, [section UTF8String], [key UTF8String], value ? [value UTF8String] : NULL);
}
- (NSString *)lpConfigStringForKey:(NSString *)key {
return [self lpConfigStringForKey:key withDefault:nil];
@ -2084,7 +2084,7 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
- (NSString *)lpConfigStringForKey:(NSString *)key inSection:(NSString *)section withDefault:(NSString *)defaultValue {
if (!key)
return defaultValue;
const char *value = lp_config_get_string(_configDb, [section UTF8String], [key UTF8String], NULL);
const char *value = linphone_config_get_string(_configDb, [section UTF8String], [key UTF8String], NULL);
return value ? [NSString stringWithUTF8String:value] : defaultValue;
}
@ -2094,7 +2094,7 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
- (void)lpConfigSetInt:(int)value forKey:(NSString *)key inSection:(NSString *)section {
if (!key)
return;
lp_config_set_int(_configDb, [section UTF8String], [key UTF8String], (int)value);
linphone_config_set_int(_configDb, [section UTF8String], [key UTF8String], (int)value);
}
- (int)lpConfigIntForKey:(NSString *)key {
return [self lpConfigIntForKey:key withDefault:-1];
@ -2108,7 +2108,7 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
- (int)lpConfigIntForKey:(NSString *)key inSection:(NSString *)section withDefault:(int)defaultValue {
if (!key)
return defaultValue;
return lp_config_get_int(_configDb, [section UTF8String], [key UTF8String], (int)defaultValue);
return linphone_config_get_int(_configDb, [section UTF8String], [key UTF8String], (int)defaultValue);
}
- (void)lpConfigSetBool:(BOOL)value forKey:(NSString *)key {

View file

@ -72,7 +72,7 @@
// Update to default state
LinphoneProxyConfig *config = linphone_core_get_default_proxy_config(LC);
messagesUnreadCount = lp_config_get_int(linphone_core_get_config(LC), "app", "voice_mail_messages_count", 0);
messagesUnreadCount = linphone_config_get_int(linphone_core_get_config(LC), "app", "voice_mail_messages_count", 0);
[self proxyConfigUpdate:config];
[self updateUI:linphone_core_get_calls_nb(LC)];
@ -149,7 +149,7 @@
LOGI(@"Received new NOTIFY from voice mail: there is/are now %d message(s) unread", messagesUnreadCount);
// save in lpconfig for future
lp_config_set_int(linphone_core_get_config(LC), "app", "voice_mail_messages_count", messagesUnreadCount);
linphone_config_set_int(linphone_core_get_config(LC), "app", "voice_mail_messages_count", messagesUnreadCount);
[self updateVoicemail];
}

View file

@ -67,7 +67,7 @@ INIT_WITH_COMMON_CF {
LinphoneCallParams *call_params = linphone_core_create_call_params(LC,call);
linphone_call_params_enable_video(call_params, FALSE);
linphone_core_update_call(LC, call, call_params);
linphone_call_params_destroy(call_params);
linphone_call_params_unref(call_params);
} else {
LOGW(@"Cannot toggle video button, because no current call");
}

View file

@ -46,29 +46,29 @@ class LinphoneLoggingServiceManager: LoggingServiceDelegate {
}
}
override func onLogMessageWritten(logService: LoggingService, domain: String, lev: LogLevel, message: String) {
let level: String
override func onLogMessageWritten(logService: LoggingService, domain: String, level: LogLevel, message: String) {
let levelStr: String
switch lev {
switch level {
case .Debug:
level = "Debug"
levelStr = "Debug"
case .Trace:
level = "Trace"
levelStr = "Trace"
case .Message:
level = "Message"
levelStr = "Message"
case .Warning:
level = "Warning"
levelStr = "Warning"
case .Error:
level = "Error"
levelStr = "Error"
case .Fatal:
level = "Fatal"
levelStr = "Fatal"
default:
level = "unknown"
levelStr = "unknown"
}
#if USE_CRASHLYTICS
Crashlytics.crashlytics().log("\(level) [\(domain)] \(message)\n")
Crashlytics.crashlytics().log("\(levelStr) [\(domain)] \(message)\n")
#endif
NSLog("\(level) [\(domain)] \(message)\n")
NSLog("\(levelStr) [\(domain)] \(message)\n")
}
}

View file

@ -82,7 +82,7 @@ class NotificationViewController: UIViewController, UNNotificationContentExtensi
}
if (needToStop) {
log.error(msg: "core stopped by app")
log.error(message: "core stopped by app")
throw LinphoneError.timeout
} else {
completion(.dismiss)
@ -90,7 +90,7 @@ class NotificationViewController: UIViewController, UNNotificationContentExtensi
}
} catch {
log.error(msg: "error: \(error)")
log.error(message: "error: \(error)")
completion(.dismissAndForwardAction)
}
}
@ -123,19 +123,19 @@ class NotificationViewController: UIViewController, UNNotificationContentExtensi
msgDelegate = LinphoneChatMessageManager()
let chatMsg = try room.createMessage(message: replyText)
chatMsg.addDelegate(delegate: msgDelegate)
room.sendChatMessage(msg: chatMsg)
chatMsg.send()
room.markAsRead()
}
for i in 0...50 where !isReplySent && !needToStop {
log.debug(msg: "reply \(i)")
log.debug(message: "reply \(i)")
lc!.iterate()
usleep(10000)
}
}
func startCore() throws {
config = Config.newForSharedCore(appGroupId: APP_GROUP_ID, configFilename: "linphonerc", factoryPath: "")
config = Config.newForSharedCore(appGroupId: APP_GROUP_ID, configFilename: "linphonerc", factoryConfigFilename: "")
log = LoggingService.Instance /*enable liblinphone logs.*/
logDelegate = try! LinphoneLoggingServiceManager(config: config, log: log, domain: "msgNotificationContent")
lc = try! Factory.Instance.createSharedCoreWithConfig(config: config, systemContext: nil, appGroupId: APP_GROUP_ID, mainCore: false)
@ -144,27 +144,27 @@ class NotificationViewController: UIViewController, UNNotificationContentExtensi
lc!.addDelegate(delegate: coreDelegate)
try lc!.start()
log.message(msg: "core started")
log.message(message: "core started")
if (needToStop) {
log.error(msg: "core stopped by app")
log.error(message: "core stopped by app")
throw LinphoneError.timeout
}
}
func stopCore() {
lc!.stopAsync()
log.message(msg: "stop core")
log.message(message: "stop core")
for i in 0...100 where !coreStopped {
log.debug(msg: "stop \(i)")
log.debug(message: "stop \(i)")
lc!.iterate()
usleep(50000)
}
}
class LinphoneCoreManager: CoreDelegate {
override func onGlobalStateChanged(lc: Core, gstate: GlobalState, message: String) {
log.message(msg: "global state changed: \(gstate) : \(message) \n")
override func onGlobalStateChanged(core: Core, state gstate: GlobalState, message: String) {
log.message(message: "global state changed: \(gstate) : \(message) \n")
if (gstate == .Shutdown) {
needToStop = true
} else if (gstate == .Off) {
@ -174,8 +174,8 @@ class NotificationViewController: UIViewController, UNNotificationContentExtensi
}
class LinphoneChatMessageManager: ChatMessageDelegate {
override func onMsgStateChanged(msg: ChatMessage, state: ChatMessage.State) {
log.message(msg: "msg state changed: \(state)\n")
override func onMsgStateChanged(message: ChatMessage, state: ChatMessage.State) {
log.message(message: "msg state changed: \(state)\n")
if (state == .Delivered) {
isReplySent = true
}

View file

@ -58,15 +58,15 @@ class NotificationService: UNNotificationServiceExtension {
if let bestAttemptContent = bestAttemptContent {
createCore()
NotificationService.log.message(msg: "received push payload : \(bestAttemptContent.userInfo.debugDescription)")
NotificationService.log.message(message: "received push payload : \(bestAttemptContent.userInfo.debugDescription)")
if let chatRoomInviteAddr = bestAttemptContent.userInfo["chat-room-addr"] as? String, !chatRoomInviteAddr.isEmpty {
NotificationService.log.message(msg: "fetch chat room for invite, addr: \(chatRoomInviteAddr)")
NotificationService.log.message(message: "fetch chat room for invite, addr: \(chatRoomInviteAddr)")
let chatRoom = lc!.getNewChatRoomFromConfAddr(chatRoomAddr: chatRoomInviteAddr)
if let chatRoom = chatRoom {
stopCore()
NotificationService.log.message(msg: "chat room invite received")
NotificationService.log.message(message: "chat room invite received")
bestAttemptContent.title = NSLocalizedString("GC_MSG", comment: "")
if (chatRoom.hasCapability(mask:ChatRoomCapabilities.OneToOne.rawValue)) {
if (chatRoom.peerAddress?.displayName.isEmpty != true) {
@ -83,7 +83,7 @@ class NotificationService: UNNotificationServiceExtension {
return
}
} else if let callId = bestAttemptContent.userInfo["call-id"] as? String {
NotificationService.log.message(msg: "fetch msg for callid ["+callId+"]")
NotificationService.log.message(message: "fetch msg for callid ["+callId+"]")
let message = lc!.getNewMessageFromCallid(callId: callId)
if let message = message {
@ -114,7 +114,7 @@ class NotificationService: UNNotificationServiceExtension {
contentHandler(bestAttemptContent)
return
} else {
NotificationService.log.message(msg: "Message not found for callid ["+callId+"]")
NotificationService.log.message(message: "Message not found for callid ["+callId+"]")
}
}
serviceExtensionTimeWillExpire()
@ -124,7 +124,7 @@ class NotificationService: UNNotificationServiceExtension {
override func serviceExtensionTimeWillExpire() {
// Called just before the extension will be terminated by the system.
// Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.
NotificationService.log.warning(msg: "serviceExtensionTimeWillExpire")
NotificationService.log.warning(message: "serviceExtensionTimeWillExpire")
stopCore()
if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent {
NSLog("[msgNotificationService] serviceExtensionTimeWillExpire")
@ -174,15 +174,15 @@ class NotificationService: UNNotificationServiceExtension {
}
}
NotificationService.log.message(msg: "msg: \(content) \n")
NotificationService.log.message(message: "msg: \(content) \n")
return msgData;
}
func createCore() {
NSLog("[msgNotificationService] create core")
let config = Config.newForSharedCore(appGroupId: APP_GROUP_ID, configFilename: "linphonerc", factoryPath: "")
let config = Config.newForSharedCore(appGroupId: APP_GROUP_ID, configFilename: "linphonerc", factoryConfigFilename: "")
if (NotificationService.log == nil || NotificationService.log.getDelegate() == nil) {
if (NotificationService.log == nil) {
NotificationService.log = LoggingService.Instance /*enable liblinphone logs.*/
NotificationService.logDelegate = try! LinphoneLoggingServiceManager(config: config!, log: NotificationService.log, domain: "msgNotificationService")
}
@ -190,7 +190,7 @@ class NotificationService: UNNotificationServiceExtension {
}
func stopCore() {
NotificationService.log.message(msg: "stop core")
NotificationService.log.message(message: "stop core")
if let lc = lc {
lc.stop()
}
@ -201,14 +201,14 @@ class NotificationService: UNNotificationServiceExtension {
count += lc!.unreadChatMessageCount
count += lc!.missedCallsCount
count += lc!.callsNb
NotificationService.log.message(msg: "badge: \(count)\n")
NotificationService.log.message(message: "badge: \(count)\n")
return count
}
func getDisplayNameFromSipAddress(sipAddr: String?) -> String? {
if let sipAddr = sipAddr {
NotificationService.log.message(msg: "looking for display name for \(sipAddr)")
NotificationService.log.message(message: "looking for display name for \(sipAddr)")
if (sipAddr == "") { return nil }
@ -216,15 +216,15 @@ class NotificationService: UNNotificationServiceExtension {
let addressBook = defaults?.dictionary(forKey: "addressBook")
if (addressBook == nil) {
NotificationService.log.message(msg: "address book not found in userDefaults")
NotificationService.log.message(message: "address book not found in userDefaults")
return nil
}
if let displayName = addressBook?[sipAddr] as? String {
NotificationService.log.message(msg: "display name for \(sipAddr): \(displayName)")
NotificationService.log.message(message: "display name for \(sipAddr): \(displayName)")
return displayName
} else {
NotificationService.log.message(msg: "display name for \(sipAddr) not found in userDefaults")
NotificationService.log.message(message: "display name for \(sipAddr) not found in userDefaults")
return nil
}
}