文档

可视对讲服务API

更新时间:
一键部署

1. 概述

可视门禁对讲服务,临时访客可通过云对讲呼叫业主:业主可通过室内机、手机APP或电话与访客做双向语音对讲并开门。

2. 接口定义

2.1 SIP服务器管理

2.1.1 查询服务器列表

路径

/entrance/paas/sipserver/query

版本号

1.0.0

协议

HTTPS

请求方法

POST

授权类型

app签名

超时时间

10000

请求参数:无

返回数据

名称

类型

描述

code

Int

接口返回码。200表示成功。

message

String

调用失败时,返回的出错信息。

localizedMsg

String

本地语言的错误消息。

data

JSON

SIP服务器列表。

SIP服务器列表 data:

名称

类型

描述

serverId

String

服务器id。

hostIp

String

服务器IP地址。

示例

请求示例:

// https://github.com/aliyun/iotx-api-gateway-client
IoTApiClientBuilderParams ioTApiClientBuilderParams = new IoTApiClientBuilderParams();

ioTApiClientBuilderParams.setAppKey("你的<AppKey>");
ioTApiClientBuilderParams.setAppSecret("你的<AppSecret>");

SyncApiClient syncApiClient = new SyncApiClient(ioTApiClientBuilderParams);

IoTApiRequest request = new IoTApiRequest();

// 设置请求ID
String uuid = UUID.randomUUID().toString();
String id = uuid.replace("-", "");
request.setId(id);
// 设置API版本号
request.setApiVer("1.0.0");
// 设置参数
// 无参数
// 如果需要,设置headers
Map<String, String> headers = new HashMap<String, String>(8);
// headers.put("你的<header", "你的<value>");

// 设置请求参数域名、path、request , isHttps, headers
ApiResponse response = syncApiClient.postBody("api.link.aliyun.com", "/entrance/paas/sipserver/query", request, true, headers);

System.out.println(
    "response code = " + response.getCode()
        + " response = " + new String(response.getBody(), "UTF-8")
        + " headers = " + response.getHeaders().toString()
);

正常返回示例:

{
    "id": "4de2c367-c1db-417c-aa15-8c585e595d92",
    "code": 200,
    "message": null,
    "localizedMsg": null,
    "data": {
      [
      {
        "serverId": "xxx",
        "hostIp": "1.1.XX.XX"
      },
      {
        "serverId": "xxx",
        "hostIp": "1.1.XX.XX"
      }
      ]
    }
}

异常返回示例:

{
    "id": "37f7e5fa-d6a5-4efe-8abf-5bf23dca6284",
    "code": 403,
    "message": "request forbidden.",
    "localizedMsg": "请求被禁止",
    "data": null
}

2.1.2 绑定服务器

注:不同服务器下创建的sip账号不能互通

路径

/entrance/paas/sipserver/bind

版本号

1.0.0

协议

HTTPS

请求方法

POST

授权类型

app签名

超时时间

10000

请求参数

名称

类型

是否必选

描述

serverId

String

服务器id

返回数据

名称

类型

描述

code

Int

接口返回码。200表示成功。

message

String

调用失败时,返回的出错信息。

localizedMsg

String

本地语言的错误消息。

示例

请求示例:

// https://github.com/aliyun/iotx-api-gateway-client
IoTApiClientBuilderParams ioTApiClientBuilderParams = new IoTApiClientBuilderParams();

ioTApiClientBuilderParams.setAppKey("你的<AppKey>");
ioTApiClientBuilderParams.setAppSecret("你的<AppSecret>");

SyncApiClient syncApiClient = new SyncApiClient(ioTApiClientBuilderParams);

IoTApiRequest request = new IoTApiRequest();

// 设置请求ID
String uuid = UUID.randomUUID().toString();
String id = uuid.replace("-", "");
request.setId(id);
// 设置API版本号
request.setApiVer("1.0.0");
// 设置参数
request.putParam("serverId","value1");
// 如果需要,设置headers
Map<String, String> headers = new HashMap<String, String>(8);
// headers.put("你的<header", "你的<value>");

// 设置请求参数域名、path、request , isHttps, headers
ApiResponse response = syncApiClient.postBody("api.link.aliyun.com", "/entrance/paas/sipserver/bind", request, true, headers);

System.out.println(
    "response code = " + response.getCode()
        + " response = " + new String(response.getBody(), "UTF-8")
        + " headers = " + response.getHeaders().toString()
);

正常返回示例:

{
    "id": "4de2c367-c1db-417c-aa15-8c585e595d92",
    "code": 200,
    "message": null,
    "localizedMsg": null
}

异常返回示例:

{
    "id": "37f7e5fa-d6a5-4efe-8abf-5bf23dca6284",
    "code": 403,
    "message": "request forbidden.",
    "localizedMsg": "请求被禁止",
    "data": null
}

2.2 SIP管理

2.2.1 创建SIP账号

需要指定type,1为门禁对讲机类型,用于门禁对讲机,当一路APP正在调看门禁对讲机时,若发起第二路APP调看,则会加入会话,可以实现多个APP同时调看同一台门禁对讲机;0为APP类型,用于APP,当SIP号在通话时,则无法接入。

路径

/entrance/paas/sipservice/sip/add

版本号

1.0.0

协议

HTTPS

请求方法

POST

授权类型

app签名

超时时间

10000

请求参数

名称

类型

是否必选

描述

count

Integer

创建数量,最⼤100。

type

Integer

类型,0 - APP, 1 - ⻔禁机。

返回数据

名称

类型

描述

code

Int

接口返回码。200表示成功。

message

String

调用失败时,返回的出错信息。

localizedMsg

