File tree Expand file tree Collapse file tree 3 files changed +34
-2
lines changed
main/kotlin/com/vonage/client/kt
test/kotlin/com/vonage/client/kt Expand file tree Collapse file tree 3 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -4,11 +4,12 @@ All notable changes to this project will be documented in this file.
4
4
The format is based on [ Keep a Changelog] ( http://keepachangelog.com/ )
5
5
and this project adheres to [ Semantic Versioning] ( http://semver.org/ ) .
6
6
7
- ## [ 1.1.0] - 2024-11-??
7
+ ## [ 1.1.0] - 2024-11-05
8
8
9
9
### Added
10
- - Custom template management for Verify API
11
10
- Pricing API
11
+ - Custom template management for Verify API
12
+ - Asynchronous DTMF event listener endpoints in Voice API
12
13
13
14
## [ 1.0.0] - 2024-10-25
14
15
First stable GA release
Original file line number Diff line number Diff line change @@ -99,6 +99,23 @@ class Voice internal constructor(private val client: VoiceClient) {
99
99
*/
100
100
fun sendDtmf (digits : String ): DtmfResponse = client.sendDtmf(id, digits)
101
101
102
+ /* *
103
+ * Subscribe to real-time DTMF key presses on the call, where the input mode is [InputMode.ASYNCHRONOUS].
104
+ *
105
+ * @param eventUrl The publicly accessible URL to send DTMF events to,
106
+ * which can be deserialised using [EventWebhook.fromJson].
107
+ *
108
+ * @since 1.1.0
109
+ */
110
+ fun subscribeToDtmfEvents (eventUrl : String ): Unit = client.addDtmfListener(id, eventUrl)
111
+
112
+ /* *
113
+ * Stop asynchronous DTMF events being sent to the URL configured in [subscribeToDtmfEvents].
114
+ *
115
+ * @since 1.1.0
116
+ */
117
+ fun stopAsyncDtmfEvents (): Unit = client.removeDtmfListener(id)
118
+
102
119
/* *
103
120
* Play an audio file to the call.
104
121
*
Original file line number Diff line number Diff line change @@ -329,6 +329,20 @@ class VoiceTest : AbstractTest() {
329
329
assertEquals(callIdStr, response.uuid)
330
330
}
331
331
332
+ @Test
333
+ fun `subscribe to real-time DTMF events` () {
334
+ mockPut(expectedUrl = " $callUrl /input/dtmf" , status = 200 ,
335
+ expectedRequestParams = mapOf (" event_url" to listOf (eventUrl))
336
+ )
337
+ existingCall.subscribeToDtmfEvents(eventUrl)
338
+ }
339
+
340
+ @Test
341
+ fun `stop receiving real-time DTMF events` () {
342
+ mockDelete(expectedUrl = " $callUrl /input/dtmf" )
343
+ existingCall.stopAsyncDtmfEvents()
344
+ }
345
+
332
346
@Test
333
347
fun `stream audio into call` () {
334
348
val loop = 3
You can’t perform that action at this time.
0 commit comments