public final class YunTongXunRestAPI extends Object
| 限定符和类型 | 类和说明 |
|---|---|
(专用程序包) static class |
YunTongXunRestAPI.AccountType |
static class |
YunTongXunRestAPI.Builder
参数设置,初始化配置
|
| 限定符和类型 | 字段和说明 |
|---|---|
private String |
accountSid |
private String |
accountToken |
private String |
appId |
private String |
baseUrl |
private static okhttp3.OkHttpClient |
HTTP_CLIENT |
private static org.glamey.scaffold.json.JsonMapper |
JSON_MAPPER |
private static org.slf4j.Logger |
LOGGER |
private static okhttp3.MediaType |
MEDIA_TYPE_JSON |
private String |
subAccountSid |
private String |
subAccountToken |
private String |
timeStamp |
private String |
voipAccount |
private String |
voipToken |
| 限定符 | 构造器和说明 |
|---|---|
private |
YunTongXunRestAPI(YunTongXunRestAPI.Builder builder) |
| 限定符和类型 | 方法和说明 |
|---|---|
Map<String,Object> |
accountInfo()
主账户信息
|
private String |
buildBaseUrl(String function,
YunTongXunRestAPI.AccountType accountType)
构建请求URL
|
private okhttp3.Headers |
buildHeader(long bodySize,
YunTongXunRestAPI.AccountType accountType)
构建包含授权的请求头内容
|
Map<String,Object> |
callsCallback(String from,
String to,
String customerSerNum,
String fromSerNum,
String promptTone,
String alwaysPlay,
String terminalDtmf,
String userData,
String maxCallTime,
String hangupCdrUrl,
String needBothCdr,
String needRecord,
String countDownTime,
String countDownPrompt)
发送双向回拨请求
|
Map<String,Object> |
callsVoiceVerify(String mobile,
String verifyCode,
String displayNum,
String playTimes)
下发语音验证码
|
Map<String,Object> |
closeSubAccount(String subAccountSid)
关闭子账户
|
private Map<String,Object> |
doRequest(okhttp3.Request request,
String message)
数据请求及其处理
|
private okhttp3.Response |
httpExecute(okhttp3.Request request) |
Map<String,Object> |
querySubAccountByName(String friendlyName)
子账户信息查询
|
Map<String,Object> |
smsTemplateSMS(String[] mobiles,
String templateId,
String[] data)
下发模板短信
|
Map<String,Object> |
subAccounts(String friendlyName)
创建子账户
|
private static final org.slf4j.Logger LOGGER
private String baseUrl
private String accountSid
private String accountToken
private String subAccountSid
private String subAccountToken
private String voipAccount
private String voipToken
private String appId
private String timeStamp
private static final okhttp3.OkHttpClient HTTP_CLIENT
private static final org.glamey.scaffold.json.JsonMapper JSON_MAPPER
private static final okhttp3.MediaType MEDIA_TYPE_JSON
private YunTongXunRestAPI(YunTongXunRestAPI.Builder builder)
public final Map<String,Object> accountInfo() throws IOException
IOException - exceptionpublic final Map<String,Object> subAccounts(String friendlyName) throws IOException
friendlyName - friendlyNameIOException - IOExceptionpublic final Map<String,Object> closeSubAccount(String subAccountSid) throws IOException
subAccountSid - subAccountSidIOException - IOExceptionpublic final Map<String,Object> querySubAccountByName(String friendlyName) throws IOException
friendlyName - friendlyNameIOException - exceptionpublic final Map<String,Object> smsTemplateSMS(String[] mobiles, String templateId, String[] data) throws IOException
mobiles - the mobilestemplateId - templteIddata - dataIOException - exceptionpublic final Map<String,Object> callsVoiceVerify(String mobile, String verifyCode, String displayNum, String playTimes) throws IOException
mobile - mobileverifyCode - verify codedisplayNum - display numberplayTimes - play timesIOException - exceptionpublic final Map<String,Object> callsCallback(String from, String to, String customerSerNum, String fromSerNum, String promptTone, String alwaysPlay, String terminalDtmf, String userData, String maxCallTime, String hangupCdrUrl, String needBothCdr, String needRecord, String countDownTime, String countDownPrompt) throws IOException
from - 必选参数 主叫电话号码to - 必选参数 被叫电话号码customerSerNum - 可选参数 被叫侧显示的客服号码,根据平台侧显号规则控制fromSerNum - 可选参数 主叫侧显示的号码,根据平台侧显号规则控制promptTone - 可选参数 第三方自定义回拨提示音userData - 可选参数 第三方私有数据maxCallTime - 可选参数 最大通话时长hangupCdrUrl - 可选参数 实时话单通知地址alwaysPlay - 可选参数 是否一直播放提示音terminalDtmf - 可选参数 用于终止播放提示音的按键needBothCdr - 可选参数 是否给主被叫发送话单needRecord - 可选参数 是否录音countDownTime - 可选参数 设置倒计时时间countDownPrompt - 可选参数 到达倒计时时间播放的提示音IOException - exceptionprivate Map<String,Object> doRequest(okhttp3.Request request, String message) throws IOException
request - requestmessage - messageIOException - exceptionprivate okhttp3.Response httpExecute(okhttp3.Request request)
throws IOException
IOExceptionprivate okhttp3.Headers buildHeader(long bodySize,
YunTongXunRestAPI.AccountType accountType)
bodySize - the size of bodyaccountType - account typeprivate String buildBaseUrl(String function, YunTongXunRestAPI.AccountType accountType)
function - functionaccountType - account typeCopyright © 2016. All rights reserved.