Skip to content

NXCC Iframe

henryou edited this page Mar 5, 2024 · 2 revisions

牛信云呼叫中心Iframe对接文档

1. Iframe域名地址

https://nxlink.nxcloud.com/admin/#/nxcc

// 创建iframe
// 建议width为380px,height为690px
<iframe id="iframe" allow="camera *; microphone *; autoplay *; hid *" src="https://nxlink.nxcloud.com/admin/#/nxcc"></iframe>

2. 初始化配置参数,登录注册话机

字段 备注
email 账号(邮箱)
password 密码
lang 语言,目前支持中文(zh-CN),英文(en-US),西班牙语(es-MX)
const message = {
    type: 'init',
    content: {
        email:email,
    	password: password,
        lang: "zh-CN",
    }
}

const mapFrame = document.getElementById("iframe")
mapFrame.onload = function() {
	const iframeWin = mapFrame.contentWindow;
	iframeWin.postMessage(message, '*');
}

3. Iframe页面回调

// iframe给系统postMessage传递消息
window.parent.postMessage(data, '*');
  1. 账号登入成功

    登录账号存在坐席时传递以下字段,无坐席不传递

    字段 备注
    email 登录账号
    sipNum 话机号
    groupNo 坐席组编号
    // 回调数据
    event.data:{
        type: 'login',
        content: {
          email: '',
          sipNum: '',
          groupNo: ''    
        }
    }
  2. 登录账号是否存在坐席
    code 备注
    1 该账号存在坐席
    2 该账号不存在坐席或者坐席状态已关闭
    // 回调数据
    event.data:{
        type: 'agentExists',
        content: {
          code: 1
        }
    }
  3. 话机状态和回调消息
    Code 话机状态
    0 呼出中
    1 呼入中
    2 通话中
    3 话机断开
    4 话机注册成功
    5 挂断
    6 账号未登录
    -1 话机注册失败

    当话机状态为呼出中(0)、呼入中(1)、通话中(2)、挂断(5)的通话状态时,会返回以下字段

    字段 备注
    callId 通话 id
    direction 通话场景,0:呼入,1:呼出,2:自动拨号转人工
    caller 主叫号码
    callee 被叫号码
    orderId 回传的用户自定义id,字符串,32位
    params 回传的用户自定义字段,支持json字符串
    callStartTimestamp 时间戳,当发起呼叫/接收来电时生成
    callConnectedTimestamp 时间戳,当接听电话时生成
    callHangUpTimestamp 时间戳,挂断电话后生成
    // 回调数据
    event.data:{
        type: 'dialStatus',
        content: {
          code: 0,
          callId: '',
          orderId: '',
          direction: 1,
          caller: '',
          callee: '',
          params: '',
          callStartTimestamp: '',
          callConnectedTimestamp: '',
          callHangUpTimestamp: ''
        }
    }
  4. 坐席状态(默认示闲)
    code 备注
    1 示闲
    2 示忙(包括发起呼叫/接收来电、通话中、整理中)
    // 回调数据
    event.data:{
        type: 'agentStatus',
        content: {
          code: 1
        }
    }
  5. 登出
    // 回调数据
    event.data:{
        type: 'logout'
    }
  6. token失效
    // 回调数据
    event.data:{
        type: 'tokenInvalid'
    }

4. 发起呼叫

const message = {
    type: 'callOut',
    content: {
        caller: '', // varchar(32),主叫,主叫传空将根据随机号码呼出
        callee: "8524444", // varchar(32),被叫,需带国码,例如呼叫香港方向:852******
        countryCode: "852", // 被叫国码
        orderId: "66493f1afaa3",  // varchar(32),自定义orderId, 可选填,
        params: "" // 自定义字段
    }
}

const mapFrame = document.getElementById("iframe")
const iframeWin = mapFrame.contentWindow;
iframeWin.postMessage(message, '*');

简介

短信

语音

云呼叫中心(NXLink)

云呼叫中心(AI自动外呼)

Flash Call

短链

邮件验证码

DID号码

通用

号码检测

WhatsApp

Viber

Zalo ZNS

Super Message API

隐私号(旧)

PNS

坐席(旧版)

AI Agent

Clone this wiki locally