String

本地语言的错误消息。

data

JSON

响应结果。

响应结果 data:

名称

类型

描述

sipNumber

String

SIP号,⻓度不超过50个字符。

sipPassword

String

SIP密码,⻓度不超过50个字符。

sipHost

String

SIP服务器地址。

sipPort

Integer

SIP服务器端⼝。

type

Integer

类型,0 - APP, 1 - ⻔禁机。

createTime

Long

创建时间戳(单位毫秒)。

示例

请求示例:

// https://github.com/aliyun/iotx-api-gateway-client
IoTApiClientBuilderParams ioTApiClientBuilderParams = new IoTApiClientBuilderParams();

ioTApiClientBuilderParams.setAppKey("你的<AppKey>");
ioTApiClientBuilderParams.setAppSecret("你的<AppSecret>");

SyncApiClient syncApiClient = new SyncApiClient(ioTApiClientBuilderParams);

IoTApiRequest request = new IoTApiRequest();

// 设置请求ID
String uuid = UUID.randomUUID().toString();
String id = uuid.replace("-", "");
request.setId(id);
// 设置API版本号
request.setApiVer("1.0.0");
// 如果需要登录,设置当前的会话的token,token通过登录api获取
request.setIotToken("你的<IoTToken>");
// 设置参数
request.putParam("count","value1");
request.putParam("type","value2");
// 如果需要,设置headers
Map<String, String> headers = new HashMap<String, String>(8);
// headers.put("你的<header", "你的<value>");

// 设置请求参数域名、path、request , isHttps, headers
ApiResponse response = syncApiClient.postBody("api.link.aliyun.com", "/entrance/paas/sipservice/sip/add", request, true, headers);

System.out.println(
    "response code = " + response.getCode()
        + " response = " + new String(response.getBody(), "UTF-8")
        + " headers = " + response.getHeaders().toString()
);

正常返回示例:

{
    "id": "4de2c367-c1db-417c-aa15-8c585e595d92",
    "code": 200,
    "message": null,
    "localizedMsg": null,
    "data": [
    {
      "sipNumber": "obog97v34g",
      "sipPassword": "o3****",
      "sipHost": "sip.iot.aliyun.com",
      "sipPort": 6050,
      "type": 1,
      "createTime":1577085030000
    }
  ]
}

异常返回示例:

{
    "id": "37f7e5fa-d6a5-4efe-8abf-5bf23dca6284",
    "code": 403,
    "message": "request forbidden.",
    "localizedMsg": "请求被禁止",
    "data": null
}

2.2.2 删除SIP账号

路径

/entrance/paas/sipservice/sip/delete

版本号

1.0.0

协议

HTTPS

请求方法

POST

授权类型

app签名

超时时间

10000

请求参数

名称

类型

是否必选

描述

sipNumberList

JASONArray<String>

待删除SIP号列表。

返回数据

名称

类型

描述

code

Int

接口返回码。200表示成功。

message

String

调用失败时,返回的出错信息。

localizedMsg

String

本地语言的错误消息。

示例

请求示例:

// https://github.com/aliyun/iotx-api-gateway-client
IoTApiClientBuilderParams ioTApiClientBuilderParams = new IoTApiClientBuilderParams();

ioTApiClientBuilderParams.setAppKey("你的<AppKey>");
ioTApiClientBuilderParams.setAppSecret("你的<AppSecret>");

SyncApiClient syncApiClient = new SyncApiClient(ioTApiClientBuilderParams);

IoTApiRequest request = new IoTApiRequest();

// 设置请求ID
String uuid = UUID.randomUUID().toString();
String id = uuid.replace("-", "");
request.setId(id);
// 设置API版本号
request.setApiVer("1.0.0");
// 如果需要登录,设置当前的会话的token,token通过登录api获取
request.setIotToken("你的<IoTToken>");
// 设置参数
request.putParam("sipNumberList","value1");
// 如果需要,设置headers
Map<String, String> headers = new HashMap<String, String>(8);
// headers.put("你的<header", "你的<value>");

// 设置请求参数域名、path、request , isHttps, headers
ApiResponse response = syncApiClient.postBody("api.link.aliyun.com", "/entrance/paas/sipservice/sip/delete", request, true, headers);

System.out.println(
    "response code = " + response.getCode()
        + " response = " + new String(response.getBody(), "UTF-8")
        + " headers = " + response.getHeaders().toString()
);

正常返回示例:

{
    "id": "4de2c367-c1db-417c-aa15-8c585e595d92",
    "code": 200,
    "message": null,
    "localizedMsg": null
}

异常返回示例:

{
    "id": "37f7e5fa-d6a5-4efe-8abf-5bf23dca6284",
    "code": 403,
    "message": "request forbidden.",
    "localizedMsg": "请求被禁止",
    "data": null
}

2.2.3 查询SIP账号详情

路径

/entrance/paas/sipservice/sip/detail/get

版本号

1.0.0

协议

HTTPS

请求方法

POST

授权类型

app签名

超时时间

10000

请求参数

名称

类型

是否必选

描述

sipNumber

String

SIP号

返回数据

名称

类型

描述

code

Int

接口返回码。200表示成功。

message

String

调用失败时,返回的出错信息。

localizedMsg

String

本地语言的错误消息。

data

JSON

响应结果。

响应结果 data:

名称

类型

描述

sipNumber

String

SIP号,⻓度不超过50个字符。

sipPassword

String

SIP密码,⻓度不超过50个字符。

sipHost

String

SIP服务器地址。

sipPort

Integer

SIP服务器端⼝。

type

Integer

类型,0 - APP, 1 - ⻔禁机。

createTime

Long

