1

我正在尝试检测在 Linphone 通话期间呼叫我的号码。我努力了

case LinphoneCallConnected:
            NSLog("callStateChanged: LinphoneCallConnected")
            NSLog("CALL ID: \(linphone_call_log_get_call_id(linphone_call_get_call_log(linphone_core_get_current_call(lc)))!)")

但那是空的。还有其他方法吗?

4

2 回答 2

2

在我的应用程序中,我接听linphoneCorelinphoneCall接听电话linphone_call_get_remote_address。现在您linphoneAddress可以从中提取 username linphone_address_get_username

完整代码在这里:

- (NSString *)userNameFromCurrentCall {

    LinphoneCore *lc = [LinphoneManager getLc];
    LinphoneCall *currentcall = linphone_core_get_current_call(lc);

    if (currentcall != NULL) {
        LinphoneAddress const * addr = linphone_call_get_remote_address(currentcall);

        if (addr != NULL) {
            return [NSString stringWithUTF8String:linphone_address_get_username(addr)];
        }
    }

    return nil;
}
于 2017-08-11T17:27:32.343 回答
0

SString *)userNameFromCurrentCall {

LinphoneCore *lc = [LinphoneManager getLc];
LinphoneCall *currentcall = linphone_core_get_current_call(lc);

if (currentcall != NULL) {
    LinphoneAddress const * addr = linphone_call_get_remote_address(currentcall);

    if (addr != NULL) {
        return [NSString stringWithUTF8String:linphone_address_get_username(addr)];
    }
}

return nil;
于 2020-10-23T06:05:32.823 回答