本章节为您介绍了调用接口CancelCall取消点击呼叫接口ClickToDial发起的呼叫。
功能介绍
点击呼叫是指通过调用语音服务接口,通过语音服务分配的号码分别向主叫、被叫发起呼叫,双方接通后建立起正常通话,通话双方显示的号码均为语音服务平台号码。常用于企业办公电话等,例如钉钉办公电话。通过点击呼叫接口,可隐藏通话双方真实号码,同时平台可留存双方通话记录。
实现方法
调用该API实现取消点击呼叫功能之前,您需要成功调用ClickToDial实现点击呼叫,并获取CallId。
接口详情请参见CancelCall。
import com.aliyuncs.CommonRequest;
import com.aliyuncs.CommonResponse;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.exceptions.ServerException;
import com.aliyuncs.http.MethodType;
import com.aliyuncs.profile.DefaultProfile;
public class CancelCall {
public static void main(String[] args) {
DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou", "<accessKeyId>", "<accessSecret>");
IAcsClient client = new DefaultAcsClient(profile);
CommonRequest request = new CommonRequest();
request.setMethod(MethodType.POST);
request.setDomain("dyvmsapi.aliyuncs.com");
request.setVersion("2017-05-25");
request.setAction("CancelCall");
request.putQueryParameter("CallId", "117059405036^10385912xx");
try {
CommonResponse response = client.getCommonResponse(request);
System.out.println(response.getData());
} catch (ServerException e) {
e.printStackTrace();
} catch (ClientException e) {
e.printStackTrace();
}
}
}
正常返回结果如下所示:
{
"Status":"true",
"Message":"OK",
"RequestId":"D9CB3933-9FE3-4870-BA8E-2BEE91B69D23",
"Code":"OK"
}
调用SDK返回错误码,详情请参见错误码列表。
在文档使用中是否遇到以下问题
更多建议
匿名提交