接口版本:V1


开发引导

1.认证

为确保您的账户 和信息安全,请在开发对接程序前支持接口调用专属密钥。

您必须替换对接密钥 APP KEY 和 APP SECRET在您的对接程序中,密钥可在 https://saas.telrobot.top 平台登录后,在个人信息页面中获取 app keyapp secret

API认证采用HMACSha1加密算法进行加密,使用 app secretapp keyGMT时间戳共同生成一个sign签名,在每次调用请带上如下参数或将参数添加到请求头中:

    /**
     * 签名
     * 规则:appKey + "\n" + GMT时间
     * GMT格式: Mon, 20 May 2019 12:28:18 GMT
     * date("D, d M Y H:i:s e")
     *
     * @param String $appKey
     * @param String $appSecret
     * @param String $date 时间:Thu, 13 Dec 2018 01:27:17 GMT
     * @return string
     */
    private static function generateSign (String $appKey, String $appSecret,String $date)
    {
        if (function_exists('hash_hmac')) {
            $stringToSign = $appKey . "\n" . $date;
            return base64_encode(hash_hmac("sha1", $stringToSign, $appSecret, true));
        }
    }

2.统一请求格式


更新日志

20200714

  1. 向任务里导入号码 由只导入号码,改为导入CRM+号码的形式
  2. 公海导入模板 返回数据格式变化
  3. 公海导入 发送数据格式变化

接口列表

任务相关

任务创建初始化


接口:GET /v1/task/create

  1. 返回
{
    "meta": {
        "enum_disable_dial_timegroup": [{
            "uuid": "146979fe-3864-4817-ad76-13b37f43bb1c", // 禁呼时间id
            "name": "休息时间"
        }, {
            "uuid": "cf44b8fc-a60f-499e-a5c8-5340963a56a3",
            "name": "午休时间"
        }, {
            "uuid": "a6c20127-1199-4b87-bffa-75ed3e368fd0",
            "name": "早会时间"
        }],
        "caller_line_list": [{ // 线路列表
            "name": "南京-云蝠智能-17361984317-云蝠节点一",
            "value": "37d73edf-4628-4cf1-8beb-758433fd0aab", // 使用线路id
            "residue": 1, // 剩余并发,只能选大于1的
            "call_line": 1, // 线路总并发
            "available_at": "2019-12-18 00:00:00",
            "call_number": "17361984317" // 主叫号码
        }],
        "max_recycle_limit": "50", // 可设置最大重拨次数 [弃用,使用重呼规则]
        "auto_recycle_rules": [{ // 重呼规则
            "id": 1, // 重呼规则id
            "name": "测试重呼规则", // 重呼规则名称
            "remark": "test", // 重呼规则备注
            "status": true, // 重呼规则状态
        }],
        "customer_service": [{ // 客服组
            "id": 21,
            "user_id": "4d99d91c-f5d9-49da-88da-758977cc58a9",
            "name": "组2",
            "created_at": "2019-05-10 16:03:09",
            "updated_at": "2019-05-15 18:01:40",
            "caller_line_id": "37d73edf-4628-4cf1-8beb-758433fd0aab", // 使用的转接线路,只能不为null的
            "status": 1 // 是否可用,必须选为1的
        }],
        "outbound_group": [{ // 话术分组
            "id": 390, // 话术分组ID
            "name": "测试话术【复制】", // 话术分组名称
            "user_id": "4d99d91c-f5d9-49da-88da-758977cc58a9",
            "debug": true, // 是否开启调试模式,开启后全部话术走tts
            "deleted_at": null,
            "created_at": "2019-02-24 14:24:23",
            "updated_at": "2019-02-24 14:24:23",
            "link_word_group_id": null, // 使用的衔接词组id
            "tag_scene_id": null, // 关联的业务场景id
            "default": false
        }]
    }
}

部分字段解释

  1. caller_line_list使用的线路列表,只能使用residue大于1的
  2. enum_disable_dial_timegroup禁呼时间段列表

任务创建

接口:POST /v1/task

  1. data
参数 类型 示例 解释 required
caller_line_id string 37d73edf-4628-4cf1-8beb-758433fd0aab 使用线路列表caller_line_list的value yes
customer_service_id int 1 使用客服组的id no
destination_extension int 297 使用话术分组的id yes
disable_dial_timegroup string 146979fe-3864-4817-ad76-13b37f43bb1c 禁用呼叫时间的uuid yes
maximumcall int 1 并发数(不得超过选用线路的residue) yes
name string 测试任务 任务名称 yes
random_assignment_number int 0 固定为0 yes
recycle_limit int 1 呼叫失败最大重拨次数[弃用,有且只能为0] yes
remark string 第一个任务 任务描述 no
_originate_timeout int 60 拨号超时 yes
call_pause_second int 10 每通电话的呼叫间隔,单并发的建议间隔10秒,多并发可选择0秒 yes
auto_recycle_rule_id int 1 重呼规则id yes

部分字段解释

  1. 话术分组列表需要自己请求接口,在其他中;
  2. 客服列表需要自己请求接口,在其他中;
  1. 返回
{
  "start": 0, // 此任务的实体
  "alter_datetime": "2020-03-06 22:38:02",
  "destination_dialplan": "XML",
  "destination_context": "default",
  "originate_variables": "{execute_on_media=start_da2}",
  "maximumcall": 1,
  "recycle_limit": 0,
  "name": "测试",
  "remark": "测试",
  "destination_extension": 1197,
  "disable_dial_timegroup": "146979fe-3864-4817-ad76-13b37f43bb1c",
  "random_assignment_number": 0,
  "caller_line_id": "83f180c4-00f3-4aaa-bc41-6cba4493e892",
  "call_pause_second": 10,
  "_originate_timeout": 60,
  "customer_service_id": 21,
  "auto_recycle_rule_id": 103,
  "_origination_caller_id_number": "17368464879",
  "dial_format": "user/admin",
  "call_notify_url": "http://127.0.0.1:81/api/hangup_notify",
  "call_notify_type": 2,
  "uuid": "02f5bb4a-8a09-4eae-8969-6c2a3732f774",
  "user_id": "4d99d91c-f5d9-49da-88da-758977cc58a9",
  "create_datetime": "2020-03-06 22:38:02",
  "start_str": "暂停",
  "group_str": "测试",
  "progress_bar": { // 此任务当前进度
    "total": 0,
    "progress": 0,
    "percent": 0
  },
    "group": { // 此任务使用的话术分组
    "id": 1197,
    "name": "测试",
    "user_id": "4d99d91c-f5d9-49da-88da-758977cc58a9",
    "debug": true,
    "deleted_at": null,
    "created_at": "2020-03-06 15:17:41",
    "updated_at": "2020-03-06 15:17:41",
    "link_word_group_id": null,
    "tag_scene_id": null,
    "default": true
  }
}

