gpt4 book ai didi

ios - 如何使用 Linphone 获取当前通话状态

转载 作者:行者123 更新时间:2023-11-30 11:38:08 24 4
gpt4 key购买 nike

我正在使用 Linphone 开发调用应用程序。我想从下面的代码获取当前的通话状态。我尝试了很多但没有找到任何解决方案。请告诉我如何从全局 callstatechanged 闭包中获取当前通话状态?

let callStateChanged: LinphoneCoreCallStateChangedCb = {
(lc: Optional<OpaquePointer>, call: Optional<OpaquePointer>, callSate: LinphoneCallState, message: Optional<UnsafePointer<Int8>>) in

switch callSate{
case LinphoneCallIncomingReceived: /**<This is a new incoming call */
NSLog("callStateChanged: LinphoneCallIncomingReceived")

if answerCall{
ms_usleep(3 * 1000 * 1000); // Wait 3 seconds to pickup
linphone_core_accept_call(lc, call)
}

case LinphoneCallStreamsRunning: /**<The media streams are established and running*/
NSLog("callStateChanged: LinphoneCallStreamsRunning")

case LinphoneCallError: /**<The call encountered an error*/
NSLog("callStateChanged: LinphoneCallError")

default:
NSLog("Default call state")
}
}

如何从此代码访问当前通话状态?

最佳答案

这可能会帮助您接听当前通话

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, /**<Initial call state */
LinphoneCallIncomingReceived, /**<This is a new incoming call */
LinphoneCallOutgoingInit, /**<An outgoing call is started */
LinphoneCallOutgoingProgress, /**<An outgoing call is in progress */
LinphoneCallOutgoingRinging, /**<An outgoing call is ringing at remote end */
LinphoneCallOutgoingEarlyMedia, /**<An outgoing call is proposed early media */
LinphoneCallConnected, /**<Connected, the call is answered */
LinphoneCallStreamsRunning, /**<The media streams are established and running*/
LinphoneCallPausing, /**<The call is pausing at the initiative of local end */
LinphoneCallPaused, /**< The call is paused, remote end has accepted the pause */
LinphoneCallResuming, /**<The call is being resumed by local end*/
LinphoneCallRefered, /**<The call is being transfered to another party, resulting in a new outgoing call to follow immediately*/
LinphoneCallError, /**<The call encountered an error*/
LinphoneCallEnd, /**<The call ended normally*/
LinphoneCallPausedByRemote, /**<The call is paused by remote end*/
LinphoneCallUpdatedByRemote, /**<The call's parameters change is requested by remote end, used for example when video is added by remote */
LinphoneCallIncomingEarlyMedia, /**<We are proposing early media to an incoming call */
LinphoneCallUpdating, /**<A call update has been initiated by us */
LinphoneCallReleased, /**< The call object is no more retained by the core */
LinphoneCallEarlyUpdatedByRemote, /*<The call is updated by remote while not yet answered (early dialog SIP UPDATE received).*/
LinphoneCallEarlyUpdating /*<We are updating the call while not yet answered (early dialog SIP UPDATE sent)*/
} LinphoneCallState;
*/

}

}

关于ios - 如何使用 Linphone 获取当前通话状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49527013/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com