创建时间戳(单位毫秒)。

示例

请求示例:

// https://github.com/aliyun/iotx-api-gateway-client
IoTApiClientBuilderParams ioTApiClientBuilderParams = new IoTApiClientBuilderParams();

ioTApiClientBuilderParams.setAppKey("你的<AppKey>");
ioTApiClientBuilderParams.setAppSecret("你的<AppSecret>");

SyncApiClient syncApiClient = new SyncApiClient(ioTApiClientBuilderParams);

IoTApiRequest request = new IoTApiRequest();

// 设置请求ID
String uuid = UUID.randomUUID().toString();
String id = uuid.replace("-", "");
request.setId(id);
// 设置API版本号
request.setApiVer("1.0.0");
// 如果需要登录,设置当前的会话的token,token通过登录api获取
request.setIotToken("你的<IoTToken>");
// 设置参数
request.putParam("sipNumber","value1");
// 如果需要,设置headers
Map<String, String> headers = new HashMap<String, String>(8);
// headers.put("你的<header", "你的<value>");

// 设置请求参数域名、path、request , isHttps, headers
ApiResponse response = syncApiClient.postBody("api.link.aliyun.com", "/entrance/paas/sipservice/sip/detail/get", request, true, headers);

System.out.println(
    "response code = " + response.getCode()
        + " response = " + new String(response.getBody(), "UTF-8")
        + " headers = " + response.getHeaders().toString()
);

正常返回示例:

{
    "id": "4de2c367-c1db-417c-aa15-8c585e595d92",
    "code": 200,
    "message": null,
    "localizedMsg": null,
    "data": {
    "sipNumber": "obog97v34g",
    "sipPassword": "o3****",
    "sipHost": "sip.iot.aliyun.com",
    "sipPort": 6050,
    "type": 1,
    "createTime":1577085030000    
  }
}

异常返回示例:

{
    "id": "37f7e5fa-d6a5-4efe-8abf-5bf23dca6284",
    "code": 403,
    "message": "request forbidden.",
    "localizedMsg": "请求被禁止",
    "data": null
}

若返回错误为SYS_0002,表示SIP号⽆效或不存在。

2.2.4 更新SIP账号密码

⽬前⼀个SIP账号同时只允许在⼀个客户端登录,因此针对可能在多端同时登录的SIP账号,请在登录SIP账号前,调⽤该接⼝更新密码,并返回新密码,则之前的旧密码失效。

路径

/entrance/paas/sipservice/sip/password/update

版本号

1.0.0

协议

HTTPS

请求方法

POST

授权类型

app签名

超时时间

10000

请求参数

名称

类型

是否必选

描述

sipNumber

String

SIP号

返回数据

名称

类型

描述

code

Int

接口返回码。200表示成功。

message

String

调用失败时,返回的出错信息。

localizedMsg

String

本地语言的错误消息。

data

JSON

响应结果。

响应结果 data:

名称

类型

描述

sipPassword

String

SIP密码,⻓度不超过50个字符。

示例

请求示例:

// https://github.com/aliyun/iotx-api-gateway-client
IoTApiClientBuilderParams ioTApiClientBuilderParams = new IoTApiClientBuilderParams();

ioTApiClientBuilderParams.setAppKey("你的<AppKey>");
ioTApiClientBuilderParams.setAppSecret("你的<AppSecret>");

SyncApiClient syncApiClient = new SyncApiClient(ioTApiClientBuilderParams);

IoTApiRequest request = new IoTApiRequest();

// 设置请求ID
String uuid = UUID.randomUUID().toString();
String id = uuid.replace("-", "");
request.setId(id);
// 设置API版本号
request.setApiVer("1.0.0");
// 如果需要登录,设置当前的会话的token,token通过登录api获取
request.setIotToken("你的<IoTToken>");
// 设置参数
request.putParam("sipNumber","value1");
// 如果需要,设置headers
Map<String, String> headers = new HashMap<String, String>(8);
// headers.put("你的<header", "你的<value>");

// 设置请求参数域名、path、request , isHttps, headers
ApiResponse response = syncApiClient.postBody("api.link.aliyun.com", "/entrance/paas/sipservice/sip/password/update", request, true, headers);

System.out.println(
    "response code = " + response.getCode()
        + " response = " + new String(response.getBody(), "UTF-8")
        + " headers = " + response.getHeaders().toString()
);

正常返回示例:

{
    "id": "4de2c367-c1db-417c-aa15-8c585e595d92",
    "code": 200,
    "message": null,
    "localizedMsg": null,
    "data": {
        "sipPassword": "1234****"   
    }
}

异常返回示例:

{
    "id": "37f7e5fa-d6a5-4efe-8abf-5bf23dca6284",
    "code": 403,
    "message": "request forbidden.",
    "localizedMsg": "请求被禁止",
    "data": null
}

2.2.5 创建SIP组

路径

/entrance/paas/sipservice/group/add

版本号

1.0.0

协议

HTTPS

请求方法

POST

授权类型

app签名

超时时间

10000

请求参数

名称

类型

是否必选

描述

count

Integer

创建数量,最⼤100。

返回数据

名称

类型

描述

code

Int

接口返回码。200表示成功。

message

String

调用失败时,返回的出错信息。

localizedMsg

String

本地语言的错误消息。

data

JSON

响应结果。

响应结果 data:

名称

类型

描述

groupID

String

SIP组ID,⻓度不超过50个字符。

createTime

Long

创建时间戳(单位毫秒)。

示例

请求示例:

// https://github.com/aliyun/iotx-api-gateway-client
IoTApiClientBuilderParams ioTApiClientBuilderParams = new IoTApiClientBuilderParams();