任务修改

接口:PUT /v1/task/{task_id}

参数同创建任务


外呼任务列表

接口:GET /v1/task

  1. 返回
{
    "data": [{
        "uuid": "dfc36b34-b398-4f6b-b263-cd64c53e5185", // 任务id
        "name": "测试任务",
        "create_datetime": "2019-05-07 15:15:40",
        "alter_datetime": "2019-05-17 10:58:58",
        "start": 0, // 任务状态,1开启|0暂停
        "maximumcall": 1, // 最大并发呼叫量
        "call_per_second": 10,
        "recycle_limit": 1, // 呼叫失败最大重拨次数 [启用,使用重呼规则]
        "random_assignment_number": 0,
        "disable_dial_timegroup": "146979fe-3864-4817-ad76-13b37f43bb1c", // 禁呼时间组ID
        "destination_extension": 447, // 使用话术分组ID
        "destination_dialplan": "XML",
        "destination_context": "default",
        "scheduling_policy_ratio": null,
        "scheduling_queue": null,
        "dial_format": "user/admin",
        "domain": null,
        "remark": null,
        "sort": 1,
        "originate_variables": "{execute_on_media=start_da2}",
        "_originate_timeout": 60,
        "_origination_caller_id_number": "17361984317", // 主叫号码
        "user_id": "4d99d91c-f5d9-49da-88da-758977cc58a9",
        "caller_line_id": "37d73edf-4628-4cf1-8beb-758433fd0aab", // 使用线路ID
        "customer_service_id": null, // 使用客服组ID
        "auto_recycle_rule_id": 103,   //重呼规则ID
        "call_notify_url": "http://127.0.0.1:81/api/hangup_notify",
        "call_notify_type": 2,
        "call_pause_second": 10,  //呼叫间隔(秒)
        "start_str": "暂停",
        "group_str": "test",
        "progress_bar": { // 任务进度 [弃用,需要专门请求 任务拨打进度 接口]
            "total": 2,
            "progress": 2,
            "percent": 100
        },
        "caller_line": {      //线路
      "id": "af69c544-a170-4a2d-b740-20bf66cc7ff4",
      "name": "南京-云蝠智能-17361984317",
      "user_id": "4d99d91c-f5d9-49da-88da-758977cc58a9",
      "description": null,
      "deadline_at": "2020-11-20 00:00:00",
      "available_time": 31536000,
      "begin_at": "2020-02-28 22:23:24",
      "call_line": 1,
      "call_line_used": 1,
      "call_number_prefix": "17361984317",
      "is_call_number_enable": 1,
      "is_call_number_prefix_editable": 0,
      "dial_string": "user/admin",
      "dial_string_mode": 1,
      "db_public_id": null,
      "db_private_id": null,
      "node_ip": "59.111.104.155",
      "node_status": "1",
      "created_at": "2020-02-28 22:24:48",
      "updated_at": "2020-03-04 20:51:03",
      "feature": 7
    },
    "auto_recycle_rule": {
      "id": 103,
      "user_id": "4d99d91c-f5d9-49da-88da-758977cc58a9",
      "name": "默认",
      "remark": "默认",
      "status": true,
      "created_at": "2020-02-13 10:35:05",
      "updated_at": "2020-02-13 10:35:05",
      "is_default": true
    },
    "disable_time_group": {
      "uuid": "cf44b8fc-a60f-499e-a5c8-5340963a56a3",
      "name": "午休时间",
      "domain": "",
      "user_id": "4d99d91c-f5d9-49da-88da-758977cc58a9",
      "created_at": null,
      "updated_at": null
    },
        "group": { // 使用话术组
            "id": 447,
            "name": "test",
            "user_id": "4d99d91c-f5d9-49da-88da-758977cc58a9",
            "debug": true,
            "deleted_at": null,
            "created_at": "2019-03-17 13:14:55",
            "updated_at": "2019-03-17 13:14:55",
            "default": false
        }
    }]
}

任务的删除

接口:GET /v1/task/destroy/{task_id}


任务的启动

接口:GET /v1/task/start/{id}


任务暂停

接口:GET /v1/task/stop/{id}


向任务里导入号码

接口:POST /v1/task/import_task_customer/{task_id}

  1. data
[
    {
        "phone": "13012121211",
        "sort": "2",
        "components": [
            {
                "id": "ca092ab6-02a6-4fe4-8c5e-a85c8380c152",
                "value": "小牛"
            },
            {
                "id": "8109ee83-f583-491e-8080-eb5b34a4b573",
                "value": "17"
            }
        ]
    },
    {
        "phone": "13012121212",
        "sort": "2",
        "components": [
            {
                "id": "ca092ab6-02a6-4fe4-8c5e-a85c8380c152",
                "value": "小张"
            }
        ]
    },
    {
        "phone": "13012121213",
        "sort": "2"
    }
]

返回

{
    "code": 200,
    "status": "ok",
    "message": "导入成功",
    "data": {
        "taskNumberCount": 10,
        "crmCustomerCount": 10
    }
}

返回说明


任务拨打进度

接口:GET /v1/task/task_progress/{task_id}

返回

 {
     "code": 200,
     "status": "ok",
     "message": "获取任务进度成功",
     "data": {
             "task_id": "772dd881-dcf7-42ee-a32b-b40a0ee5afb7",
             "progress": {
                 "total": 10,         //任务下号码总量
                 "progress": 10,      //已经拨打数量
                 "percent": 100       //进度
             }
         }
 }

重置号码呼叫状态

接口:PUT  /v1/task/{task_id}/number_reset

1.data

参数 类型 示例 解释 required
status array ["12"] 筛选你所需要重呼的号码的状态 no
created_at array ["2020-3-10","2020-3-10"] 筛选号码导入时间 no
keyword string 12345678901 指定号码 no

2.返回

