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.
44The format is based on [ Keep a Changelog] ( http://keepachangelog.com/ )
55and this project adheres to [ Semantic Versioning] ( http://semver.org/ ) .
66
7- ## [ 1.1.0] - 2024-11-??
7+ ## [ 1.1.0] - 2024-11-05
88
99### Added
10- - Custom template management for Verify API
1110- Pricing API
11+ - Custom template management for Verify API
12+ - Asynchronous DTMF event listener endpoints in Voice API
1213
1314## [ 1.0.0] - 2024-10-25
1415First 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) {
9999 */
100100 fun sendDtmf (digits : String ): DtmfResponse = client.sendDtmf(id, digits)
101101
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+
102119 /* *
103120 * Play an audio file to the call.
104121 *
Original file line number Diff line number Diff line change @@ -329,6 +329,20 @@ class VoiceTest : AbstractTest() {
329329 assertEquals(callIdStr, response.uuid)
330330 }
331331
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+
332346 @Test
333347 fun `stream audio into call` () {
334348 val loop = 3
You can’t perform that action at this time.
0 commit comments