ioTApiClientBuilderParams.setAppKey("你的<AppKey>");
ioTApiClientBuilderParams.setAppSecret("你的<AppSecret>");

SyncApiClient syncApiClient = new SyncApiClient(ioTApiClientBuilderParams);

IoTApiRequest request = new IoTApiRequest();

// 设置请求ID
String uuid = UUID.randomUUID().toString();
String id = uuid.replace("-", "");
request.setId(id);
// 设置API版本号
request.setApiVer("1.0.0");
// 如果需要登录,设置当前的会话的token,token通过登录api获取
request.setIotToken("你的<IoTToken>");
// 设置参数
request.putParam("count","value1");
// 如果需要,设置headers
Map<String, String> headers = new HashMap<String, String>(8);
// headers.put("你的<header", "你的<value>");

// 设置请求参数域名、path、request , isHttps, headers
ApiResponse response = syncApiClient.postBody("api.link.aliyun.com", "/entrance/paas/sipservice/group/add", request, true, headers);

System.out.println(
    "response code = " + response.getCode()
        + " response = " + new String(response.getBody(), "UTF-8")
        + " headers = " + response.getHeaders().toString()
);

正常返回示例:

{
    "id": "4de2c367-c1db-417c-aa15-8c585e595d92",
    "code": 200,
    "message": null,
    "localizedMsg": null,
    "data": [
      {
      "groupID": "obog97****",
      "createTime":1577085030000
      },
      {
      "groupID": "abcg97****",
      "createTime":1577085030000
      }    
    ]
}

异常返回示例:

{
    "id": "37f7e5fa-d6a5-4efe-8abf-5bf23dca6284",
    "code": 403,
    "message": "request forbidden.",
    "localizedMsg": "请求被禁止",
    "data": null
}

2.2.6 删除SIP组

路径

/entrance/paas/sipservice/group/delete

版本号

1.0.0

协议

HTTPS

请求方法

POST

授权类型

app签名

超时时间

10000

请求参数

名称

类型

是否必选

描述

groupList

JASONArray<String>

待删除SIP组号列表。

返回数据

名称

类型

描述

code

Int

接口返回码。200表示成功。

message

String

调用失败时,返回的出错信息。

localizedMsg

String

本地语言的错误消息。

示例

请求示例:

// https://github.com/aliyun/iotx-api-gateway-client
IoTApiClientBuilderParams ioTApiClientBuilderParams = new IoTApiClientBuilderParams();

ioTApiClientBuilderParams.setAppKey("你的<AppKey>");
ioTApiClientBuilderParams.setAppSecret("你的<AppSecret>");

SyncApiClient syncApiClient = new SyncApiClient(ioTApiClientBuilderParams);

IoTApiRequest request = new IoTApiRequest();

// 设置请求ID
String uuid = UUID.randomUUID().toString();
String id = uuid.replace("-", "");
request.setId(id);
// 设置API版本号
request.setApiVer("1.0.0");
// 如果需要登录,设置当前的会话的token,token通过登录api获取
request.setIotToken("你的<IoTToken>");
// 设置参数
request.putParam("groupList","value1");
// 如果需要,设置headers
Map<String, String> headers = new HashMap<String, String>(8);
// headers.put("你的<header", "你的<value>");

// 设置请求参数域名、path、request , isHttps, headers
ApiResponse response = syncApiClient.postBody("api.link.aliyun.com", "/entrance/paas/sipservice/group/delete", request, true, headers);

System.out.println(
    "response code = " + response.getCode()
        + " response = " + new String(response.getBody(), "UTF-8")
        + " headers = " + response.getHeaders().toString()
);

正常返回示例:

{
    "id": "4de2c367-c1db-417c-aa15-8c585e595d92",
    "code": 200,
    "message": null,
    "localizedMsg": null
}

异常返回示例:

{
    "id": "37f7e5fa-d6a5-4efe-8abf-5bf23dca6284",
    "code": 403,
    "message": "request forbidden.",
    "localizedMsg": "请求被禁止",
    "data": null
}

2.2.7 SIP账号分组

只有SIP账号type为0,即APP端使⽤的SIP账号,才能⽀持分组。

路径

/entrance/paas/sipservice/group/sip/add

版本号

1.0.0

协议

HTTPS

请求方法

POST

授权类型

app签名

超时时间

10000

请求参数

名称

类型

是否必选

描述

groupID

String

SIP组ID。

sipNumberList

JASONArray<String>

SIP号列表。

返回数据

名称

类型

描述

code

Int

接口返回码。200表示成功。

message

String

调用失败时,返回的出错信息。

localizedMsg

String

本地语言的错误消息。

示例

请求示例:

// https://github.com/aliyun/iotx-api-gateway-client
IoTApiClientBuilderParams ioTApiClientBuilderParams = new IoTApiClientBuilderParams();

ioTApiClientBuilderParams.setAppKey("你的<AppKey>");
ioTApiClientBuilderParams.setAppSecret("你的<AppSecret>");

SyncApiClient syncApiClient = new SyncApiClient(ioTApiClientBuilderParams);

IoTApiRequest request = new IoTApiRequest();

// 设置请求ID
String uuid = UUID.randomUUID().toString();
String id = uuid.replace("-", "");
request.setId(id);
// 设置API版本号
request.setApiVer("1.0.0");
// 如果需要登录,设置当前的会话的token,token通过登录api获取
request.setIotToken("你的<IoTToken>");
// 设置参数
request.putParam("groupID","value1");
request.putParam("sipNumberList","value2");
// 如果需要,设置headers
Map<String, String> headers = new HashMap<String, String>(8);
// headers.put("你的<header", "你的<value>");