{
    "code": 200,
    "status": "ok",
    "message": "重呼号码成功",
    "data": ""
}

根据任务ID获取标签场景,母标签,标签

接口:GET  /v1/task/{task_id}/tag

1.data

参数 类型 示例 解释 required
task_id string qazwsxedc123456 任务ID yes

2.返回

{
    "code": 200,
    "status": "ok",
    "message": "获取标签信息成功",
    "data": {
        "tag_scene": {
            "id": "0e62b98f-a5b9-46f8-ad95-dd18e0bb062e",
            "name": "标签场景2",
            "description": "我是描述2"
        },
        "tag_groups": [
            {
                "id": "1",
                "name": "标签组1"
            },
            {
                "id": "4",
                "name": "标签组2"
            }
        ],
        "tags": [
            {
                "id": "12",
                "name": "测试标签",
                "description": "33"
            },
            {
                "id": "20",
                "name": "加油",
                "description": "加油"
            },
            {
                "id": "11",
                "name": "标签2",
                "description": "33"
            }
        ]
    }
}

通话相关

某任务的通话记录列表

接口:POST v1/task/query_done_task_phones
  1. data
参数 类型 示例 解释 required
task_id string 1bcecc13-e873-4910-913c-d9246a891280 外呼任务的id yes
page int 1 页码 yes
id string b1e91cb9-597cc-a5d25c339a99 通话记录的id no
levels array [[0, 100], [100, 500]] 评分等级对应的评分区间 no
keyword string 18651683344 被叫号码 no
bills array [0, 200] 通话时间(秒) no
rounds array [0, 5] 交互次数 no
tags array [1bcecc13-e873-499c-913c-d9246a898180] 标签的id no
start_at string 2019-05-23 23:59:59 开始时间 no
end_at string 2019-05-23 23:59:59 结束时间 no
  1. 返回
{
    "data": [{ // 通话记录列表
    "tags": [ // 本次通话被打上的子标签列表
      {
        "id": "ee109a20-6b98-4463-94fe-ea730e2188c7", // 子标签id
        "name": "脏话", // 子标签名称
        "description": "脏话",
        "color": "#2d8cf0", // 子标签颜色
        "user_id": "4d99d91c-f5d9-49da-88da-758977cc58a9",
        "status": true, // 子标签状态
        "created_at": "2020-03-06 21:55:56",
        "updated_at": "2020-03-06 21:55:56",
        "pivot": { // 子标签 - 母标签 的关联关系记录
          "taggable_id": "80599bfe-7027-412f-adec-1f24075219ca",
          "tag_id": "ee109a20-6b98-4463-94fe-ea730e2188c7",
          "created_at": "2020-03-06 22:32:37",
          "updated_at": "2020-03-06 22:32:37"
        },
        "tag_groups": [ // 此标签属于的母标签
          {
            "id": "fbe408c5-f77f-49cd-9bd1-85ca0b434bcc",
            "user_id": "4d99d91c-f5d9-49da-88da-758977cc58a9",
            "name": "无意向",
            "created_at": "2020-03-06 21:54:58",
            "updated_at": "2020-03-06 21:54:58",
            "tag_scene_id": "a13ad9cb-d9be-4498-bfe3-cd32c677f0dd" // 母标签属于的业务场景
          }
        ]
      }
    ],
    "tag_groups": [ // 命中的母标签列表
      {
        "id": "f7eba8dd-3721-4e15-b197-6b0c16639eec",
        "user_id": "4d99d91c-f5d9-49da-88da-758977cc58a9",
        "name": "有意向",
        "created_at": "2020-03-06 21:54:51",
        "updated_at": "2020-03-06 21:54:51",
        "tag_scene_id": "a13ad9cb-d9be-4498-bfe3-cd32c677f0dd"
      },
      {
        "id": "f7eba8dd-3721-4e15-b197-6b0c16639eec",
        "user_id": "4d99d91c-f5d9-49da-88da-758977cc58a9",
        "name": "有意向",
        "created_at": "2020-03-06 21:54:51",
        "updated_at": "2020-03-06 21:54:51",
        "tag_scene_id": "a13ad9cb-d9be-4498-bfe3-cd32c677f0dd",
      },
      {
        "id": "fbe408c5-f77f-49cd-9bd1-85ca0b434bcc",
        "user_id": "4d99d91c-f5d9-49da-88da-758977cc58a9",
        "name": "无意向",
        "created_at": "2020-03-06 21:54:58",
        "updated_at": "2020-03-06 21:54:58",
        "tag_scene_id": "a13ad9cb-d9be-4498-bfe3-cd32c677f0dd"
      },
    ],
    "operator_name": "联通", // 运营商
        "id": "6d44d2f4-90f9-4621-8c77-e5e70c810623", // 本次通话记录的id
        "task_id": "234cdcac-501c-47b5-9c06-47a658f363b8",// 任务id
        "group_id": 299, // 话术组id
        "callid": "d6a577d4-7180-11e9-80bd-7fed30fcff3f",
        "score": 0, // 通话得分
        "callee": "18810495721", // 被叫号码
        "caller_number": "300708", // 主叫号码
        "duration": 60080,
        "error_code": 0,
        "gender": 1, // 性别
        "level_id": "e605e0b0-96b2-4af0-9b78-7cdd5fc6b783",
        "calldate": "2019-05-08 19:02:58",
        "bill": 31319, // 通话时间ms
        "hangupcause": "NORMAL_CLEARING",
        "hangupdate": "2019-05-08 19:03:58",
        "answerdate": "2019-05-08 19:03:26",
        "recordfile": "/mnt/smartivr/recordings/2019-05-08/18810495721.299.19-03-27.d6a577d4-7180-11e9-80bd-7fed30fcff3f.wav", // 全程通话录音在硬盘里的位置
        "bridge_callid": null,
        "bridge_number": null,
        "bridge_calldate": null,
        "bridge_answerdate": null,
        "hangup_disposition": 1, // 挂断方
        "created_at": "2019-05-08 19:03:27",
        "updated_at": "2019-05-08 19:03:59",
        "rounds": 0, // 通话轮数
        "level_name": "D级(无意向)",
        "bredge_number": null,
    "read_at": "2020-03-06 23:06:46", // 查看时间
    "province_id": 3, // 省id
    "city_id": 12, // 市id
    "operator": 2, // 运营商
        "level": { // score对应评分等级
            "id": "e605e0b0-96b2-4af0-9b78-7cdd5fc6b783",
            "name": "D级",
            "alias": "无意向",
            "color": "#000"
        },
        "gender_str": "未知", // 性别
        "hangup_disposition_str": "AI", // 挂断方

        "city": { // 被叫号码的归属地
      id: 12
      pid: 3
      city: "南京"
      area_code: "025"
      post_code: "210000"
      created_at: "2019-05-09 09:08:45"
      updated_at: "2019-05-09 09:08:45"
    },
        "province": {// 被叫号码的归属地
      "id": 3,
      "pid": null,
      "city": "江苏",
      "area_code": "0519",
      "post_code": "213000",
      "created_at": "2019-05-09 09:08:45",
      "updated_at": "2019-05-09 09:08:45"
    }, 
    }],
    "total": 1, // 总计多少条数据
    "last_page": 1 // 总计多少页(每页15条)
}

字段说明 1.评分等级需要自己请求,接口在其他中; 2.标签需要自己请求,接口在其他中;


某任务的电话号码

接口:GET v1/task/number
  1. params
参数 类型 示例 解释 required
task_id string 1bcecc13-e873-4910-913c-d9246a891280 外呼任务的id yes
page int 1 页码 yes
status array [0 ,1] 号码的状态 no
keyword string 18651683344 被叫号码 no
type array ['lt', 'dx', 'yd'] 运营商 no
call_history int 1 是否要呼叫记录[不传或者传0为不要] No

status:

0等待呼叫、1呼叫成功、2线路故障、3拒接、4无应答/无人接听、5空号、6关机、7停机、8占线/用户正忙、9呼入限制、10欠费、11黑名单、12呼损

  1. 返回
{
    "code": 200,
    "status": "ok",
    "message": "获取号码列表成功",
    "data": {
        "data": [
            {
              "number": "18651683344", // 被叫号码
              "city": "南京", // 号码地区
              "pro": "江苏", // 号码地区
              "mobile_type": "联通", // 号码运营商
              "area_code": "025",
              "post_code": "210000",
              "id": 1691,
              "status_str": "呼叫成功", // 被叫号码状态
              "callid": "90a48ed3-a5f6-4904-b1f3-a9ec883b069f",
              "calldate": "2020-03-06 23:04:37",
              "bill": 26638,
              "duration": 35639,
              "hangupcause": "NORMAL_CLEARING",
              "hangupdate": "2020-03-06 23:05:12",
              "answerdate": "2020-03-06 23:04:46",
              "is_blacklist": false, // 是否在黑名单中
              "status": 1, // 被叫号码状态
              "call_history": [ // 呼叫记录,call_history不传或者为0没有这个字段
                {
                  "id": 356036, // auto_call_histories表里对应的id
                  "user_id": "4d99d91c-f5d9-49da-88da-758977cc58a9",
                  "task_id": "772dd881-dcf7-42ee-a32b-b40a0ee5afb7", // 任务id
                  "call_id": "90a48ed3-a5f6-4904-b1f3-a9ec883b069f",
                  "number_id": 1691,
                  "number": "18651683344",
                  "call_time": "2020-03-06 23:04:37", // 呼叫时间
                  "duration": 35639,
                  "hangup_cause": "NORMAL_CLEARING",
                  "hangup_code": "200",
                  "bill": 26638,
                  "call_status": "answer",
                  "status": 1, // 呼叫状态
                  "record_file": "/mnt/smartivr/recordings/2020-03-06/18651683344.90a48ed3-a5f6-4904-b1f3-a9ec883b069f.wav", // 全程录音地址,没接通为null
                  "calling_number": "17361984317",
                  "province_id": 3,
                  "city_id": 12,
                  "operator": 2,
                  "created_at": "2020-03-06 23:05:14",
                  "updated_at": "2020-03-06 23:05:14",
                  "status_str": "呼叫成功",
                },
                {
                  "id": 354060,
                  "user_id": "4d99d91c-f5d9-49da-88da-758977cc58a9",
                  "task_id": "772dd881-dcf7-42ee-a32b-b40a0ee5afb7",
                  "call_id": "1569523c-d3d3-48fd-97a0-ad88d6606a19",
                  "number_id": 1691,
                  "number": "18651683344",
                  "call_time": "2020-03-04 20:50:36",
                  "duration": 13339,
                  "hangup_cause": "NORMAL_CLEARING",
                  "hangup_code": null,
                  "bill": 0,
                  "call_status": "busy now",
                  "status": 8,
                  "record_file": null,
                  "calling_number": "17361984317",
                  "province_id": 3,
                  "city_id": 12,
                  "operator": 2,
                  "created_at": "2020-03-04 20:50:50",
                  "updated_at": "2020-03-04 20:50:50",
                  "status_str": "占线、用户正忙",
                }
              ]
            }
        ],
        "total": 1, // 总计多少条数据
        "last_page": 1 // 总计多少页(每页15条)
    }
}

查询某通通话简要信息【可用来查询任务ID】

接口:GET v1/record/{record_id}

返回

{
    "code": 200,
    "status": "ok",
    "message": "获取任务信息成功",
    "data": {
        "id": "b1e91cb9-5994-47cc-a5df-25c3e8439a99",
        "task_id": "d77d6f95-0e40-46d4-8bda-30343411da47",
        "group_id": 297,
        "callid": "eb9464a2-adf2-4621-9157-64892e86e273",
        "score": 165,
        "callee": "18906023250",
        "caller_number": "17368464879",
        "duration": 58999,
        "error_code": 0,
        "gender": 2,
        "level_id": "d968d649-fe6f-425f-a3d4-aa800b8740ba",
        "calldate": "2020-02-22 15:16:56",
        "bill": 48079,
        "hangupcause": "NORMAL_CLEARING",
        "hangupdate": "2020-02-22 15:17:55",
        "answerdate": "2020-02-22 15:17:07",
        "recordfile": "/mnt/smartivr/recordings/2020-02-22/18906023250.eb9464a2-adf2-4621-9157-64892e86e273.wav",
        "bridge_callid": null,
        "bridge_number": null,
        "bridge_calldate": null,
        "bridge_answerdate": null,
        "hangup_disposition": 2,
        "created_at": "2020-02-22 15:17:07",
        "updated_at": "2020-03-02 16:08:51",
        "rounds": 12,
        "level_name": "C级(可再次跟进)",
        "bredge_number": null,
        "read_at": "2020-03-02 16:08:51",
        "province_id": 0,
        "city_id": 0,
        "operator": 0,
        "gender_str": "男",
        "hangup_disposition_str": "客户"
    }
}

某通话记录的详情

接口:GET /v1/task/record_info/{task_id}/{record_id}
  1. 返回
    {
    "records": [{ // 主要通话内容
        "id": "1c1ba3e3-83a4-4b7d-91b3-006abd3ff7bd",
        "record_id": "9c736f53-0c1b-4047-b30a-dd87d2968541",
        "task_id": "840a4346-d0ac-4800-9c73-3d06275a9158",
        "notify": "enter", // 需要过滤掉'notify'为'asrprogress_notify'的 
        "callid": "281db55e-64e8-11e9-9bb2-3564eb72c846",
        "error_code": 0,
        "asrtype": null,
        "callee": "18651683344",
        "gender": null, // 性别
        "asr_elapse": null,
        "record_ms": null,
        "volume_gain": null,
        "question": "", // 用户说的话
        "question_index": 0,
        "speak_ms": 0,
        "play_ms": 0,
        "keyword": "",
        "answer_id": "e0b4bfc6-e87d-4e1f-af24-d44c10a5bd0a",
        "answer_text": "流程1",
        "word_class": "16",
        "score": 0, // 此次通话的得分
        "sequence": 1,
        "created_at": "2019-04-22 18:19:55",
        "updated_at": "2019-04-22 18:19:55",
        "bridge_status": null,
        "answer_content": "同学,您好,我是沪江网校的工作人员,来电是因为了解到您之前关注过英文学习方面,想借用您几分钟时间做个简单的小回访,希望在英文学习上给您带来帮助\n普通文本,没有变量\n罗文龙先生", // 话术包含的内容(会转化姓名等变量),机器人说的话(一般显示这个就可以了)
        "contents": [{ // 设计话术的原始数组
            "id": "d2b32d5d-4b05-4b51-91ae-40da779123ab",
            "file_id": "bf4d6a59-1a37-4ad8-a616-edcc5a9fd813", // 上传录音的ID
            "sort": 0, // 在当前话术里的排序
            "status": true, // 是否启用
            "translate_text": "同学,您好,我是沪江网校的工作人员,来电是因为了解到您之前关注过英文学习方面,想借用您几分钟时间做个简单的小回访,希望在英文学习上给您带来帮助",
            "wav_second": 15 // 录音长度(秒)
        }],
        "tags": [ // 此轮对话被贴上的标签
      {
        "id": "4c318fbd-834f-4b41-bfbe-a631e5422812", // 标签id
        "name": "承认发布", // 标签名称
        "description": "承认发布", // 标签描述
        "color": "#2DF0D0", // 标签颜色
        "user_id": "6cd3c09b-926d-4282-9470-946cd336e44a",
        "status": true,
        "created_at": "2020-01-16 11:07:13",
        "updated_at": "2020-01-17 11:13:46",
        "pivot": {
          "taggable_id": "1336fc81-9f19-4d64-890f-9aaa5f70b52e",
          "tag_id": "4c318fbd-834f-4b41-bfbe-a631e5422812",
          "created_at": "2020-02-16 12:21:17",
          "updated_at": "2020-02-16 12:21:17"
        },
        "tag_group": [ // 所属母标签列表
          { 
            "id": 1, // 母标签id
            "user_id": "6cd3c09b-926d-4282-9470-946cd336e44a",
            "name": "弱意向", // 母标签名
            "created_at": "2019-12-17 21:14:57",
            "updated_at": "2019-12-17 21:14:57",
            "tag_scene_id": "ad2c92fe-f993-47d6-9e86-f73a5511dcae" // 业务场景id
          },
        ]
      }
    ] // 触发的标签
    }, {
        "id": "e68f7a65-f98e-4c12-ab1c-a8bc2071b02f", // 通话记录详情的ID,一个通话记录包含多个通话详情
        "record_id": "9c736f53-0c1b-4047-b30a-dd87d2968541", // 通话记录的ID
        "task_id": "840a4346-d0ac-4800-9c73-3d06275a9158",
        "notify": "asrprogress_notify", // 此类型为过程性录音,不需要展示
        "callid": "281db55e-64e8-11e9-9bb2-3564eb72c846",
        "error_code": 0,
        "asrtype": "aliyun", // 使用的asr引擎
        "callee": "18651683344", // 被叫号码
        "gender": 2,
        "asr_elapse": 841,
        "record_ms": 1690,
        "volume_gain": 8.040982,
        "question": "啊", // 接听人说的话
        "question_index": 1,
        "speak_ms": 0,
        "play_ms": 740,
        "keyword": null, // 接听人触发的关键词
        "answer_id": null,
        "answer_text": null,
        "word_class": null,
        "score": 0, // 这轮通话的得分
        "sequence": 2,
        "created_at": "2019-04-22 18:19:58",
        "updated_at": "2019-04-22 18:19:58",
        "bridge_status": null, // 是否是转接后,1是转接后,null为不是
        "answer_content": null,
        "contents": [],
        "tags": []
    }, {
        "id": "8a6436b0-5b41-4dc8-bb4d-7e5451ecf5eb",
        "record_id": "9c736f53-0c1b-4047-b30a-dd87d2968541",
        "task_id": "840a4346-d0ac-4800-9c73-3d06275a9158",
        "notify": "asrmessage_notify",
        "callid": "281db55e-64e8-11e9-9bb2-3564eb72c846",
        "error_code": 0,
        "asrtype": null,
        "callee": "18651683344",
        "gender": null,
        "asr_elapse": null,
        "record_ms": null,
        "volume_gain": null,
        "question": "啊",
        "question_index": 1,
        "speak_ms": 875,
        "play_ms": 740,
        "keyword": null,
        "answer_id": null,
        "answer_text": null,
        "word_class": null,
        "score": 0,
        "sequence": 3,
        "created_at": "2019-04-22 18:19:58",
        "updated_at": "2019-04-22 18:19:58",
        "bridge_status": null,
        "answer_content": null,
        "contents": [],
        "tags": []
    }, {
        "id": "8a0b22f8-a5d2-4fbf-9297-5c79da0dd82d",
        "record_id": "9c736f53-0c1b-4047-b30a-dd87d2968541",
        "task_id": "840a4346-d0ac-4800-9c73-3d06275a9158",
        "notify": "asrprogress_notify",
        "callid": "281db55e-64e8-11e9-9bb2-3564eb72c846",
        "error_code": 0,
        "asrtype": "aliyun",
        "callee": "18651683344",
        "gender": 2,
        "asr_elapse": 909,
        "record_ms": 2210,
        "volume_gain": 6.721436,
        "question": "不再见,再见。",
        "question_index": 2,
        "speak_ms": 0,
        "play_ms": 3280,
        "keyword": null,
        "answer_id": null,
        "answer_text": null,
        "word_class": null,
        "score": 0,
        "sequence": 4,
        "created_at": "2019-04-22 18:20:01",
        "updated_at": "2019-04-22 18:20:01",
        "bridge_status": null,
        "answer_content": null,
        "contents": [],
        "tags": []
    }, {
        "id": "118d691e-5a80-42f2-8ad8-40e34bc9b321",
        "record_id": "9c736f53-0c1b-4047-b30a-dd87d2968541",
        "task_id": "840a4346-d0ac-4800-9c73-3d06275a9158",
        "notify": "asrmessage_notify",
        "callid": "281db55e-64e8-11e9-9bb2-3564eb72c846",
        "error_code": 0,
        "asrtype": null,
        "callee": "18651683344",
        "gender": null,
        "asr_elapse": null,
        "record_ms": null,
        "volume_gain": null,
        "question": "不再见,再见。",
        "question_index": 2,
        "speak_ms": 1395,
        "play_ms": 3280,
        "keyword": "再见",
        "answer_id": "15d1230b-9820-4662-9aa2-e2003176efb0",
        "answer_text": "普适结束语",
        "word_class": "1",
        "score": 0,
        "sequence": 5,
        "created_at": "2019-04-22 18:20:02",
        "updated_at": "2019-04-22 18:20:02",
        "bridge_status": null,
        "answer_content": "感谢您的接听,我就打扰您了,祝您生活愉快,再见",
        "contents": [{
            "id": "591c75c5-bba3-428a-940a-1828d68695bd",
            "file_id": "6e1c0b72-407e-499f-9474-88aaa32f45ac",
            "sort": 0,
            "status": true,
            "translate_text": "感谢您的接听,我就打扰您了,祝您生活愉快,再见",
            "wav_second": 3.577875
        }],
        "tags": []
    }],
    "is_intervene_bridge": false, // 是否被转接
    "is_intervene_hangup": false, // 是否被强制挂断
    "intervene_number": [{ // 可转接号码
        "id": 2,
        "name": "罗文龙",
        "number": "18651683***"
    }, {
        "id": 5,
        "name": "wjx",
        "number": "18262625***"
    }, {
        "id": 6,
        "name": "test",
        "number": "18751553***"
    }],
    "is_crm_exists": true, // 是否在CRM中存在此号码的数据
    "info": {
        "record": { // 整通通话详情
            "id": "9c736f53-0c1b-4047-b30a-dd87d2968541",
            "task_id": "840a4346-d0ac-4800-9c73-3d06275a9158", // 所在任务 
            "group_id": 297, // 使用话术分组
            "callid": "281db55e-64e8-11e9-9bb2-3564eb72c846",
            "score": 0, // 总体得分
            "callee": "18651683344", // 被叫号码
            "caller_number": "17361984317",
            "duration": 17600,
            "error_code": 0,
            "gender": 2, // 性别0未知、1女、2男、3疑似女、4疑似男
            "level_id": "e605e0b0-96b2-4af0-9b78-7cdd5fc6b783",
            "calldate": "2019-04-22 18:19:47",
            "bill": 10120, // 通话时长ms
            "hangupcause": "NORMAL_CLEARING",
            "hangupdate": "2019-04-22 18:20:05",
            "answerdate": "2019-04-22 18:19:55",
            "recordfile": "/mnt/smartivr/recordings/2019-04-22/18651683344.297.18-19-55.281db55e-64e8-11e9-9bb2-3564eb72c846.wav",
            "bridge_callid": null,
            "bridge_number": null,
            "bridge_calldate": null,
            "bridge_answerdate": null,
            "hangup_disposition": 1, //谁先挂断电话,机器人1,客户2
            "created_at": "2019-04-22 18:19:55",
            "updated_at": "2019-04-22 18:20:07",
            "rounds": 2, // 进行了几轮对话
            "level_name": "D级(无意向)", // 等级名称
            "bredge_number": null,
            "gender_str": "男",  // 性别
            "hangup_disposition_str": "AI", //谁先挂断电话
            "level": { // 对应等级
                "id": "e605e0b0-96b2-4af0-9b78-7cdd5fc6b783",
                "name": "D级",
                "alias": "无意向",
                "color": "#000"
            },
            "crm_number": {
                "id": "61d03681-04a2-4a81-97e9-f37825dfbfe9",
                "user_id": "4d99d91c-f5d9-49da-88da-758977cc58a9",
                "number": "18651683344",
                "deleted_at": null,
                "created_at": "2019-04-10 19:24:05",
                "updated_at": "2019-04-10 19:24:05"
            }
        },
        "task": { // 所在任务详情
            "uuid": "840a4346-d0ac-4800-9c73-3d06275a9158",
            "name": "教育测试2",
            "create_datetime": "2018-12-20 16:43:21",
            "alter_datetime": "2019-05-15 19:25:06",
            "start": 0,
            "maximumcall": 1,
            "call_per_second": 10,
            "recycle_limit": 1,
            "random_assignment_number": 0,
            "disable_dial_timegroup": null,
            "destination_extension": 297,
            "destination_dialplan": "XML",
            "destination_context": "default",
            "scheduling_policy_ratio": null,
            "scheduling_queue": null,
            "dial_format": "",
            "domain": null,
            "remark": null,
            "sort": 2,
            "originate_variables": "{execute_on_media=start_da2}",
            "_originate_timeout": 60,
            "_origination_caller_id_number": "300708",
            "user_id": "4d99d91c-f5d9-49da-88da-758977cc58a9",
            "caller_line_id": null,
            "customer_service_id": null,
            "call_notify_url": "http://127.0.0.1:81/api/hangup_notify",
            "call_notify_type": 2,
            "start_str": "暂停",
            "group_str": "沪江网校测试",
            "progress_bar": { // 任务进度 [弃用]
                "total": 3,
                "progress": 3,
                "percent": 100
            },
            "group": {
                "id": 297,
                "name": "沪江网校测试",
                "user_id": "4d99d91c-f5d9-49da-88da-758977cc58a9",
                "debug": false,
                "deleted_at": null,
                "created_at": "2018-12-15 18:46:41",
                "updated_at": "2019-04-08 17:09:43",
        "link_word_group_id": "1",
        "tag_scene_id": "a13ad9cb-d9be-4498-bfe3-cd32c677f0dd",
                "default": false
            }
        }
    },
    "mobile_info": { // 电话归属地等信息
        "mobile_type": "联通",
        "province": "江苏",
        "city": "南京"
    },
    "utterances": [{ // 使用话术组所有主流程
        "id": "01f0a962-bee2-4456-a0f0-93725642f746",
        "name": "流程2",
        "description": "客户身份确认",
        "group_id": 297,
        "user_id": "4d99d91c-f5d9-49da-88da-758977cc58a9",
        "context_id": null,
        "priority": 2,
        "action": null,
        "word_class": 16,
        "wait": 4000,
        "retry": 0,
        "max_retry": 0,
        "score": 0,
        "play_ms": 3000,
        "enquire": true,
        "customer_service_id": null,
        "identify_type": 4,
        "deleted_at": null,
        "created_at": "2018-12-15 18:50:04",
        "updated_at": "2018-12-15 18:50:04",
        "background_file_id": null,
        "block_asr": 0,
        "word_class_str": "主流程",
        "action_str": ""
    }, {
        "id": "146e883b-24b0-4125-bb8c-99d0413f612b",
        "name": "流程5",
        "description": "上课准备",
        "group_id": 297,
        "user_id": "4d99d91c-f5d9-49da-88da-758977cc58a9",
        "context_id": null,
        "priority": 10,
        "action": null,
        "word_class": 16,
        "wait": 4000,
        "retry": 0,
        "max_retry": 0,
        "score": 50,
        "play_ms": 3000,
        "enquire": true,
        "customer_service_id": null,
        "identify_type": 4,
        "deleted_at": null,
        "created_at": "2018-12-15 18:52:11",
        "updated_at": "2018-12-15 18:52:11",
        "background_file_id": null,
        "block_asr": 0,
        "word_class_str": "主流程",
        "action_str": ""
    }, {
        "id": "4f9455ec-3e8b-40e2-a6bc-2fb01d2e2e74",
        "name": "流程4",
        "description": "活动邀约",
        "group_id": 297,
        "user_id": "4d99d91c-f5d9-49da-88da-758977cc58a9",
        "context_id": null,
        "priority": 4,
        "action": null,
        "word_class": 16,
        "wait": 4000,
        "retry": 0,
        "max_retry": 0,
        "score": 50,
        "play_ms": 3000,
        "enquire": true,
        "customer_service_id": null,
        "identify_type": 4,
        "deleted_at": null,
        "created_at": "2018-12-15 18:51:37",
        "updated_at": "2018-12-15 18:51:37",
        "background_file_id": null,
        "block_asr": 0,
        "word_class_str": "主流程",
        "action_str": ""
    }, {
        "id": "67f21076-0c67-43d9-b366-e509fd4f076e",
        "name": "流程6",
        "description": "结束通知",
        "group_id": 297,
        "user_id": "4d99d91c-f5d9-49da-88da-758977cc58a9",
        "context_id": null,
        "priority": 10,
        "action": null,
        "word_class": 16,
        "wait": 4000,
        "retry": 0,
        "max_retry": 0,
        "score": 100,
        "play_ms": 3000,
        "enquire": true,
        "customer_service_id": null,
        "identify_type": 4,
        "deleted_at": null,
        "created_at": "2018-12-15 18:52:58",
        "updated_at": "2018-12-15 18:52:58",
        "background_file_id": null,
        "block_asr": 0,
        "word_class_str": "主流程",
        "action_str": ""
    }, {
        "id": "a4c1aed5-f28d-4fe8-bdb2-70c29acdac3e",
        "name": "流程3",
        "description": "客户需求确认",
        "group_id": 297,
        "user_id": "4d99d91c-f5d9-49da-88da-758977cc58a9",
        "context_id": null,
        "priority": 3,
        "action": null,
        "word_class": 16,
        "wait": 4000,
        "retry": 0,
        "max_retry": 0,
        "score": 0,
        "play_ms": 3000,
        "enquire": true,
        "customer_service_id": null,
        "identify_type": 4,
        "deleted_at": null,
        "created_at": "2018-12-15 18:50:56",
        "updated_at": "2018-12-15 18:50:56",
        "background_file_id": null,
        "block_asr": 0,
        "word_class_str": "主流程",
        "action_str": ""
    }, {
        "id": "e0b4bfc6-e87d-4e1f-af24-d44c10a5bd0a",
        "name": "流程1",
        "description": "开场白",
        "group_id": 297,
        "user_id": "4d99d91c-f5d9-49da-88da-758977cc58a9",
        "context_id": null,
        "priority": 1,
        "action": null,
        "word_class": 16,
        "wait": 4000,
        "retry": 0,
        "max_retry": 0,
        "score": 0,
        "play_ms": -1,
        "enquire": true,
        "customer_service_id": null,
        "identify_type": 4,
        "deleted_at": null,
        "created_at": "2018-12-15 18:49:32",
        "updated_at": "2018-12-15 18:49:32",
        "background_file_id": null,
        "block_asr": 0,
        "word_class_str": "主流程",
        "action_str": ""
    }]
    }

部分字段解释

  1. info.record整端通话的相关数据
  2. info.task通话所在任务的相关数据
  3. intervene_number、is_crm_exists、is_intervene_bridge、is_intervene_hangup用不到
  4. mobile_info手机所在区域、运营商
  5. records每句通话的记录
  6. utterances话术所有主流程

CRM相关

公海导入模板

接口: GET /v1/crm/create

  1. 返回
    {
    "code": 200,
    "status": "ok",
    "message": "返回创建公海数据成功",
    "data": [
        {
            "id": "ca092ab6-02a6-4fe4-8c5e-a85c8380c152",
            "name": "姓名",
            "type": "text",
            "sort": 0,
            "validate": [
                "required"
            ]
        },
        {
            "id": "a53f6b24-6ae3-4aa4-97dc-f69f01b1dae0",
            "name": "文本1",
            "type": "text",
            "sort": 1,
            "validate": []
        },
        {
            "id": "8109ee83-f583-491e-8080-eb5b34a4b573",
            "name": "年龄",
            "type": "number",
            "sort": 2,
            "validate": [
                "required",
                "integer"
            ]
        }
    ]
    }

公海导入

接口:POST /v1/crm

  1. data
    [
    {
        "phone": "14012121211",
        "sort": "2",
        "components": [
            {
                "id": "ca092ab6-02a6-4fe4-8c5e-a85c8380c152",
                "value": "小牛"
            },
            {
                "id": "8109ee83-f583-491e-8080-eb5b34a4b573",
                "value": "17"
            }
        ]
    },
    {
        "phone": "14012121212",
        "sort": "2",
        "components": [
            {
                "id": "ca092ab6-02a6-4fe4-8c5e-a85c8380c152",
                "value": "小张"
            }
        ]
    },
    {
        "phone": "14012121213",
        "sort": "2"
    }
    ]

