Fix conference pause and resuming

This commit is contained in:
Benoit Martins 2024-07-09 16:51:35 +02:00
parent 7bae9fd342
commit a96ae05dd6
4 changed files with 75 additions and 32 deletions

View file

@ -287,12 +287,9 @@ extension ProviderDelegate: CXProviderDelegate {
// attempt to resume another one.
action.fulfill()
} else {
if call?.conference != nil && core.callsNb > 1 {
/*
try TelecomManager.shared.lc?.enterConference()
action.fulfill()
NotificationCenter.default.post(name: Notification.Name("LinphoneCallUpdate"), object: self)
*/
if call != nil && call?.conference != nil && core.callsNb > 1 {
_ = call!.conference!.enter()
TelecomManager.shared.actionToFulFill = action
} else {
try call!.resume()
// We'll notify callkit that the action is fulfilled when receiving the 200Ok, which is the point

View file

@ -456,14 +456,19 @@ class TelecomManager: ObservableObject {
}
}
} else {
DispatchQueue.main.async {
self.remoteConfVideo = false
if call.currentParams != nil {
let remoteConfVideoTmp = call.currentParams!.videoEnabled && call.currentParams!.videoDirection == .SendRecv || call.currentParams!.videoDirection == .RecvOnly
if call.currentParams != nil {
let remoteConfVideoTmp = call.currentParams!.videoEnabled && call.currentParams!.videoDirection == .SendRecv || call.currentParams!.videoDirection == .RecvOnly
DispatchQueue.main.async {
self.remoteConfVideo = false
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
self.remoteConfVideo = remoteConfVideoTmp
}
}
} else {
DispatchQueue.main.async {
self.remoteConfVideo = false
}
}
}

View file

@ -81,7 +81,7 @@ struct ParticipantsListFragment: View {
HStack {
Spacer()
if callViewModel.myParticipantModel!.isAdmin {
if callViewModel.myParticipantModel != nil && callViewModel.myParticipantModel!.isAdmin {
NavigationLink(destination: {
AddParticipantsFragment(addParticipantsViewModel: addParticipantsViewModel, confirmAddParticipantsFunc: callViewModel.addParticipants)
.onAppear {

View file

@ -26,9 +26,9 @@ class HistoryModel: ObservableObject {
static let TAG = "[History Model]"
let callLog: CallLog
var callLog: CallLog
let id: String
var id: String
@Published var subject: String
@Published var isConf: Bool
@Published var addressLinphone: Address
@ -38,35 +38,76 @@ class HistoryModel: ObservableObject {
@Published var status: Call.Status
@Published var startDate: time_t
@Published var duration: Int
@Published var addressFriend: Friend? = nil
@Published var avatarModel: ContactAvatarModel? = nil
@Published var addressFriend: Friend?
@Published var avatarModel: ContactAvatarModel?
init(callLog: CallLog) {
self.callLog = callLog
self.id = callLog.callId ?? ""
self.subject = callLog.conferenceInfo != nil && callLog.conferenceInfo!.subject != nil ? callLog.conferenceInfo!.subject! : ""
self.isConf = callLog.conferenceInfo != nil
self.id = ""
self.subject = ""
self.isConf = false
let addressLinphoneTmp = callLog.dir == .Outgoing && callLog.toAddress != nil ? callLog.toAddress! : callLog.fromAddress!
self.addressLinphone = addressLinphoneTmp
//let addressLinphone = callLog.dir == .Outgoing && callLog.toAddress != nil ? callLog.toAddress! : callLog.fromAddress!
self.address = addressLinphoneTmp.asStringUriOnly()
self.addressLinphone = callLog.dir == .Outgoing && callLog.toAddress != nil ? callLog.toAddress! : callLog.fromAddress!
self.address = ""
let addressNameTmp = callLog.conferenceInfo != nil && callLog.conferenceInfo!.subject != nil
? callLog.conferenceInfo!.subject!
: (addressLinphoneTmp.username != nil ? addressLinphoneTmp.username ?? "" : addressLinphoneTmp.displayName ?? "")
self.addressName = ""
self.addressName = addressNameTmp
self.isOutgoing = false
self.isOutgoing = callLog.dir == .Outgoing
self.status = .Success
self.status = callLog.status
self.startDate = 0
self.startDate = callLog.startDate
self.duration = 0
self.duration = callLog.duration
refreshAvatarModel()
self.initValue(callLog: callLog)
}
func initValue(callLog: CallLog) {
coreContext.doOnCoreQueue { _ in
let callLogTmp = callLog
let idTmp = callLog.callId ?? ""
let subjectTmp = callLog.conferenceInfo != nil && callLog.conferenceInfo!.subject != nil ? callLog.conferenceInfo!.subject! : ""
let isConfTmp = callLog.conferenceInfo != nil
let addressLinphoneTmp = callLog.dir == .Outgoing && callLog.toAddress != nil ? callLog.toAddress! : callLog.fromAddress!
let addressNameTmp = callLog.conferenceInfo != nil && callLog.conferenceInfo!.subject != nil
? callLog.conferenceInfo!.subject!
: (addressLinphoneTmp.username != nil ? addressLinphoneTmp.username ?? "" : addressLinphoneTmp.displayName ?? "")
let addressTmp = addressLinphoneTmp.asStringUriOnly()
let isOutgoingTmp = callLog.dir == .Outgoing
let statusTmp = callLog.status
let startDateTmp = callLog.startDate
let durationTmp = callLog.duration
DispatchQueue.main.async {
self.callLog = callLogTmp
self.id = idTmp
self.subject = subjectTmp
self.isConf = isConfTmp
self.addressLinphone = addressLinphoneTmp
self.address = addressTmp
self.addressName = addressNameTmp
self.isOutgoing = isOutgoingTmp
self.status = statusTmp
self.startDate = startDateTmp
self.duration = durationTmp
}
self.refreshAvatarModel()
}
}
func refreshAvatarModel() {