切换主题
发起语音点呼
发起语音点呼示例
只能同时发起一路语音点呼,被呼方接听成功代表本次点呼成功
<script setup name="DialVoice">
import { reactive, ref } from 'vue'
import {ElMessage} from 'element-plus'
import { checkInstance, getInstanceFCC } from '../../use-fcc'
import { setLog } from '../../use-log'
const token = ref('')
const userAccount = ref('')
const location = reactive({
locX: '',
locY: '',
scale: 1
})
const loading = ref(false)
const dialVoice = async () => {
setLog({
name: '开始语音呼叫'
})
if (loading.value) {
setLog({
name: '语音呼叫结果',
msg: '请先实例化'
})
return
}
if (!await checkInstance()) {
setLog({
name: '语音呼叫',
msg: '请先实例化',
type: 'warning'
})
return
}
if (!userAccount.value) {
setLog({
name: '语音呼叫',
msg: `参数错误,请输入呼叫账号`,
type: 'warning'
})
return
}
loading.value = true
let result = await getInstanceFCC().dialVoice({
userAccount: userAccount.value,
location: location
})
setLog({
name: '语音呼叫结果',
msg: result
})
loading.value = false
if (result.status == 200) {
ElMessage({
message: '语音呼叫成功',
type: 'success'
})
} else {
ElMessage({
message: result.msg,
type: 'info'
})
}
}
const dialVoiceHangUp = async () => {
setLog({
name: '挂断语音呼叫'
})
let result = await getInstanceFCC().dialVoiceHangUp()
setLog({
name: '挂断语音呼叫结果',
msg: result
})
if (result.status == 200) {
ElMessage({
message: '挂断语音呼叫成功',
type: 'success'
})
} else {
ElMessage({
message: result.msg,
type: 'info'
})
}
}
</script>
<template>
<el-form>
<el-form-item label="账号">
<el-input v-model="userAccount" placeholder="请输入对方账号"></el-input>
</el-form-item>
<div class="form-title">{{ 'location' }}</div>
<el-form-item label="locX" style="margin-left: 15px">
<el-input v-model="location.locX" placeholder="请输入X轴位置"></el-input>
</el-form-item>
<el-form-item label="locY" style="margin-left: 15px">
<el-input v-model="location.locY" placeholder="请输入Y轴位置"></el-input>
</el-form-item>
<el-form-item label="scale" style="margin-left: 15px">
<el-input v-model="location.scale" placeholder="请输入缩放比率"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="dialVoice" :loading="loading">发起语音点呼</el-button>
<el-button type="danger" @click="dialVoiceHangUp" :loading="loading">挂断语音点呼</el-button>
</el-form-item>
</el-form>
</template>
<style scoped>
.form-title{
font-size: 16px;
margin-bottom: 10px;
}
</style>使用方法
typescript
fcc.dialVoice({
userAccount: '临时对接的测试账号',
location: { // 非必须
locX: 100, // x轴坐标
locY: 100, // y轴坐标
scale: 1, // 缩放比,原始大小320*280
}
})1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
入参说明
| 参数名 | 数据类型 | 选取原则 | 说明 |
|---|---|---|---|
| userAccount | string | 必选 | 融合通讯对接的账号 |
| location | object | 可选 | 控制语音对话框位置大小。 locX: x轴坐标,locY:y轴坐标,scale:缩放比,原始大小320*280 |
出参说明
| 出参名称 | 数据类型 | 说明 |
|---|---|---|
| status | number | 调用接口返回结果的状态码,其含义参考融合通讯中台通用状态码。 |
| msg | string | 给开发者的文字提示信息 |
| data | object | 返回的信息,callSno:流水号 |
