我正在试着检测在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)))!)")

但那是空的。还有别的办法吗?

最佳答案

在我的应用程序中,我采取linphoneCorelinphoneCall和呼叫后linphone_call_get_remote_address。现在您可以从linphoneAddress中提取用户名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;
}

关于iphone - 从Linphone调用获取来电号码,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/45621618/

10-10 20:56