指名された会話を録音する
会話を録音する方法を示すコード・スニペット。着信に応答し
着信に応答し、発呼側を指定された会話に参加させるNCCOを返す。によって
設定 record をtrueに設定すると、会話が録音され、通話が完了すると
に送信されます。 eventUrl を指定します。ウェブフックには
録画のURL
例
Prerequisites
npm install express body-parserRun your code
Save this file to your machine and run it:
Prerequisites
Add the following to build.gradle:
implementation 'com.vonage:server-sdk-kotlin:2.1.1'
implementation 'io.ktor:ktor-server-netty'
implementation 'io.ktor:ktor-serialization-jackson'Run your code
We can use the アプリケーション plugin for Gradle to simplify the running of our application. Update your build.gradle with the following:
apply plugin: 'application'
mainClassName = project.hasProperty('main') ? project.getProperty('main') : ''Run the following gradle command to execute your application, replacing com.vonage.quickstart.kt.voice with the package containing RecordConversation:
Prerequisites
Add the following to build.gradle:
implementation 'com.vonage:server-sdk:9.3.1'
implementation 'com.sparkjava:spark-core:2.9.4'Run your code
We can use the アプリケーション plugin for Gradle to simplify the running of our application. Update your build.gradle with the following:
apply plugin: 'application'
mainClassName = project.hasProperty('main') ? project.getProperty('main') : ''Run the following gradle command to execute your application, replacing com.vonage.quickstart.voice with the package containing RecordConversation:
Prerequisites
Install-Package VonagePrerequisites
composer require slim/slim:^3.8 vonage/clientRun your code
Save this file to your machine and run it:
Prerequisites
pip install vonage python-dotenv fastapi[standard]Write the code
Add the following to record-a-conversation.py:
import os
from os.path import dirname, join
from pprint import pprint
from dotenv import load_dotenv
from fastapi import Body, FastAPI
from vonage_voice import Conversation
dotenv_path = join(dirname(__file__), '../.env')
load_dotenv(dotenv_path)
VOICE_CONFERENCE_NAME = os.environ.get('VOICE_CONFERENCE_NAME')
app = FastAPI()
@app.get('/webhooks/answer')
async def answer_call():
ncco = [
Conversation(
name=VOICE_CONFERENCE_NAME,
record=True,
eventMethod='POST',
eventUrl=['https://demo.ngrok.io/webhooks/recordings'],
)
]
return ncco
@app.post('/webhooks/recordings')
async def recordings(data: dict = Body(...)):
pprint(data)
return {'message': 'webhook received'}Run your code
Save this file to your machine and run it:
Prerequisites
gem install sinatra sinatra-contribRun your code
Save this file to your machine and run it:
試してみる
必要なのは
- Vonage番号(このコードスニペット)にダイヤルして会話を録音します。
- 録画をダウンロードするを見る 録音をダウンロードする のコード・スニペットで説明している。
さらに読む
- 通話録音 - 通話相手からの音声入力を録音したり、2人の通話相手の会話を録音する。