快速集成

接口对接,快速集成文档参照。

任务调用接口集成

第一步:获取实例ID以及场景ID

参照业务管理创建外呼实例和外呼话术后,进行获取对应的实例ID(InstanceId)及场景ID(ScriptId)。获取位置参见下图:

  1. 业务管理:找到创建好的业务,点击编辑,会展示实例ID。

    image

  2. 场景ID:进入业务,找到场景管理,在所创建的话术场景侧,点击场景ID,即可获取。

    image

    image

第二步:创建外呼任务

调用CreateJobGroup接口,获取返回的JobGroupId

第三步:上传外呼号码名单

调用AssignJobs - 批量创建外呼任务接口,传入上面获取到的JobGroupId,将外呼被叫号码名单传入该任务中

任务结果自动推送回调

MQ简介

  • 介绍:对于每个外呼任务的呼叫完成状态,智能外呼服务会通过消息队列(RocketMQ)的方式通知调用方。消息中会返回任务Id,外呼任务的状态(接通/无人接听/呼叫失败)等。

  • 操作:接入方在阿里云购买的RocketMQ服务,智能外呼机器人目前支持RocketMQ4.0以及5.0,如果客户需要MQ4.0,可通过自助服务工具自行申请加白为MQ 4.0,

    客户使用RocketMQ4.0后,需要客户填入:

    • 消息队列实例ID:填入配置MQ完成后的实例ID。

    • Topic:填入MQ服务对应的Topic。

    • 接入地址:填入MQ服务对应的接入地址。

    • 接入点类型:根据实际接入点类型选择NAMESRV_ADDR或ONS_ADDR。

    • 认证类型:默认为AK_SK。

    • AccessKey:填入需要实际使用的MQ对应的AccessKey。

    • SecretKey:填入需要实际使用的MQ对应的SecretKey。

    客户使用RocketMQ5.0后,需要客户填入

    • 消息队列实例ID:填入配置MQ完成后的实例ID。

    • Topic:填入MQ服务对应的Topic。

    • 接入地址:填入MQ服务对应的接入地址。

    • 接入点类型:根据实际接入点类型选择NAMESRV_ADDR或ONS_ADDR。

    • 认证类型:用户名密码。

    • 用户名:填入MQ服务对应的用户名。

    • 密码:填入MQ服务对应的密码。

  • MQ的SDK版本建议:

    <dependency>

    <groupId>com.aliyun.openservices</groupId>

    <artifactId>ons-client</artifactId>

    <version>1.8.8.Final</version

    </dependency>

  • MQ开通以及集成

    RocketMQ的购买参见其产品详情页:产品详情页

    订阅RocketMQ消息参见RocketMQ的帮助文档:消息队列RocketMQ版帮助文档

    开通消息队列后该如何获取任务完成信息参考文档:

MQ消息类型:

消息级别

消息类型

EventType

任务

任务完成

JobComplete

通话

开始呼叫

Dialing

通话

接通通话

CallAnswered

通话

通话结束:挂机或者未接通超时

CallFinished

通话

大模型标签

LabelReady

录音

录音生成成功

RecordingReady

CallFinished消息体:

{
    "contacts": [
        {
            "honorific": "259049",
            "id": "d045421c-5c56-4e60-bd30-52621bd40358",
            "name": "259049",
            "phoneNumber": "1854625****",
            "referenceId": "102553299"
        }
    ],
    "eventTime": 1732032007598,
    "eventType": "CallAnswered",
    "extras": [
        {
            "key": "TenantId",
            "value": "1594349927946608"
        },
        {
            "key": "ServiceId",
            "value": "208983907113910398"
        }
    ],
    "groupId": "b842817b-3a8e-455e-974f-60a22c7181a8",
    "id": "c18312d3-1e3a-4f07-a00a-bf92d3bcce87",
    "instanceId": "e2d412ad-6571-43a7-9624-0d779fb80a9e",
    "scriptId": "0e700dc9-39e9-4872-8cc8-0654d38c9615",
    "tagHits": [

    ],
    "task": {
        "actualTime": 1732032007576,
        "callId": "ee819df9f4e54e26a741591431534878",
        "calledNumber": "1854625****",
        "callingNumber": "0218045****",
        "id": "88a26ac5-645e-4423-bb39-3d5943a27dc9",
        "planedTime": 1732031999000,
        "status": "Executing"
    }
}
    

