| | |
| | | HDLCallManager.setAppData(sCall: call, appData: appData) |
| | | } |
| | | HDLLinPhoneSDK.instance().isIncomingReceivedCallState=false |
| | | |
| | | print("cstate: \(cstate)") |
| | | switch cstate { |
| | | case .IncomingReceived: |
| | | print("接收到通知") |
| | |
| | | } |
| | | } else { |
| | | let state: UIApplication.State = UIApplication.shared.applicationState |
| | | HDLCallManager.instance().displayIncomingCall(call: call, handle: address, hasVideo: video, callId: callId!) |
| | | if state == .background{ |
| | | // HDLCallManager.instance().displayIncomingCall(call: call, handle: address, hasVideo: video, callId: callId!) |
| | | }else{ |
| | | |
| | | HDLCallManager.instance().displayIncomingCall(call: call, handle: address, hasVideo: true, callId: callId!) |
| | | print("接收到通知2") |
| | | // if state == .background{ |
| | | // print("接收到通知3") |
| | | //// HDLCallManager.instance().displayIncomingCall(call: call, handle: address, hasVideo: video, callId: callId!) |
| | | // }else{ |
| | | // HDLCallManager.instance().acceptCall(call: call, hasVideo: call.params?.videoEnabled ?? false) |
| | | let dict: Dictionary<String, Any> = ["state":10,"cfg":"","message":"","callID":call.callLog?.callId ?? "","hasVideo":call.params?.videoEnabled ?? false] |
| | | print("接收到通知4") |
| | | let dict: Dictionary<String, Any> = ["state":10,"cfg":"","message":"","callID":call.callLog?.callId ?? "","hasVideo":call.params?.videoEnabled ?? false,"userName":call.remoteAddress?.username ?? ""] |
| | | NotificationCenter.default.post(name: NSNotification.Name(rawValue: "LinphoneRegistrationUpdate"), object: nil, userInfo: dict) |
| | | HDLLinPhoneSDK.instance().isIncomingReceivedCallState=true |
| | | } |
| | | // } |
| | | } |
| | | } |
| | | break |
| | | case .StreamsRunning: |
| | | if (HDLCallManager.callKitEnabled()) { |
| | | let uuid = HDLCallManager.instance().providerDelegate.uuids["\(callId!)"] |
| | | // print("所有uuids:\(HDLCallManager.instance().providerDelegate.uuids)") |
| | | if (uuid != nil) { |
| | | print("有uuid的") |
| | | let callInfo = HDLCallManager.instance().providerDelegate.callInfos[uuid!] |
| | | if (callInfo != nil && callInfo!.isOutgoing && !callInfo!.connected) { |
| | | |
| | |
| | | HDLCoreManagerDelegate.speaker_already_enabled = true |
| | | } |
| | | break |
| | | case .OutgoingProgress: |
| | | print("OutgoingRinging") |
| | | break |
| | | case .OutgoingRinging: |
| | | print("OutgoingRinging") |
| | | if (HDLCallManager.callKitEnabled()) { |
| | | let uuid = HDLCallManager.instance().providerDelegate.uuids[""] |
| | | if (uuid != nil) { |
| | | // print("有uuid的:\(String(describing: uuid))") |
| | | let callInfo = HDLCallManager.instance().providerDelegate.callInfos[uuid!] |
| | | callInfo!.callId = callId! |
| | | HDLCallManager.instance().providerDelegate.callInfos.updateValue(callInfo!, forKey: uuid!) |
| | |
| | | HDLCallManager.instance().requestTransaction(transaction, action: "endCall") |
| | | } |
| | | } |
| | | let dict: Dictionary<String, Any> = ["state":11,"cfg":"","message":"","callID":call.callLog?.callId ?? "","hasVideo":call.params?.videoEnabled ?? false,"userName":call.remoteAddress?.username ?? ""] |
| | | NotificationCenter.default.post(name: NSNotification.Name(rawValue: "LinphoneRegistrationUpdate"), object: nil, userInfo: dict) |
| | | break |
| | | case .Released: |
| | | call.userData = nil |
| | | print("release 了") |
| | | let dict: Dictionary<String, Any> = ["state":12,"cfg":"","message":"","callID":call.callLog?.callId ?? "","hasVideo":call.params?.videoEnabled ?? false,"userName":call.remoteAddress?.username ?? ""] |
| | | NotificationCenter.default.post(name: NSNotification.Name(rawValue: "LinphoneRegistrationUpdate"), object: nil, userInfo: dict) |
| | | break |
| | | case .Referred: |
| | | print("Referred 了") |
| | | HDLCallManager.instance().referedFromCall = call.callLog?.callId |
| | | break |
| | | default: |