// 设置请求参数域名、path、request , isHttps, headers
ApiResponse response = syncApiClient.postBody("api.link.aliyun.com", "/entrance/paas/sipservice/group/sip/add", request, true, headers);

System.out.println(
    "response code = " + response.getCode()
        + " response = " + new String(response.getBody(), "UTF-8")
        + " headers = " + response.getHeaders().toString()
);

正常返回示例:

{
    "id": "4de2c367-c1db-417c-aa15-8c585e595d92",
    "code": 200,
    "message": null,
    "localizedMsg": null
}

异常返回示例:

{
    "id": "37f7e5fa-d6a5-4efe-8abf-5bf23dca6284",
    "code": 403,
    "message": "request forbidden.",
    "localizedMsg": "请求被禁止",
    "data": null
}

2.2.8 SIP账号从组⾥移除

路径

/entrance/paas/sipservice/group/sip/delete

版本号

1.0.0

协议

HTTPS

请求方法

POST

授权类型

app签名

超时时间

10000

请求参数

名称

类型

是否必选

描述

groupID

String

SIP组ID。

sipNumberList

JASONArray<String>

SIP号列表。

返回数据

名称

类型

描述

code

Int

接口返回码。200表示成功。

message

String

调用失败时,返回的出错信息。

localizedMsg

String

本地语言的错误消息。

示例

请求示例:

// https://github.com/aliyun/iotx-api-gateway-client
IoTApiClientBuilderParams ioTApiClientBuilderParams = new IoTApiClientBuilderParams();

ioTApiClientBuilderParams.setAppKey("你的<AppKey>");
ioTApiClientBuilderParams.setAppSecret("你的<AppSecret>");

SyncApiClient syncApiClient = new SyncApiClient(ioTApiClientBuilderParams);

IoTApiRequest request = new IoTApiRequest();

// 设置请求ID
String uuid = UUID.randomUUID().toString();
String id = uuid.replace("-", "");
request.setId(id);
// 设置API版本号
request.setApiVer("1.0.0");
// 如果需要登录,设置当前的会话的token,token通过登录api获取
request.setIotToken("你的<IoTToken>");
// 设置参数
request.putParam("groupID","value1");
request.putParam("sipNumberList","value2");
// 如果需要,设置headers
Map<String, String> headers = new HashMap<String, String>(8);
// headers.put("你的<header", "你的<value>");

// 设置请求参数域名、path、request , isHttps, headers
ApiResponse response = syncApiClient.postBody("api.link.aliyun.com", "/entrance/paas/sipservice/group/sip/delete", request, true, headers);

System.out.println(
    "response code = " + response.getCode()
        + " response = " + new String(response.getBody(), "UTF-8")
        + " headers = " + response.getHeaders().toString()
);

正常返回示例:

{
    "id": "4de2c367-c1db-417c-aa15-8c585e595d92",
    "code": 200,
    "message": null,
    "localizedMsg": null
}

异常返回示例:

{
    "id": "37f7e5fa-d6a5-4efe-8abf-5bf23dca6284",
    "code": 403,
    "message": "request forbidden.",
    "localizedMsg": "请求被禁止",
    "data": null
}

2.2.9 查看组下SIP账号列表

路径

/entrance/paas/sipservice/group/sip/list

版本号

1.0.0

协议

HTTPS

请求方法

POST

授权类型

app签名

超时时间

10000

请求参数

名称

类型

是否必选

描述

groupID

String

SIP组ID。

返回数据

名称

类型

描述

code

Int

接口返回码。200表示成功。

message

String

调用失败时,返回的出错信息。

localizedMsg

String

本地语言的错误消息。

data

JSON

响应结果。

响应结果 data:

名称

类型

描述

sipNumber

String

SIP号,⻓度不超过50个字符。

sipPassword

String

SIP密码,⻓度不超过50个字符。

sipHost

String

SIP服务器地址。

sipPort

Integer

SIP服务器端⼝。

type

Integer

类型,0 - APP, 1 - ⻔禁机。

createTime

Long

创建时间戳(单位毫秒)。

示例

请求示例:

// https://github.com/aliyun/iotx-api-gateway-client
IoTApiClientBuilderParams ioTApiClientBuilderParams = new IoTApiClientBuilderParams();

ioTApiClientBuilderParams.setAppKey("你的<AppKey>");
ioTApiClientBuilderParams.setAppSecret("你的<AppSecret>");

SyncApiClient syncApiClient = new SyncApiClient(ioTApiClientBuilderParams);

IoTApiRequest request = new IoTApiRequest();

// 设置请求ID
String uuid = UUID.randomUUID().toString();
String id = uuid.replace("-", "");
request.setId(id);
// 设置API版本号
request.setApiVer("1.0.0");
// 如果需要登录,设置当前的会话的token,token通过登录api获取
request.setIotToken("你的<IoTToken>");
// 设置参数
request.putParam("groupID","value1");
// 如果需要,设置headers
Map<String, String> headers = new HashMap<String, String>(8);
// headers.put("你的<header", "你的<value>");

// 设置请求参数域名、path、request , isHttps, headers
ApiResponse response = syncApiClient.postBody("api.link.aliyun.com", "/entrance/paas/sipservice/group/sip/list", request, true, headers);

System.out.println(
    "response code = " + response.getCode()
        + " response = " + new String(response.getBody(), "UTF-8")
        + " headers = " + response.getHeaders().toString()
);

正常返回示例:

{
    "id": "4de2c367-c1db-417c-aa15-8c585e595d92",
    "code": 200,
    "message": null,
    "localizedMsg": null,
    "data": [{
      "sipNumber": "obog97v34g",
      "sipPassword": "o3****",
      "sipHost": "sip.iot.aliyun.com",
      "serverPort": 6050,
      "type": 0,
      "createTime":1577085030000
    },
    {
      "sipNumber": "tb2yz0ca17",
      "sipPassword": "p1****",
      "sipHost": "sip.iot.aliyun.com",
      "serverPort": 6050,
      "type": 0,
      "createTime":1577085030000
    }]
}

异常返回示例:

{
    "id": "37f7e5fa-d6a5-4efe-8abf-5bf23dca6284",
    "code": 403,
    "message": "request forbidden.",
    "localizedMsg": "请求被禁止",
    "data": null
}

2.3 门禁对讲机SIP同步

2.3.1 颁发门禁对讲机SIP Number

路径

/entrance/paas/videointercom/sipnumber/sync

版本号

1.0.0

协议

HTTPS

请求方法

POST

授权类型

app签名

超时时间

10000

请求参数

名称

类型

是否必选

描述

iotId

String

门禁对讲机iotId。

sipNumber

String

SIP Number。

password

String

SIP密码。

host

String

SIP服务器地址。

port

String

SIP服务器端口。

返回数据

名称

类型

描述

code

Int

接口返回码。200表示成功。

message

String

调用失败时,返回的出错信息。

localizedMsg

String

本地语言的错误消息。

示例

请求示例:

// https://github.com/aliyun/iotx-api-gateway-client
IoTApiClientBuilderParams ioTApiClientBuilderParams = new IoTApiClientBuilderParams();

ioTApiClientBuilderParams.setAppKey("你的<AppKey>");
ioTApiClientBuilderParams.setAppSecret("你的<AppSecret>");

SyncApiClient syncApiClient = new SyncApiClient(ioTApiClientBuilderParams);

IoTApiRequest request = new IoTApiRequest();

// 设置请求ID
String uuid = UUID.randomUUID().toString();
String id = uuid.replace("-", "");
request.setId(id);
// 设置API版本号
request.setApiVer("1.0.0");
// 如果需要登录,设置当前的会话的token,token通过登录api获取
request.setIotToken("你的<IoTToken>");
// 设置参数
request.putParam("iotId","value1");
request.putParam("sipNumber","value2");
request.putParam("host","value3");
request.putParam("port","value4");
request.putParam("password","value5");
// 如果需要,设置headers
Map<String, String> headers = new HashMap<String, String>(8);
// headers.put("你的<header", "你的<value>");

// 设置请求参数域名、path、request , isHttps, headers
ApiResponse response = syncApiClient.postBody("api.link.aliyun.com", "/entrance/paas/videointercom/sipnumber/sync", request, true, headers);

System.out.println(
    "response code = " + response.getCode()
        + " response = " + new String(response.getBody(), "UTF-8")
        + " headers = " + response.getHeaders().toString()
);

正常返回示例:

{
    "id": "4de2c367-c1db-417c-aa15-8c585e595d92",
    "code": 200,
    "message": null,
    "localizedMsg": null
}

异常返回示例:

{
    "id": "37f7e5fa-d6a5-4efe-8abf-5bf23dca6284",
    "code": 403,
    "message": "request forbidden.",
    "localizedMsg": "请求被禁止",
    "data": null
}

2.3.2 查询门禁对讲机SIP Number

路径

/entrance/paas/videointercom/sipnumber/get

版本号

1.0.0

协议

HTTPS

请求方法

POST

授权类型

app签名

超时时间

10000

请求参数

名称

类型

是否必选

描述

iotId

String

门禁对讲机iotId。

返回数据

名称

类型

描述

code

Int

接口返回码。200表示成功。

message

String

调用失败时,返回的出错信息。

localizedMsg

String

本地语言的错误消息。

data

JSON

响应结果。

响应结果 data:

名称

类型

描述

sipNumber

String

SIP Number。

host

String

SIP服务器地址。

port

String

SIP服务器端口。

示例

请求示例:

// https://github.com/aliyun/iotx-api-gateway-client
IoTApiClientBuilderParams ioTApiClientBuilderParams = new IoTApiClientBuilderParams();

ioTApiClientBuilderParams.setAppKey("你的<AppKey>");
ioTApiClientBuilderParams.setAppSecret("你的<AppSecret>");

SyncApiClient syncApiClient = new SyncApiClient(ioTApiClientBuilderParams);

IoTApiRequest request = new IoTApiRequest();

// 设置请求ID
String uuid = UUID.randomUUID().toString();
String id = uuid.replace("-", "");
request.setId(id);
// 设置API版本号
request.setApiVer("1.0.0");
// 如果需要登录,设置当前的会话的token,token通过登录api获取
request.setIotToken("你的<IoTToken>");
// 设置参数
request.putParam("iotId","value1");
// 如果需要,设置headers
Map<String, String> headers = new HashMap<String, String>(8);
// headers.put("你的<header", "你的<value>");

// 设置请求参数域名、path、request , isHttps, headers
ApiResponse response = syncApiClient.postBody("api.link.aliyun.com", "/entrance/paas/videointercom/sipnumber/get", request, true, headers);

System.out.println(
    "response code = " + response.getCode()
        + " response = " + new String(response.getBody(), "UTF-8")
        + " headers = " + response.getHeaders().toString()
);

正常返回示例:

{
    "id": "4de2c367-c1db-417c-aa15-8c585e595d92",
    "code": 200,
    "message": null,
    "localizedMsg": null,
    "data": {
      "sipNumber": "xxx",
       "host": "x.x.x.x",
       "port": "8080"
 }
}

异常返回示例:

{
    "id": "37f7e5fa-d6a5-4efe-8abf-5bf23dca6284",
    "code": 403,
    "message": "request forbidden.",
    "localizedMsg": "请求被禁止",
    "data": null
}

2.4 SIP组与房间映射

2.4.1 添加SIP组与房间编号映射关系

路径

/entrance/paas/videointercom/map/add

版本号

1.0.0

协议

HTTPS

请求方法

POST

授权类型

app签名

超时时间

10000

请求参数

名称

类型

是否必选

描述

iotId

String

门禁对讲机iotId。

maps

JSONArray

映射关系列表。

映射关系列表 maps:

名称

类型

是否必选

描述

roomId

String

房间ID。

规则:期号-楼幢号-单元号-房号

例如:

1-9-3-1202

1-10-3A-1709

1-5-767-801

最大位数:1位-3位-4位-5位,规则数字+字母。

期号默认为1。

groupId

String

SIP组ID。

返回数据

名称

类型

描述

code

Int

接口返回码。200表示成功。

message

String

调用失败时,返回的出错信息。

localizedMsg

String

本地语言的错误消息。

示例

请求示例:

// https://github.com/aliyun/iotx-api-gateway-client
IoTApiClientBuilderParams ioTApiClientBuilderParams = new IoTApiClientBuilderParams();

ioTApiClientBuilderParams.setAppKey("你的<AppKey>");
ioTApiClientBuilderParams.setAppSecret("你的<AppSecret>");

SyncApiClient syncApiClient = new SyncApiClient(ioTApiClientBuilderParams);

IoTApiRequest request = new IoTApiRequest();

// 设置请求ID
String uuid = UUID.randomUUID().toString();
String id = uuid.replace("-", "");
request.setId(id);
// 设置API版本号
request.setApiVer("1.0.0");
// 如果需要登录,设置当前的会话的token,token通过登录api获取
request.setIotToken("你的<IoTToken>");
// 设置参数
request.putParam("iotId","value1");
request.putParam("maps","value2");
// 如果需要,设置headers
Map<String, String> headers = new HashMap<String, String>(8);
// headers.put("你的<header", "你的<value>");

// 设置请求参数域名、path、request , isHttps, headers
ApiResponse response = syncApiClient.postBody("api.link.aliyun.com", "/entrance/paas/videointercom/map/add", request, true, headers);

System.out.println(
    "response code = " + response.getCode()
        + " response = " + new String(response.getBody(), "UTF-8")
        + " headers = " + response.getHeaders().toString()
);

正常返回示例:

{
    "id": "4de2c367-c1db-417c-aa15-8c585e595d92",
    "code": 200,
    "message": null,
    "localizedMsg": null
}

异常返回示例:

{
    "id": "37f7e5fa-d6a5-4efe-8abf-5bf23dca6284",
    "code": 403,
    "message": "request forbidden.",
    "localizedMsg": "请求被禁止",
    "data": null
}

2.4.2 删除SIP组与房间编号映射关系

路径

/entrance/paas/videointercom/map/delete

版本号

1.0.0

协议

HTTPS

请求方法

POST

授权类型

app签名

超时时间

10000

请求参数

名称

类型

是否必选

描述

iotId

String

门禁对讲机iotId。

maps

JSONArray

映射关系列表。

映射关系列表 maps:

名称

类型

是否必选

描述

roomId

String

房间ID

规则:期号-楼幢号-单元号-房号

例如:

1-9-3-1202

1-10-3A-1709

1-5-767-801

最大位数:1位-3位-4位-5位,规则数字+字母。

期号默认为1。

groupId

String

SIP组ID

返回数据

名称

类型

描述

code

Int

接口返回码。200表示成功。

message

String

调用失败时,返回的出错信息。

localizedMsg

String

本地语言的错误消息。

示例

请求示例:

// https://github.com/aliyun/iotx-api-gateway-client
IoTApiClientBuilderParams ioTApiClientBuilderParams = new IoTApiClientBuilderParams();

ioTApiClientBuilderParams.setAppKey("你的<AppKey>");
ioTApiClientBuilderParams.setAppSecret("你的<AppSecret>");

SyncApiClient syncApiClient = new SyncApiClient(ioTApiClientBuilderParams);

IoTApiRequest request = new IoTApiRequest();

// 设置请求ID
String uuid = UUID.randomUUID().toString();
String id = uuid.replace("-", "");
request.setId(id);
// 设置API版本号
request.setApiVer("1.0.0");
// 如果需要登录,设置当前的会话的token,token通过登录api获取
request.setIotToken("你的<IoTToken>");
// 设置参数
request.putParam("iotId","value1");
request.putParam("maps","value2");
// 如果需要,设置headers
Map<String, String> headers = new HashMap<String, String>(8);
// headers.put("你的<header", "你的<value>");

// 设置请求参数域名、path、request , isHttps, headers
ApiResponse response = syncApiClient.postBody("api.link.aliyun.com", "/entrance/paas/videointercom/map/delete", request, true, headers);

System.out.println(
    "response code = " + response.getCode()
        + " response = " + new String(response.getBody(), "UTF-8")
        + " headers = " + response.getHeaders().toString()
);

正常返回示例:

{
    "id": "4de2c367-c1db-417c-aa15-8c585e595d92",
    "code": 200,
    "message": null,
    "localizedMsg": null
}

异常返回示例:

{
    "id": "37f7e5fa-d6a5-4efe-8abf-5bf23dca6284",
    "code": 403,
    "message": "request forbidden.",
    "localizedMsg": "请求被禁止",
    "data": null
}

2.4.3 查询SIP组与房间编号映射关系

路径