返回

{
    "code": 200,
    "status": "ok",
    "message": "创建公海成功",
    "data": {
        "crmCustomerCount": 10
    }
}

返回说明


其他

获取已配置的评分等级

接口:GET /v1/setting/record_level

  1. 返回
[{
    "id": "04751d00-aaec-4cfe-bdf5-713c6e2c9c47",
    "name": "A级", // 名称
    "alias": "非常有意向", // 别名
    "color": "#ED3F14", // 颜色
    "score_min": 500, // 最小分数
    "score_max": 10000, // 最大分数
    "status": true, // 可用状态
    "user_id": "4d99d91c-f5d9-49da-88da-758977cc58a9",
    "created_at": "2018-10-03 09:55:18",
    "updated_at": "2019-04-02 15:24:46"
}]

获取可用的标签

接口:GET /v1/tag/usable_tags

1.返回

{
    "data": [{
        "id": "6367a34d-7a1d-41db-b36a-1c8d1b9c84ed",
        "name": "要买", // 名称
        "description": "想买", // 描述
        "color": "#F0D12D", // 颜色
        "status": true, // 状态
        "status_str": "正常",
        "created_at": "2019-04-30 16:36:38",
        "updated_at": "2019-04-30 16:36:38",
    "tag_group": [ // 所属母标签
      {
        "id": "f7eba8dd-3721-4e15-b197-6b0c16639eec",
        "user_id": "4d99d91c-f5d9-49da-88da-758977cc58a9",
        "name": "有意向", // 母标签名称
        "created_at": "2020-03-06 21:54:51",
        "updated_at": "2020-03-06 21:54:51",
        "tag_scene_id": "a13ad9cb-d9be-4498-bfe3-cd32c677f0dd", // 业务场景id
        "tag_scene": { // 母标签所属业务场景
          "id": "a13ad9cb-d9be-4498-bfe3-cd32c677f0dd", // 业务场景id
          "name": "水果销售", // 业务场景名称
          "description": "水果销售",
          "user_id": "4d99d91c-f5d9-49da-88da-758977cc58a9",
          "created_at": "2020-03-06 21:54:43",
          "updated_at": "2020-03-06 21:54:43"
        }
      }
    ]
    }]
}

