tencent cloud

Cloud Contact Center

Web

PDF
포커스 모드
폰트 크기
마지막 업데이트 시간: 2024-04-01 18:09:01

Step 1: Initialize the SDK

Please refer to Initializing SDK.
Note
The following steps should be performed after the 'tccc.events.ready' event is successful.

Step 2: Implement Clicking Button to Trigger SDK Outbound Call

Vue
React
Native JS
<template>
<button @click="sdkCall">One-click outbound call</button>
</template>
<script>
export default {
data() {
phoneNumber: '19999999999' // Replace it with a real outbound number
},
methods: {
sdkCall() {
window.tccc.Call.startOutboundCall({
phoneNumber: this.phoneNumber,
}).then((res) => {
this.sessionId = res.data.sessionId;
}).catch((err) => {
const error = err.errorMsg;
})
}
}
}
</script>
import { useState } from 'react';
export function CallButton() {
const [phoneNumber, setPhoneNumber] = useState('19999999999') // Replace it with a real outbound number

function sdkCall(phoneNumber) {
window.tccc.Call.startOutboundCall({
phoneNumber,
}).then((res) => {
this.sessionId = res.data.sessionId;
}).catch((err) => {
const error = err.errorMsg;
})
}

return (
<button onClick={sdkCall}>One-click outbound call</button>
)
}
<button id="call">One-click outbound call</button>
<script>
function sdkCall(phoneNumber) {
window.tccc.Call.startOutboundCall({
phoneNumber, // Outbound number
phoneDesc: 'Tencent' // Remarks, which will replace the display of the number on the call bar
}).then((res) => {
// Outbound call succeeded. Obtain the outbound ID, which can be used to query related call recordings and service records
const sessionId = res.data.sessionId
}).catch((err) => {
// Outbound call failed. Obtain the failure reason for prompt
console.error(err.errMsg)
})
}
// Listen to the click event of the button and trigger the outbound call method
document.getElementById('call').addEventListsner('click', () => {
// Replace it with a real outbound number
sdkCall('19999999999');
})
</script>
After the outbound call is successfully triggered, wait for the other party to answer and trigger related events in turn.

Outbound Call Event Process









도움말 및 지원

문제 해결에 도움이 되었나요?

피드백