メッセージを録音する
会話を録音する方法を示すコード・スニペット。着信に応答し
を含むNCCOを返す。 record アクションを実行する。呼び出しが完了すると
に送られる。 eventUrl を指定します。ウェブフックには
録画のURL
例
Prerequisites
Run your code
Save this file to your machine and run it:
Prerequisites
Add the following to build.gradle:
Write the code
Add the following to the main method of the RecordMessage class:
embeddedServer(Netty, port = 8000) {
routing {
get("/webhooks/answer") {
call.response.header("Content-Type", "application/json")
call.respond(
Ncco(
talkAction("Please leave a message after the tone, then press #."),
recordAction {
eventUrl(call.request.path().replace("answer", "recordings"))
beepStart(true)
endOnSilence(3)
endOnKey('#')
},
talkAction("Thank you for your message. Goodbye!")
).toJson()
)
}
post("/webhooks/recordings") {
val event = EventWebhook.fromJson(call.receive())
println("Recording URL: ${event.recordingUrl}")
call.respond(204)
}
}
}.start(wait = true)Run your code
We can use the アプリケーション plugin for Gradle to simplify the running of our application. Update your build.gradle with the following:
Run the following gradle command to execute your application, replacing com.vonage.quickstart.kt.voice with the package containing RecordMessage:
Prerequisites
Add the following to build.gradle:
Run your code
We can use the アプリケーション plugin for Gradle to simplify the running of our application. Update your build.gradle with the following:
Run the following gradle command to execute your application, replacing com.vonage.quickstart.voice with the package containing RecordMessage:
Prerequisites
Prerequisites
Run your code
Save this file to your machine and run it:
Prerequisites
Run your code
Save this file to your machine and run it:
Prerequisites
Run your code
Save this file to your machine and run it:
試してみる
必要なのは
- Vonage番号にダイヤルしてメッセージを録音し、発信音の後にメッセージを残してください(このコードスニペット)。
- 録画をダウンロードするを見る 録音をダウンロードする のコード・スニペットで説明している。
さらに読む
- ボイスメール - .NETとVonage Voice APIを使って着信コールの音声を録音する方法をご紹介します。