JobComplete消息体:

{
    "contacts": [
        {
            "honorific": "259049",
            "id": "d045421c-5c56-4e60-bd30-52621bd40358",
            "name": "259049",
            "phoneNumber": "185xxxxxxx",
            "referenceId": "102553299"
        }
    ],
    "eventTime": 1732032015258,
    "eventType": "JobComplete",
    "extras": [
        {
            "key": "TenantId",
            "value": "1594349927946608"
        },
        {
            "key": "ServiceId",
            "value": "208983907113910398"
        }
    ],
    "groupId": "b842817b-3a8e-455e-974f-60a22c7181a8",
    "id": "c18312d3-1e3a-4f07-a00a-bf92d3bcce87",
    "instanceId": "e2d412ad-6571-43a7-9624-0d779fb80a9e",
    "scriptId": "0e700dc9-39e9-4872-8cc8-0654d38c9615",
    "status": "Succeeded",
    "tagHits": [

    ],
    "tasks": [
        {
            "actualTime": 1732032008000,
            "callId": "ee819df9f4e54e26a741591431534878",
            "calledNumber": "185xxxxxxxx",
            "callingNumber": "021xxxxxxxx",
            "endTime": 1732032015000,
            "hasLastPlaybackCompleted": true,
            "id": "88a26ac5-645e-4423-bb39-3d5943a27dc9",
            "planedTime": 1732031999000,
            "realRingingDuration": 7,
            "ringingDuration": 25,
            "status": "Succeeded"
        }
    ]
}

CallAnswered消息体:

{
    "contacts": [
        {
            "honorific": "259049",
            "id": "d045421c-5c56-4e60-bd30-52621bd40358",
            "name": "259049",
            "phoneNumber": "185xxxxxxxx",
            "referenceId": "102553299"
        }
    ],
    "eventTime": 1732032007598,
    "eventType": "CallAnswered",
    "extras": [
        {
            "key": "TenantId",
            "value": "1594349927946608"
        },
        {
            "key": "ServiceId",
            "value": "208983907113910398"
        }
    ],
    "groupId": "b842817b-3a8e-455e-974f-60a22c7181a8",
    "id": "c18312d3-1e3a-4f07-a00a-bf92d3bcce87",
    "instanceId": "e2d412ad-6571-43a7-9624-0d779fb80a9e",
    "scriptId": "0e700dc9-39e9-4872-8cc8-0654d38c9615",
    "tagHits": [

    ],
    "task": {
        "actualTime": 1732032007576,
        "callId": "ee819df9f4e54e26a741591431534878",
        "calledNumber": "185xxxxxxxx",
        "callingNumber": "021xxxxxxxx",
        "id": "88a26ac5-645e-4423-bb39-3d5943a27dc9",
        "planedTime": 1732031999000,
        "status": "Executing"
    }
}

LabelReady消息体:

{
    "eventTime": 1732087443211,
    "eventType": "LabelReady",
    "instanceId": "ae4572af-376f-439f-8970-38764acbaa91",
    "jobId": "12964626-49a9-4da2-beec-783b94637aff",
    "labelMap": {
        "通话总结": "用户表示吸油烟机还未到货,因此无法安排安装。建议用户待货物到达后再联系服务中心确认安装事宜。",
        "真实号码": "未触发",
        "是否拆旧机等需求": "未触发",
        "上门时间": "未触发",
        "确认预约": "未触发",
        "修改地址": "未触发",
        "是否到货": "未到货",
        "人工服务": "未触发"
    },
    "scriptId": "a81f9147-ec4c-43d3-9dfa-e939a68b1d62",
    "taskId": "4fb3a6b5-3468-4f35-b3eb-dfe9f31333d0"
}

RecordingReady消息体:

{
    "eventType":"RecordingReady",
    "eventTime":1588850490334,
    "instanceId":"08a4c460-***-737e069a154f",
    "groupId":"8869f35d-***-9b46437bc0fa",
    "id":"08a4c460-***-737e069a154f",
    "extras":[
        {
            "key":"custom",
            "value":"aaa"
        }
    ],
    "contacts":[
        {
            "id":"762c2e16-***-00a0f13372b1",
            "honorific":"test",
            "name":"test",
            "phoneNumber":"11111111",
            "referenceId":"762c2e16-***-00a0f13372b1"
        }
    ],
    "recording":{
        "taskId":"60b48efe-***-5d6b70479641",
        "callId":"60b48efe-***-5d6b70479641",
        "duration":5,
        "fileName":"a.wav",
        "mkvUrl":"https://a.wav",
        "url":"https://a.wav"
    }
}

