AXN绑定接口(Axnbind)
步骤 1 创建阿里云账号
为了访问AXN隐私号服务,您需要有一个阿里云账号。如果没有,可首先按照如下步骤创建阿里云账号:
- 访问阿里云 官方网站,单击页面上的 免费注册 按钮。
- 按照屏幕提示完成注册流程并进行实名认证,AXN隐私号服务只支持实名认证用户使用。为了更好地使用阿里云服务,建议尽快完成实名认证,否则部分阿里云服务将无法使用。具体实名认证流程,请参考 这里。
步骤 2 获取阿里云访问密钥
为了使用AXN隐私号绑定API-.NET SDK,您必须申请阿里云的访问密钥。
阿里云访问秘钥是阿里云为用户使用 API(非控制台)来访问其云资源设计的“安全口令”。您可以用它来签名 API 请求内容以通过服务端的安全验证。
该访问秘钥成对(AccessKeyId 与 AccessKeySecret)生成和使用。每个阿里云用户可以创建多对访问秘钥,且可随时启用(Active)、禁用(Inactive)或者删除已经生成的访问秘钥对。
您可以通过阿里云控制台的
秘钥管理页面 创建、管理所有的访问秘钥对,且保证它处于“启用”状态。由于访问秘钥是阿里云对 API 请求进行安全验证的关键因子,请妥善保管你的访问秘钥。如果某些秘钥对出现泄漏风险,建议及时删除该秘钥对并生成新的替代秘钥对。
步骤 3 明确您业务场景中的AXN三元组中A和N分别对应的业务角色
AXN三元组中 A号码如果是客户的话,X号码就是为A客户分配的隐私号码,其他的任何号码拨打X号码都会转接到A号码,在创建AXN绑定关系时可以设定一个默认的B号码,假如A拨打X就会转接到这个B号码,如果B号码没有设置A就会被提示拨打的X号码是空号。
步骤 4 下载对应的SDK和DEMO样例程序编写代码
请到SDK&DEMO下载页面获取相应的SDK和DEMO程序,参照代码样例进行接口开发和调试。
参数
入参列表
出参列表
技术对接步骤
1:下载SDK工具包
SDK工具包中一共包含了2个类库,一个aliyun-.net-sdk-core包,另外一个是alicom-dypls-api包,将这两个包执行mvn package命令或者mvn deploy命令打包出相应的jar包,添加到工程类库中依赖使用。
SDK&DEMO【下载地址】
2: 编写样例程序
- [backcolor=transparent]using[backcolor=transparent] [backcolor=transparent]System[backcolor=transparent];
- [backcolor=transparent]using[backcolor=transparent] [backcolor=transparent]System[backcolor=transparent].[backcolor=transparent]Collections[backcolor=transparent].[backcolor=transparent]Generic[backcolor=transparent];
- [backcolor=transparent]using[backcolor=transparent] [backcolor=transparent]System[backcolor=transparent].[backcolor=transparent]Text[backcolor=transparent];
- [backcolor=transparent]using[backcolor=transparent] [backcolor=transparent]Aliyun[backcolor=transparent].[backcolor=transparent]Acs[backcolor=transparent].[backcolor=transparent]Core[backcolor=transparent];
- [backcolor=transparent]using[backcolor=transparent] [backcolor=transparent]Aliyun[backcolor=transparent].[backcolor=transparent]Acs[backcolor=transparent].[backcolor=transparent]Core[backcolor=transparent].[backcolor=transparent]Exceptions[backcolor=transparent];
- [backcolor=transparent]using[backcolor=transparent] [backcolor=transparent]Aliyun[backcolor=transparent].[backcolor=transparent]Acs[backcolor=transparent].[backcolor=transparent]Core[backcolor=transparent].[backcolor=transparent]Profile[backcolor=transparent];
- [backcolor=transparent]using[backcolor=transparent] [backcolor=transparent]Aliyun[backcolor=transparent].[backcolor=transparent]Acs[backcolor=transparent].[backcolor=transparent]Dyplsapi[backcolor=transparent].[backcolor=transparent]Model[backcolor=transparent].[backcolor=transparent]V20170525[backcolor=transparent];
- [backcolor=transparent]using[backcolor=transparent] [backcolor=transparent]System[backcolor=transparent].[backcolor=transparent]Security[backcolor=transparent].[backcolor=transparent]Cryptography[backcolor=transparent];
- [backcolor=transparent]using[backcolor=transparent] [backcolor=transparent]System[backcolor=transparent].[backcolor=transparent]Threading[backcolor=transparent];
- [backcolor=transparent]namespace[backcolor=transparent] [backcolor=transparent]ConsoleApplication1
- [backcolor=transparent]{
- [backcolor=transparent] [backcolor=transparent]class[backcolor=transparent] [backcolor=transparent]Program
- [backcolor=transparent] [backcolor=transparent]{
- [backcolor=transparent] [backcolor=transparent]//产品名称:云通信隐私保护API产品,开发者无需替换
- [backcolor=transparent] [backcolor=transparent]const[backcolor=transparent] [backcolor=transparent]String[backcolor=transparent] product [backcolor=transparent]=[backcolor=transparent] [backcolor=transparent]"Dyplsapi"[backcolor=transparent];
- [backcolor=transparent] [backcolor=transparent]//产品域名,开发者无需替换
- [backcolor=transparent] [backcolor=transparent]const[backcolor=transparent] [backcolor=transparent]String[backcolor=transparent] domain [backcolor=transparent]=[backcolor=transparent] [backcolor=transparent]"dyplsapi.aliyuncs.com"[backcolor=transparent];
- [backcolor=transparent] [backcolor=transparent]// TODO 此处需要替换成开发者自己的AK(在阿里云访问控制台寻找)
- [backcolor=transparent] [backcolor=transparent]const[backcolor=transparent] [backcolor=transparent]String[backcolor=transparent] accessKeyId [backcolor=transparent]=[backcolor=transparent] [backcolor=transparent]"yourAccessKeyId"[backcolor=transparent];
- [backcolor=transparent] [backcolor=transparent]const[backcolor=transparent] [backcolor=transparent]String[backcolor=transparent] accessKeySecret [backcolor=transparent]=[backcolor=transparent] [backcolor=transparent]"yourAccessKeySecret"[backcolor=transparent];[backcolor=transparent]
- [backcolor=transparent] [backcolor=transparent]public[backcolor=transparent] [backcolor=transparent]static[backcolor=transparent] [backcolor=transparent]BindAxnResponse[backcolor=transparent] bindAxn[backcolor=transparent]()
- [backcolor=transparent] [backcolor=transparent]{
- [backcolor=transparent] [backcolor=transparent]IClientProfile[backcolor=transparent] profile [backcolor=transparent]=[backcolor=transparent] [backcolor=transparent]DefaultProfile[backcolor=transparent].[backcolor=transparent]GetProfile[backcolor=transparent]([backcolor=transparent]"cn-hangzhou"[backcolor=transparent],[backcolor=transparent] accessKeyId[backcolor=transparent],[backcolor=transparent] accessKeySecret[backcolor=transparent]);
- [backcolor=transparent] [backcolor=transparent]DefaultProfile[backcolor=transparent].[backcolor=transparent]AddEndpoint[backcolor=transparent]([backcolor=transparent]"cn-hangzhou"[backcolor=transparent],[backcolor=transparent] [backcolor=transparent]"cn-hangzhou"[backcolor=transparent],[backcolor=transparent] product[backcolor=transparent],[backcolor=transparent] domain[backcolor=transparent]);
- [backcolor=transparent] [backcolor=transparent]IAcsClient[backcolor=transparent] client [backcolor=transparent]=[backcolor=transparent] [backcolor=transparent]new[backcolor=transparent] [backcolor=transparent]DefaultAcsClient[backcolor=transparent]([backcolor=transparent]profile[backcolor=transparent]);
- [backcolor=transparent] [backcolor=transparent]BindAxnRequest[backcolor=transparent] request [backcolor=transparent]=[backcolor=transparent] [backcolor=transparent]new[backcolor=transparent] [backcolor=transparent]BindAxnRequest[backcolor=transparent]();
- [backcolor=transparent] request[backcolor=transparent].[backcolor=transparent]PhoneNoA[backcolor=transparent] [backcolor=transparent]=[backcolor=transparent] [backcolor=transparent]"15010101010"[backcolor=transparent];
- [backcolor=transparent] request[backcolor=transparent].[backcolor=transparent]PhoneNoB[backcolor=transparent] [backcolor=transparent]=[backcolor=transparent] [backcolor=transparent]"15020202020"[backcolor=transparent];
- [backcolor=transparent] request[backcolor=transparent].[backcolor=transparent]Expiration[backcolor=transparent] [backcolor=transparent]=[backcolor=transparent] [backcolor=transparent]"2017-09-18 17:00:00"[backcolor=transparent];
- [backcolor=transparent] [backcolor=transparent]//可选:是否需要录制音频-默认是false
- [backcolor=transparent] request[backcolor=transparent].[backcolor=transparent]IsRecordingEnabled[backcolor=transparent] [backcolor=transparent]=[backcolor=transparent] [backcolor=transparent]false[backcolor=transparent];
- [backcolor=transparent] [backcolor=transparent]//外部业务自定义ID属性
- [backcolor=transparent] request[backcolor=transparent].[backcolor=transparent]OutId[backcolor=transparent] [backcolor=transparent]=[backcolor=transparent] [backcolor=transparent]"yourOutId"[backcolor=transparent];
- [backcolor=transparent] [backcolor=transparent]//AXN的隐私号码X一共支持2种号码类型 NO_95 NO_170
- [backcolor=transparent] request[backcolor=transparent].[backcolor=transparent]NoType[backcolor=transparent] [backcolor=transparent]=[backcolor=transparent] [backcolor=transparent]"NO_95"[backcolor=transparent];
- [backcolor=transparent] [backcolor=transparent]BindAxnResponse[backcolor=transparent] response [backcolor=transparent]=[backcolor=transparent] [backcolor=transparent]null[backcolor=transparent];
- [backcolor=transparent] [backcolor=transparent]try
- [backcolor=transparent] [backcolor=transparent]{
- [backcolor=transparent] response [backcolor=transparent]=[backcolor=transparent] client[backcolor=transparent].[backcolor=transparent]GetAcsResponse[backcolor=transparent]([backcolor=transparent]request[backcolor=transparent]);
- [backcolor=transparent] [backcolor=transparent]}
- [backcolor=transparent] [backcolor=transparent]catch[backcolor=transparent] [backcolor=transparent]([backcolor=transparent]ServerException[backcolor=transparent] e[backcolor=transparent])
- [backcolor=transparent] [backcolor=transparent]{
- [backcolor=transparent] [backcolor=transparent]}
- [backcolor=transparent] [backcolor=transparent]catch[backcolor=transparent] [backcolor=transparent]([backcolor=transparent]ClientException[backcolor=transparent] e[backcolor=transparent])
- [backcolor=transparent] [backcolor=transparent]{
- [backcolor=transparent] [backcolor=transparent]}
- [backcolor=transparent] [backcolor=transparent]return[backcolor=transparent] response[backcolor=transparent];
- [backcolor=transparent] [backcolor=transparent]}
- [backcolor=transparent] [backcolor=transparent]static[backcolor=transparent] [backcolor=transparent]void[backcolor=transparent] [backcolor=transparent]Main[backcolor=transparent]([backcolor=transparent]string[backcolor=transparent][][backcolor=transparent] args[backcolor=transparent])
- [backcolor=transparent] [backcolor=transparent]{
- [backcolor=transparent] [backcolor=transparent]BindAxnResponse[backcolor=transparent] axnResponse [backcolor=transparent]=[backcolor=transparent] bindAxn[backcolor=transparent]();
- [backcolor=transparent] [backcolor=transparent]Console[backcolor=transparent].[backcolor=transparent]Write[backcolor=transparent]([backcolor=transparent]"AXN绑定接口返回的结果----------------"[backcolor=transparent]);
- [backcolor=transparent] [backcolor=transparent]Console[backcolor=transparent].[backcolor=transparent]Write[backcolor=transparent]([backcolor=transparent]"Code="[backcolor=transparent] [backcolor=transparent]+[backcolor=transparent] axnResponse[backcolor=transparent].[backcolor=transparent]Code[backcolor=transparent]);
- [backcolor=transparent] [backcolor=transparent]Console[backcolor=transparent].[backcolor=transparent]Write[backcolor=transparent]([backcolor=transparent]"Message="[backcolor=transparent] [backcolor=transparent]+[backcolor=transparent] axnResponse[backcolor=transparent].[backcolor=transparent]Message[backcolor=transparent]);
- [backcolor=transparent] [backcolor=transparent]Console[backcolor=transparent].[backcolor=transparent]Write[backcolor=transparent]([backcolor=transparent]"RequestId="[backcolor=transparent] [backcolor=transparent]+[backcolor=transparent] axnResponse[backcolor=transparent].[backcolor=transparent]RequestId[backcolor=transparent]);
- [backcolor=transparent] [backcolor=transparent]String[backcolor=transparent] axnSubsId [backcolor=transparent]=[backcolor=transparent] axnResponse[backcolor=transparent].[backcolor=transparent]SecretBindDTO[backcolor=transparent] [backcolor=transparent]==[backcolor=transparent] [backcolor=transparent]null[backcolor=transparent] [backcolor=transparent]?[backcolor=transparent] [backcolor=transparent]null[backcolor=transparent] [backcolor=transparent]:[backcolor=transparent] axnResponse[backcolor=transparent].[backcolor=transparent]SecretBindDTO[backcolor=transparent].[backcolor=transparent]SubsId[backcolor=transparent];
- [backcolor=transparent] [backcolor=transparent]String[backcolor=transparent] axnSecretNo [backcolor=transparent]=[backcolor=transparent] axnResponse[backcolor=transparent].[backcolor=transparent]SecretBindDTO[backcolor=transparent] [backcolor=transparent]==[backcolor=transparent] [backcolor=transparent]null[backcolor=transparent] [backcolor=transparent]?[backcolor=transparent] [backcolor=transparent]null[backcolor=transparent] [backcolor=transparent]:[backcolor=transparent] axnResponse[backcolor=transparent].[backcolor=transparent]SecretBindDTO[backcolor=transparent].[backcolor=transparent]SecretNo[backcolor=transparent];
- [backcolor=transparent] [backcolor=transparent]Console[backcolor=transparent].[backcolor=transparent]Write[backcolor=transparent]([backcolor=transparent]"subsId="[backcolor=transparent] [backcolor=transparent]+[backcolor=transparent] axnSubsId[backcolor=transparent]);
- [backcolor=transparent] [backcolor=transparent]Console[backcolor=transparent].[backcolor=transparent]Write[backcolor=transparent]([backcolor=transparent]"secretNo="[backcolor=transparent] [backcolor=transparent]+[backcolor=transparent] axnSecretNo[backcolor=transparent]);
- [backcolor=transparent] [backcolor=transparent]Console[backcolor=transparent].[backcolor=transparent]WriteLine[backcolor=transparent]();[backcolor=transparent]
- [backcolor=transparent] [backcolor=transparent]}
- [backcolor=transparent] [backcolor=transparent]}
- [backcolor=transparent]}
错误码列表