すべての通話の情報を取得する
全コールの情報を取得する方法を示すコード・スニペット。
例
Prerequisites
Execute the following command at your terminal prompt to create the JWT for authentication:
Run your code
Save this file to your machine and run it:
Prerequisites
Create a file named retrieve-info-for-all-calls.js and add the following code:
const { Vonage } = require('@vonage/server-sdk');
const vonage = new Vonage({
applicationId: VONAGE_APPLICATION_ID,
privateKey: VONAGE_PRIVATE_KEY,
});Write the code
Add the following to retrieve-info-for-all-calls.js:
const getCalls = async () => {
try {
for await (const call of vonage.voice.getAllCalls()) {
console.log(call);
}
} catch (error) {
console.error(error);
}
};
getCalls();Run 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'Create a class named RetrieveInfoForAllCalls and add the following code to the main method:
Write the code
Add the following to the main method of the RetrieveInfoForAllCalls class:
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 RetrieveInfoForAllCalls:
Prerequisites
Add the following to build.gradle:
implementation 'com.vonage:server-sdk:9.3.1'Create a class named RetrieveInfoForAllCalls and add the following code to the main method:
Write the code
Add the following to the main method of the RetrieveInfoForAllCalls class:
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 RetrieveInfoForAllCalls:
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:
試してみる
サンプルコードを実行して、すべてのコールの情報を取得する。