获取话术分组

接口:GET /v1/outbound/group

  1. 返回
{
    "data": [{ // 任务列表
        "id": 390,
        "name": "测试话术【复制】",
        "user_id": "4d99d91c-f5d9-49da-88da-758977cc58a9",
        "debug": true, // 是否开启调试模式,开启后全部话术走tts
        "deleted_at": null,
        "created_at": "2019-02-24 14:24:23",
        "updated_at": "2019-02-24 14:24:23",
        "link_word_group_id": "1", // 使用的衔接词id
    "tag_scene_id": "ad2c92fe-f993-47d6-9e86-f73a5511dcae", // 使用的业务场景
    "tag_scene": {
      "id": "ad2c92fe-f993-47d6-9e86-f73a5511dcae",
      "name": "房产销售",
      "description": "房产销售",
      "user_id": "4d99d91c-f5d9-49da-88da-758977cc58a9",
      "created_at": "2020-03-06 22:31:51",
      "updated_at": "2020-03-06 22:31:51"
    },
    "default": false, // 是否是默认话术组
    "correction_categories": [], // 使用的纠错词典
    "link_word_group": { // 使用的衔接词
      "id": 1,
      "name": "测试衔接词",
      "description": "测试衔接词",
      "status": true,
      "user_id": "4d99d91c-f5d9-49da-88da-758977cc58a9",
      "created_at": "2019-12-12 22:15:20",
      "updated_at": "2019-12-12 22:15:20"
    },
    "has_label": true // 是否含有话术
    }],
    "links": {
        "first": "https://saas.telrobot.top/member/outbound/group?page=1",
        "last": "https://saas.telrobot.top/member/outbound/group?page=2",
        "prev": null,
        "next": "https://saas.telrobot.top/member/outbound/group?page=2"
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "https://saas.telrobot.top/member/outbound/group",
        "per_page": "15",
        "to": 15,
        "total": 1
    }
}

部分字段解释

  1. debug是否开启调试模式,开启的话,所有文字都走tts

获取客服组列表

接口:GET /v1/customer/service

  1. 返回
[{
    "id": 21,
    "user_id": "4d99d91c-f5d9-49da-88da-758977cc58a9",
    "name": "组2",
    "created_at": "2019-05-10 16:03:09",
    "updated_at": "2019-05-15 18:01:40",
    "caller_line_id": "37d73edf-4628-4cf1-8beb-758433fd0aab", // 使用的转接线路,只能不为null的
    "status": 1 // 是否可用,必须选为1的
}, {
    "id": 3,
    "user_id": "4d99d91c-f5d9-49da-88da-758977cc58a9",
    "name": "客服一组",
    "created_at": "2018-12-16 20:51:26",
    "updated_at": "2019-03-12 20:16:03",
    "caller_line_id": null,
    "status": 1
}]

部分字段解释

  1. status,该客服组是否可用,只能选择可用的客服组