Keyur
Keyur

Reputation: 1

Linphone iOS Swift: belle-sip-fatal- Bad cast to belle_sip_cpp_object_t when Sending DTMF

I'm developing an iOS app using Linphone SDK (version 5.0.47), and I'm trying to send DTMF signals during an active call. However, I'm encountering a crash with the following error:

belle-sip-fatal- Bad cast to belle_sip_cpp_object_t at /path/to/belle-sip/src/object++.cc:144 Here is the Swift function I’m using to send DTMF:

func sendDTMF(_ digit: String) {
    guard let core = linphoneCore else {
        print("Linphone core is not initialized.")
        return
    }

    guard let call = currentCall else {
        print("No active call found.")
        return
    }

    // Ensure the input is a single character
    guard digit.count == 1, let firstChar = digit.utf8.first else {
        print("Invalid DTMF digit.")
        return
    }

    let dtmfChar = CChar(firstChar)

    // Send the DTMF tone
    let result = linphone_call_send_dtmf(call, dtmfChar)
    if result != 0 {
        print("Failed to send DTMF digit: \(digit), error code: \(result)")
    } else {
        print("DTMF digit sent successfully.")
    }
}

The error occurs when I call linphone_call_send_dtmf. I’ve verified that:

linphoneCore and currentCall are properly initialized. The DTMF digit is a single character.

Linphone SDK Version: 5.0.47 iOS Version: iOS 13 Device: iPhone 11 Issue: Crashes with a "bad cast" when attempting to send DTMF. I’ve reviewed my integration, but I can’t figure out why this casting error is occurring. Could this be an issue with how I’m handling the call object or a deeper issue with belle-sip casting?

Confirmed that the currentCall is valid before sending DTMF. Ensured that the DTMF character is correctly passed as a CChar. Verified that the Linphone SDK is initialized properly. Questions: Could this be related to an incorrect initialization of the currentCall or improper object casting? Are there any known compatibility issues between Linphone and belle-sip regarding DTMF handling? Is there a better way to send DTMF that avoids this error? Any help or insights would be greatly appreciated!

Upvotes: 0

Views: 38

Answers (0)

Related Questions