各状态枚举值:

JobGroup状态示例值
-JobGroupStatus {
    Draft(0),草稿
    Scheduling(1),调度中
    Executing(2),执行中
    Completed(3),已完成
    Paused(4),挂起
    Failed(5),失败
    Cancelled(6),已取消
    Initializing(7),初始化
}

Job状态示例值
-JobStatus {
    Scheduling(0, "调度中"),
    Executing(1, "执行中"),
    Succeeded(2, "结束-已触达"),
    Paused(3, "暂停"),
    Failed(4, "结束-未触达"),
    Cancelled(5, "已取消-人工干预"),
    Drafted(6, "草稿态"),
}



Task状态示例值
-TaskStatus {
    Executing(0, "正在拨打"),
    Succeeded(1, "已接通"),
    NoAnswer(2, "未接通-无人接听"),
    NotExist(3, "未接通-空号"),
    Busy(4, "未接通-占线"),
    Cancelled(5, "未呼出-任务停止"),
    Failed(6, "失败"),
    NotConnected(7, "未接通-无法接通"),
    PoweredOff(8, "未接通-关机"),
    OutOfService(9, "未接通-被叫停机"),
    InArrears(10, "未接通-被叫欠费"),
    EmptyNumber(11, "未呼出-空号不外呼"),
    PerDayCallCountLimit(12, "未呼出-超出每日上限"),
    ContactBlockList(13, "未呼出-黑名单"),
    CallerNotRegistered(14, "未呼出-主叫号码未注册"),
    Terminated(15, "未呼出-被终止"),
    VerificationCancelled(16, "未呼出-呼叫前验证不通过取消"),
    OutOfServiceNoCall(17, "未呼出-被叫停机不外呼"),
    InArrearsNoCall(18, "未呼出-被叫欠费不外呼"),
    CallingNumberNotExist(19, "未呼出-主叫号码不存在"),
    SucceededFinish(20, "已接通-正常完结"),
    SucceededChatbotHangUpAfterNoAnswer(21, "已接通-拒识后机器人挂机"),
    SucceededChatbotHangUpAfterSilence(22, "已接通-静默超时挂机"),
    SucceededClientHangUpAfterNoAnswer(23, "已接通-拒识后用户挂机"),
    SucceededClientHangUp(24, "已接通-用户无理由挂机"),
    SucceededTransferByIntent(25, "已接通-命中意图转人工"),
    SucceededTransferAfterNoAnswer(26, "已接通-拒识转人工"),
    SucceededInoInterAction(27, "已接通-用户侧无交互"),
    SucceededError(28, "已接通-系统异常中断"),
    SucceededSpecialInterceptVoiceAssistant(29, "已接通-特殊情况拦截-语音助手"),
    SucceededSpecialInterceptExtensionNumberTransfer(30, "已接通-特殊情况拦截-分机号转接")
}

未触达原因示例值
-JobFailureReason  
{

    /**
     * 未知错误
     */
    Unknown(0),

    /**
     * 无人接听
     */
    NoAnswer(1),

    /**
     * 无效的策略,策略配置不正确
     */
    InvalidStrategy(2),

    /**
     * 调度时发现超时
     */
    TimeUp(3),

    /**
     * 策略为空或没有找到
     */
    NoStrategy(4),

    /**
     * 呼叫失败
     */
    CallFailed(5),

    /**
     * 号码每日呼叫次数限制
     */
    PerDayCallCountLimit(6),

    /**
     * 禁止外呼名单
     */
    ContactBlockList(7),

    /**
     * 空号不再外呼
     */
    EmptyNumber(8),

    /**
     * 号码每日呼叫次数限制
     */
    JobPerDayCallCountLimit(9),

    /**
     * 呼叫前验证不通过取消
     */
    VerificationCancelled(10),

    /**
     * 止呼
     */
    ContactSuspended(11),

    /**
     * 欠费
     */
    InArrears(12),

    /**
     * 停机
     */
    OutOfService(13),

    /**
     * 任务最大尝试次数, 当RepeatBy(@see )为None时生效
     */
    NoneRepeatableJobMaxAttemptCountLimit(14);

}