feat: add sendDtmf method to send DTMF tones during a call
This commit is contained in:
parent
b95baa6799
commit
f64284f963
9 changed files with 84 additions and 1 deletions
|
|
@ -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()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue