hiennguyen92 / flutter_callkit_incoming

Flutter Callkit Incoming
https://pub.dev/packages/flutter_callkit_incoming
MIT License
180 stars 312 forks source link

ios dtmf crash #577

Open minn-ee opened 2 months ago

minn-ee commented 2 months ago

I tried to test the DTMF feature on the iOS native call screen, but the following error occurred when I pressed the button:

Unsupported value: C.CXPlayDTMFCallActionType(rawValue: 1) of type SwiftValue *** Assertion failure in void WriteValueOfType(CFTypeRef, CFMutableDataRef, FlutterStandardCodecObjcType, CFTypeRef)(), FlutterStandardCodec.mm:341

The call is using the sip_ua package in a Flutter app, with supportsDTMF set to true. This happened while I was trying to test the actionCallToggleDtmf feature. Package version is 2.0.4+1.

Is there any additional code that I need to implement?

I would appreciate it if you could let me know if there's anything I'm missing.

minn-ee commented 2 months ago

I modified the SwiftFlutterCallkitIncomingPlugin.swift code below to resolve the error.

Original code:

public func provider(_ provider: CXProvider, perform action: CXPlayDTMFCallAction) { guard (self.callManager.callWithUUID(uuid: action.callUUID)) != nil else { action.fail() return } self.sendEvent(SwiftFlutterCallkitIncomingPlugin.ACTION_CALL_TOGGLE_DMTF, ["id": action.callUUID.uuidString, "digits": action.digits, "type": action.type]) action.fulfill() }

Modified code: self.sendEvent(SwiftFlutterCallkitIncomingPlugin.ACTION_CALL_TOGGLE_DMTF, ["id": action.callUUID.uuidString, "digits": action.digits, "type": action.type.rawValue])

By changing "type": action.type to "type": action.type.rawValue, I was able to resolve the error. @hiennguyen92 Could you please verify if this is the correct solution?

tatsuyaueda commented 2 days ago

I'm also seeing the same problem. I think the type conversion is probably failing. I think there is no problem with action.type.rawValue.