feat: add sendDtmf method to send DTMF tones during a call

This commit is contained in:
Andrew 2026-03-30 09:28:40 +07:00
parent b95baa6799
commit f64284f963
9 changed files with 84 additions and 1 deletions

View file

@ -185,6 +185,17 @@ class LiblinphoneFlutterPlugin : FlutterPlugin, ActivityAware, MethodCallHandler
result.success(true)
}
"sendDtmf" -> {
try {
val tone = call.argument<String>("tone")!!
val res = linphoneBridge.sendDtmf(tone)
result.success(res)
} catch (e: Exception) {
Log.e(TAG, "sendDtmf: ${e.message}")
result.error("error", e.message, e)
}
}
else -> {
result.notImplemented()
}

View file

@ -364,4 +364,18 @@ class LinphoneBridge(
}
return CallType.Unknown
}
fun sendDtmf(tone: String): Boolean {
if (currentCall == null) {
return false
}
if (tone.isEmpty()) {
return false
}
val dtmfChar = tone[0]
currentCall?.sendDtmf(dtmfChar)
return true
}
}