/entrance/paas/videointercom/map/query

版本号

1.0.1

协议

HTTPS

请求方法

POST

授权类型

app签名

超时时间

10000

请求参数

名称

类型

是否必选

描述

iotId

String

门禁对讲机iotId。

roomId

String

房间ID

规则:期号-楼幢号-单元号-房号

例如:

1-9-3-1202

1-10-3A-1709

1-5-767-801

最大位数:1位-3位-4位-5位,规则数字+字母。

期号默认为1。

groupId

String

SIP组ID。

pageNo

Integer

请求的页码。

pageSize

Integer

每页的记录数。

返回数据

名称

类型

描述

code

Int

接口返回码。200表示成功。

message

String

调用失败时,返回的出错信息。

localizedMsg

String

本地语言的错误消息。

data

JSON

响应结果。

响应结果 data

名称

类型

描述

total

Integer

总数。

pageNo

Integer

页码。

pageSize

Integer

页码大小。

data

JSONArray

映射关系列表。

映射关系列表 data:

名称

类型

描述

roomId

String

房间ID。

groupId

String

SIP组ID。

示例

请求示例:

// https://github.com/aliyun/iotx-api-gateway-client
IoTApiClientBuilderParams ioTApiClientBuilderParams = new IoTApiClientBuilderParams();

ioTApiClientBuilderParams.setAppKey("你的<AppKey>");
ioTApiClientBuilderParams.setAppSecret("你的<AppSecret>");

SyncApiClient syncApiClient = new SyncApiClient(ioTApiClientBuilderParams);

IoTApiRequest request = new IoTApiRequest();

// 设置请求ID
String uuid = UUID.randomUUID().toString();
String id = uuid.replace("-", "");
request.setId(id);
// 设置API版本号
request.setApiVer("1.0.1");
// 如果需要登录,设置当前的会话的token,token通过登录api获取
request.setIotToken("你的<IoTToken>");
// 设置参数
request.putParam("iotId","value1");
request.putParam("roomId","value2");
request.putParam("groupId","value3");
request.putParam("pageNo","value4");
request.putParam("pageSize","value5");
// 如果需要,设置headers
Map<String, String> headers = new HashMap<String, String>(8);
// headers.put("你的<header", "你的<value>");

// 设置请求参数域名、path、request , isHttps, headers
ApiResponse response = syncApiClient.postBody("api.link.aliyun.com", "/entrance/paas/videointercom/map/query", request, true, headers);

System.out.println(
    "response code = " + response.getCode()
        + " response = " + new String(response.getBody(), "UTF-8")
        + " headers = " + response.getHeaders().toString()
);

正常返回示例:

{
    "id": "4de2c367-c1db-417c-aa15-8c585e595d92",
    "code": 200,
    "message": null,
    "localizedMsg": null,
    "data":{
        "total": 2,
        "pageNo": 1,
        "pageSize": 20,
     "data": [
            {
              "roomId": "room1",
              "groupId": "group1"
            },
            {
              "roomId": "room2",
              "groupId": "group2"      
            }
            ]
    }
}

异常返回示例:

{
    "id": "37f7e5fa-d6a5-4efe-8abf-5bf23dca6284",
    "code": 403,
    "message": "request forbidden.",
    "localizedMsg": "请求被禁止",
    "data": null
}

2.5 呼叫事件

2.5.1 SIP呼叫事件通知订阅

呼叫事件topic

/broadcast/%s/vinotify

请在阿里云账号控制台中获取aliyun UID。

数据格式

字段

类型

是否必传

备注

eventCode

String

事件编号,1:呼叫事件

eventTime

Long

事件发⽣时间戳,单位毫秒。

source

String

事件发起⽅,如呼叫事件,则为⻔禁机SIP号

targetType

String

⽬标类型,0 - SIP号;1 - SIP组。

target

String

事件⽬标⽅,如呼叫事件,则为组ID

样例:

{
  "eventCode": "xxx",
  "eventTime": 1577085030000,
  "source": "22222",
  "targetType": 1,
  "target": "11111"
}

数据订阅请参考第4节:业务数据订阅

3. 数据模型定义

模型ID:iot_entrance_videointercom_record_model

模型名称:可视对讲通行记录

模型版本:1.0

属性列表:

属性名称

属性标识符

数据类型

数据描述

必须

租户

tenantId

String

租户。

项目

projectId

String

项目ID。

事件时间

time

Date

事件时间。

IoT设备标示

iotId

String

门禁对讲机IoT设备标示,如果为固话对讲则为空。

productKey

productKey

String

productKey。

deviceName

deviceName

String

deviceName。

源类型

sourceType

String

0 - 云对讲。

1 - 固话对讲

事件信息

eventInfo

String

  • 类型为云对讲:

{
    "sipNumber":   "xxx",
    "groupId":   "xxx",
    "roomId":   "xxx"
}
  • 类型为固话对讲:

{
    "phone":   "xxx"
}

4 业务数据订阅

除了设备数据可以由平台订阅以外,一些预定义好的业务数据也可以通过HTTP/2通道流转到您的服务器。 image配置HTTP/2服务的订阅可以参考下面第5章的设备数据订阅服务中的操作步骤。

通用定义:

topic

业务消息以模块维度发布,在topic上以${subject}体现数据分类,payload中是消息详情。

/broadcast/${uid}/homelink/${subject}

通用消息体

参数

类型

含义

id

String

消息ID。

messageType

String

消息标题(类型)。

gmtCreate

Long

数据消息产生时间,自1970-1-1起流逝的毫秒值。

data

JSON

业务数据,见具体数据定义。

  • 本页导读 (0)
文档反馈