test: vonage 语音

dev/voice
Lei OT 5 months ago
parent 1b4233dd62
commit 29cc7851ba

@ -29,7 +29,7 @@
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@vitejs/plugin-react": "^4.3.3",
"@vonage/client-sdk": "^1.7.2",
"@vonage/client-sdk": "^2.0.0",
"autoprefixer": "^10.4.20",
"eslint": "^8.45.0",
"eslint-plugin-react": "^7.37.2",

@ -21,7 +21,7 @@ export const EMAIL_HOST = 'https://p9axztuwd7x8a7.mycht.cn/mail-server/service-m
export const API_HOST = 'https://p9axztuwd7x8a7.mycht.cn/whatsapp_server/v2';
export const WS_URL = 'wss://p9axztuwd7x8a7.mycht.cn/whatsapp_server'; // prod:
// export const VONAGE_URL = 'https://p9axztuwd7x8a7.mycht.cn/vonage-server'; // 语音和视频接口:
export const VONAGE_URL = 'http://ivnkfj.natappfree.cc'; // 语音和视频接口:
export const VONAGE_URL = 'http://ias8ad.natappfree.cc'; // 语音和视频接口:
export const HT3 = process.env.NODE_ENV === 'production' ? 'https://p9axztuwd7x8a7.mycht.cn/ht3' : 'http://127.0.0.1:8000';
export const DATE_FORMAT = 'YYYY-MM-DD';

@ -1,15 +1,15 @@
import { create } from "zustand";
import { VonageClient } from "@vonage/client-sdk";
import { VonageClient, LoggingLevel } from "@vonage/client-sdk";
import { fetchJSON } from "@/utils/request";
import { prepareUrl, isNotEmpty } from "@/utils/commons";
import { prepareUrl, isNotEmpty, } from "@/utils/commons";
import { VONAGE_URL, DATETIME_FORMAT } from "@/config";
import dayjs from "dayjs";
const callCenterStore = create((set, get) => ({
client: new VonageClient({
// region: "AP",
region: "AP",
// apiUrl: "https://api-ap-3.vonage.com", websocketUrl: "wss://ws-ap-3.vonage.com",
loggingLevel: 'Verbose',
loggingLevel: LoggingLevel.Debug,
}),
call_id: 0,
loading: false,
@ -35,6 +35,10 @@ const callCenterStore = create((set, get) => ({
.catch(error => {
log("Error creating session: ", error);
});
client
.getUser('me')
.then((user) => log('getUser --me', user))
.catch((error) => log);
client.on("sessionError", reason => {
// After creating a session
@ -82,7 +86,8 @@ const callCenterStore = create((set, get) => ({
if (client) {
set({ loading: true });
client
.serverCall({ to: phone_number })
// .serverCall({ to: phone_number, callee: phone_number, device_name: 'SalesCRM' })
.serverCall({ to: phone_number, })
.then(callId => {
log("Id of created call: ", callId);
set({ call_id: callId });

@ -20,6 +20,7 @@ User ID Name
USR-4476dbcc-8e2a-4048-ac8a-8ab49345167a HighlightsTravel
USR-a778518f-6d94-43b8-ab3c-413e6af8f10a NAM-3f97db93-da89-4937-b457-14be72b7b62b
USR-9f60dff4-78c3-40c8-9aad-f762df371728 NAM-c54db270-643a-43a6-883e-b8c28d292dbe
USR-2e2e267c-e718-4114-b488-bc6677541fd4 Highlights
Done Listing users
```

@ -25,7 +25,7 @@ const app_id = '503c548f-cb61-4a3a-8599-cd815680b390';
const api_key = '197c68c9';
const api_secret = 'Aa11be17f298dfd4118bdf23';
const vonageNumber = "12019751815"; //用于通话的号码,今后根据前端提交来做号码切换
const vonageUser = "HighlightsTravel"; // user name
const vonageUser = "Highlights"; // user name
const response = (data) => {
return {

Loading…
Cancel
Save