从Linphone呼叫获取来电号码
问题描述:
我正在尝试检测在Linphone呼叫期间正在呼叫我的号码。我试过从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)))!)")
但是这是空的。有另一种方法吗?
答
在我的应用程序中我采取linphoneCore
和linphoneCall
并在致电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;
}