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