tencent cloud

피드백

마지막 업데이트 시간: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

    
    
    
    
    
    
    
    문의하기

    고객의 업무에 전용 서비스를 제공해드립니다.

    기술 지원

    더 많은 도움이 필요하시면, 티켓을 통해 연락 바랍니다. 티켓 서비스는 연중무휴 24시간 제공됩니다.

    연중무휴 24시간 전화 지원