如何使用Linphone获取当前呼叫状态

2025-12-06 00:45:09

社区首页 >问答首页 >如何使用Linphone获取当前呼叫状态问如何使用Linphone获取当前呼叫状态ENStack Overflow用户提问于 2018-03-28 13:50:04回答 1查看 1.2K关注 0票数 0我正在使用Linphone开发呼叫应用程序。我想从下面的代码中获取当前的呼叫状态。我尝试了很多,但没有找到任何解决方案。请告诉我如何从全局callstatechanged闭包中获取当前调用状态?

代码语言:javascript复制let callStateChanged: LinphoneCoreCallStateChangedCb = {

(lc: Optional, call: Optional, callSate: LinphoneCallState, message: Optional>) in

switch callSate{

case LinphoneCallIncomingReceived: /**

NSLog("callStateChanged: LinphoneCallIncomingReceived")

if answerCall{

ms_usleep(3 * 1000 * 1000); // Wait 3 seconds to pickup

linphone_core_accept_call(lc, call)

}

case LinphoneCallStreamsRunning: /**

NSLog("callStateChanged: LinphoneCallStreamsRunning")

case LinphoneCallError: /**

NSLog("callStateChanged: LinphoneCallError")

default:

NSLog("Default call state")

}

}如何通过此代码访问当前的呼叫状态?

iosswiftlinphone关注问题分享EN回答 1推荐最新Stack Overflow用户发布于 2018-04-12 15:12:41

这可能会帮助您获得当前呼叫

代码语言:javascript复制func answerCall () {

if let call = linphone_core_get_current_call(theLinphone.lc) {

linphone_core_accept_call(theLinphone.lc, call)

// HERE HOW YOU GET CALL STATE

let call_state = linphone_call_get_state(call)

// call State may return

/*

typedef enum _LinphoneCallState{

LinphoneCallIdle, /**

LinphoneCallIncomingReceived, /**

LinphoneCallOutgoingInit, /**

LinphoneCallOutgoingProgress, /**

LinphoneCallOutgoingRinging, /**

LinphoneCallOutgoingEarlyMedia, /**

LinphoneCallConnected, /**

LinphoneCallStreamsRunning, /**

LinphoneCallPausing, /**

LinphoneCallPaused, /**< The call is paused, remote end has accepted the pause */

LinphoneCallResuming, /**

LinphoneCallRefered, /**

LinphoneCallError, /**

LinphoneCallEnd, /**

LinphoneCallPausedByRemote, /**

LinphoneCallUpdatedByRemote, /**

LinphoneCallIncomingEarlyMedia, /**

LinphoneCallUpdating, /**

LinphoneCallReleased, /**< The call object is no more retained by the core */

LinphoneCallEarlyUpdatedByRemote, /*

LinphoneCallEarlyUpdating /*

} LinphoneCallState;

*/

}

}收藏分享票数 0EN页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持原文链接:https://stackoverflow.com/questions/49527013

复制相关文章

Copyright © 2022 世界杯预选赛欧洲区_世界杯在哪个国家举行 - kd896.com All Rights Reserved.