iOS SDK接口详细指南

一、功能列表

1.1 响应command

command是DUI对话过程中通信方式之一,是将控制台与客户端联系在一起的纽带。在对话过程中,你可以通过command信息的定制与响应,实现具体的业务逻辑。

详细的command编写说明,请参见客户端动作(command)编写说明

1.1.1 定制command消息

command消息形式是字符串形式,具体定制可以通过以下三种方式:

第一种方式:在您已获取的技能(包括自己在控制台创建技能或者内置技能)中可以定制command消息,首先选择技能定制,进入技能列表,再选择开发,如下图:
Minion

其次,进入开发技能界面,选择编辑,见下图:
Minion

最后,进入任务编辑页面,添加具体说法与定制相关消息(比如command消息,nativeApi消息),command消息定制见下图:
Minion


第二种方式:在创建产品-语音内核配置中,进行命令唤醒词配置可定制command消息(见快速开发指南)。

第三种方式:在SDK的命令唤醒词接口中,可以定制command消息。

1.1.2 客户端实现command消息

当您定制了command消息之后,可以使用如下的方式在您的工程中做实现。
您可以在需要的地方注册和注销CommandObserver, 同一个CommandObserver可以处理多个commands。

command

self.commandObserver = [[CommandObserver alloc] init];
self.commandObserver.delegate = self;
  
// 注册以上三种方式定制的command消息
NSArray *commandArray = [[NSArray alloc] initWithObjects: @"start.player", @"open.window", @"open.fridge", @"open.door", nil];
[[DDSManager shareInstance] subscribe:commandArray observer:self.commandObserver];
  
// 注销以后就不会再响应该对象所注册的所有消息
[[DDSManager shareInstance] unSubscribe:self.commandObserver];
 
 
//响应注册的command消息
-(void)onCall:(NSString *)command data:(NSString *)data {
 
 
    //第一种方式:响应技能中定制的command消息start.player
    if([command isEqualToString:@"start.player"]){
        NSLog(@"响应commmand消息 start.player is successed");
    }
 
 
    //第二种方式:响应快捷命令唤醒词中定制的command消息open.window,open.fridge
    if([command isEqualToString:@"open.window"]) {
        NSLog(@"响应commmand消息 open.window is successed");
    }
    if([command isEqualToString:@"open.fridge"]) {
        NSLog(@"响应commmand消息 open.fridge is successed");
    }
     
    //第三种方式:响应SDK接口中定制的command消息open.door
    if([command isEqualToString:@"open.door"]) {
        NSLog(@"响应commmand消息 open.door is successed");
    }
}

1.2 响应native api

nativeApi消息形式是字符串形式,可以与UI控件配合起来使用,可以设计个性化界面。nativeApi消息可提供给您使用常见的一些控件。

1.2.1 nativeApi控件相关接口

文本控件(TextWidget)接口

TextWidget * textWidget = [[TextWidget alloc] init];
 
//设置文本
[textWidget setText:@"增加textWidget内容"];
 
 
//增加自定义参数的k,v对,可通过配置command参数转发给SDK(注:command和native必须在同一个任务中)
[textWidget addExtra:@"自定义的key" Value:@"自定义的Value"];

图文卡片控件(ContentWidget)接口

ContentWidget * contentWidget = [[ContentWidget alloc] init];
 
 
//设置标题
[contentWidget setTitle:@"设置标题"];
 
 
//设置副标题
[contentWidget setSubTitle:@"设置副标题"];
 
 
//设置标签
[contentWidget setLabel:@"设置标签"];
 
 
//设置图片地址
[contentWidget setImageUrl:@"设置图片资源地址"];
 
 
//设置链接跳转地址
[contentWidget setLinkUrl:@"设置链接跳转地址"];
 
 
//增加自定义参数的k,v对,可通过配置command参数转发给SDK(注:command和native必须在同一个任务中)
[contentWidget addExtra:@"phone" Value:@"添加自定义数据"];

列表控件(ListWidget)接口

ListWidget * listWidget = [[ListWidget alloc] init];
 
ContentWidget * contentWidget = [[ContentWidget alloc] init];
[contentWidget setTitle:@"设置列表第一行标题"];
[contentWidget addExtra:@"phone" Value:@"添加自定义数据"];
 
//添加到控件,作为列表控件第一行内容
[listWidget addContentWidget:contentWidget];
 
 
//增加自定义参数的k,v对,可通过配置command参数转发给SDK(注:command和native必须在同一个任务中)
[listWidget addExtra:@"自定义的key" Value:@"自定义的Value"];

媒体控件(MediaWidget)接口

MediaWidget * mediaWidget = [[MediaWidget alloc] init];
ContentWidget * contentWidget = [[ContentWidget alloc] init];
[contentWidget setTitle:@"设置标题"];
[contentWidget addExtra:@"phone" Value:@"添加自定义数据"];
 
//添加到MediaWidget中
[mediaWidget addContentWidget:contentWidget];
 
//增加自定义参数的k,v对,可通过配置command参数转发给SDK(注:command和native必须在同一个任务中)
[mediaWidget addExtra:@"自定义的key" Value:@"自定义的Value"];

内嵌网页控件(WebWidget)接口

WebWidget * webWidget = [[WebWidget alloc] init];
 
 
//设置url地址
[webWidget setUrl:@"设置url地址"];
 
//增加自定义参数的k,v对,可通过配置command参数转发给SDK(注:command和native必须在同一个任务中)
[webWidget addExtra:@"自定义的key" Value:@"自定义的Value"];

1.2.2 定制nativeApi消息

定制nativeApi消息与第一种方式定制command消息类似,直到进入任务编辑页面,不同之处在于,nativeApi消息定制必须手动加上前缀native://,此外还应选择必要的控件形式、类型等。若您还须要额外的参数,可以通过API配置进行参数配置。具体见下图:

Minion

1.2.3 客户端实现nativeApi消息

当您在DUI平台上定制了native api之后,可以使用如下的方式在您的工程中做实现:

您可以在需要的地方注册和注销NativeApiObserver,同一个NativeApiObserver可以处理多个native api。

self.nativeApiObserver = [[NativeApiObserver alloc] init];
self.nativeApiObserver.delegate = self;
 
// 注册您定制的nativeApi消息
 NSArray *nativeApiArray = [[NSArray alloc] initWithObjects:@"sys.query.contacts", nil];
 [[DDSManager shareInstance] subscribe:nativeApiArray observer:self.nativeApiObserver];
  
// 注销以后就不会再响应该对象索注册的所有消息
[[DDSManager shareInstance] unSubscribe:self.nativeApiObserver];
 
//响应注册的nativeApi消息,并调用feedbackNativeApiResult响应服务端,否则会导致native api超时
-(void)onQuery:(NSString *)nativeApi data:(NSString *)data {
    if([nativeApi isEqualToString:@"sys.query.contacts"]) {
        NSLog(@"响应nativeApi消息 sys.query.contacts is successed");
         
        //定义列表控件,具体使用参考控件相关接口
        ListWidget * listWidget = [[ListWidget alloc] init];
 
        ContentWidget * contentWidget = [[ContentWidget alloc] init];
        [contentWidget setTitle:@"设置列表第一行标题"];
        [contentWidget setSubTitle:@"设置列表第一行子标题"];
        [contentWidget addExtra:@"phone" Value:@"添加自定义数据"];
 
 
        //添加到控件,作为列表控件第一行内容
        [listWidget addContentWidget:contentWidget];
 
 
        ///向DUI平台返回结果,此时控件类型取决于定制nativeApi消息时所选择的控件类型,自定义控件可以选择DuiWidget类型
        [[DDSManager shareInstance] feedbackNativeApiResult:nativeApi duiWidget:listWidget];
    }
}

  • 每个onQuery方法执行时,需要调用feedbackNativeApiResult来向DUI平台返回执行结果,表示一个native api执行结束;
  • native api的执行超时时间为10s。

1.3 响应message消息

message消息无须您主动定制,此类消息是DUI主动发送给您的。您可以在客户端注册您所关注的消息,并且可以实现特定的业务逻辑。

1.3.1 message消息列表:

message data 说明
sys.dialog.start {
reason:"wakeup.major",//唤醒词触发对话
}
对话开始,及开始原因:1.wakeup.major,唤醒词唤醒2.wakeup.command,快捷命令唤醒3.api.startDialog,调用startDialog接口4.api.sendText,调用sendText接口(对话Idle时)5.api.triggerIntent,调用triggerIntent接口(对话Idle时)6.api.avatarClick,调用avatarClick接口(对话Idle时)7.api.avatarPress,调用avatarPress接口(对话Idle时)
sys.dialog.end {
reason:"normal",//对话正常结束
skillId:"100001246"
}
{ reason:"error",//对话发生错误;
errId:071304,
errMsg:"asr null", skillId:"trySkillId"
}
{
reason:"interrupt",//对话被打断。强制结束对话时出现。
skillId:"100001246"
}
{“reason”:"normal”}//快捷唤醒词返回结果
对话结束,及结束原因:
1.normal,对话正常结束
2.error,对话发生错误退出
3.interrupt,对话被打断退出
4.快捷唤醒词返回结果
sys.dialog.error {
errId:071304,
errMsg:"asr null",
"recordId":"f71de62c59efca802e23dac3a8b0e526"
}
对话中发生的错误
sys.dialog.continue 对话恢复
speak.end(已废弃) ttsId speak播报结束
sys.wakeup.result {
"type": "major",
"word": "你好小驰",
"greeting":"主人你好"
}
语音唤醒
sys.vad.begin VAD触发
sys.vad.end VAD结束
sys.upload.result //失败
{
"result":false,
"reqId":"xxxx",
"errId":71801,
"errMsg":"Network Invalid"
}
//成功
{
"result":true,
"result":true,
}
上传词库、设备信息的结果

1.3.2 客户端实现message消息

您可以在需要的地方注册和注销MessageObserver,同一个MessageObserver可以处理多个message。

您可以通过注册消息接收器来接收需要UI展示的数据,具体UI消息数据见:UI 事件及数据定义

message

self.messageObserver = [[MessageObserver alloc] init];
self.messageObserver.delegate = self;
// 注册您关注的message消息
NSArray *messageArray = [[NSArray alloc] initWithObjects:@"avatar.silence", @"avatar.listening", @"avatar.understanding", @"avatar.speaking", @"sys.dialog.start", @"sys.dialog.end", @"context.input.text",nil];
[[DDSManager shareInstance] subscribe:messageArray observer:self.messageObserver];
 
// 注销以后就不会再响应该对象所注册的所有消息
[[DDSManager shareInstance] unSubscribe:self.messageObserver];
 
 
//响应您注册的message消息
-(void)onMessage:(NSString *)message  data:(NSString*)data {
    if ([message isEqualToString:@"sys.dialog.start"]) {
        NSLog(@"对话开始了");
    }
    if ([message isEqualToString:@"context.input.text"]) {
        NSLog(@"用户输入数据");
    }
}

1.4 内置H5

您如果使用和上传了h5资源,可以通过以下方法来获取h5资源包的index.html文件的路径用来在webview中加载。

H5

// 获取资源包中h5的index.html文件的绝对路径
[[DDSManager shareInstance] getValidH5Path];

1.5 开启/终止对话

您可以在任何时刻主动开启/终止对话,通过以下接口实现。(消息监听参照 1.3.1 message消息列表,开启对话有提示音)

dialog

//开启对话
[[DDSManager shareInstance] startDialog];
//停止对话
[[DDSManager shareInstance] stopDialog];

1.6 外部引擎相关接口

1.6.1 外部录音机拾音

您如果有自己的录音机,可以通过以下方法将录音数据传给DDS。(注:注明下每次传送的数据不能超过3200字节)

external recorder

//注册
[paramDic setObject:@"external" forKey:K_RECORDER_MODE];
  
//发送录音数据给DDS
[[DDSManager shareInstance] feedPcm:data];

1.6.2 外部TTS引擎

您如果使用第三方的TTS引擎,可以通过以下方法来将第三方TTS引擎注册到DDS中。

//SDK初始化时注册  实现代理方法
[paramDic setObject:@"external" forKey:K_TTS_MODE];
 
 
//须要合成的回调接口
-(void)onStart:(NSString *)type data:(NSString *)content{
    NSLog(@"AITtsExNode : tts start");
}
//打断播报的回调接口
-(void)onStop{
    NSLog(@"AITtsExNode : tts stop");
}
  
// 播报结束通知,第三方引擎播报完后需要调用,通知SDK已播报结束
[[DDSManager shareInstance] notifyTTSEnd];

1.7 设置场景模式

如果您期望在某些场景下让SDK保持静音,同时又可以进行对话等操作,可以在需要的时候调用下面的接口。
DDSMode

//设置为正常模式
 [[DDSManager shareInstance] setDDSMode:1];
 
//设置为静音模式
[[DDSManager shareInstance] setDDSMode:0];

1.8 触发场景意图

如果您期望主动触发某个意图的对话,可以在需要的时候调用下面的接口。

参数说明:
1)skill 技能名称,必填。
2)task 任务名称,必填。
3)intent 意图名称,必填。
4)slots 语义槽的key-value,可选。

triggerIntent

//跳过识别和语义,直接进入指定的意图对话。即:DDS主动向用户发起一轮对话。
 NSMutableDictionary *arrDic = [[NSMutableDictionary alloc] init];
 [arrDic setObject:@"xxx" forKey:@"电影人"];
 [arrDic setObject:@"语义槽取值" forKey:@"语义槽名称"];
 [[DDSManager shareInstance] triggerIntent:@"skillx" task:@"TestNative" intent:@"xx" slots:arrDic];

1.9 更新用户词库

如果您期望更新用户的词库,使其能在技能中使用,可以在需要的时候调用下面的接口,更新结果可以通过sys.upload.result消息来获取。

返回请求ID,用于追踪sys.upload.result。

sys.upload.result 消息需要通过message订阅。

参数说明:

1)vocabName词库名称,必填。若上传的词库是sys.联系人,则会自动做分词处理。
2)contents 词条,必填。若需要上传带同义词的词条,格式如下:"[(词条取值1:同义词1,同义词2),(词条取值2:同义词1,同义词2)]"。
3)addOrDelete 新增(YES)还是删除(NO),必填。

updateVocab

//实时更新用户词库 
 NSMutableArray *arr = [[NSMutableArray alloc]init];
 [arr addObject:@"星期日:礼拜天"];
 [arr addObject:@"节假日:假期"]; 
 [arr addObject:@"电灯:电灯泡,灯泡"]; 
NSString * reqId = [[DDSManager shareInstance]updateVocab:@"我的节日" contents:arr addOrDelete:YES];
 
 
//实时更新联系人词库
 NSMutableArray *arr = [[NSMutableArray alloc]init];
 [arr addObject:@"张三"];
 [arr addObject:@"李四"];  
NSString * reqId = [[DDSManager shareInstance]updateVocab:@"sys.联系人" contents:arr addOrDelete:YES];

如果您需要批量更新操作多个词库,可用如下接口。

updateVocabs

AIVocabIntent *vocab1 = [[AIVocabIntent alloc]init];
vocab1.name = @"伙伴名";                                                //词库名称
vocab1.contents = [@[@"张三", @"李四", @"王二", @"小芳"] mutableCopy];      //词库内容
vocab1.action = ACTION_CLEAR_AND_INSERT;                                //对词库的操作

AIVocabIntent *vocab2 = [[AIVocabIntent alloc]init];
vocab2.name = @"歌手名";
vocab2.contents = [@[@"小芳", @"乐乐"] mutableCopy];
vocab2.action = ACTION_CLEAR_AND_INSERT;

NSString *requestId = [[DDSManager shareInstance]updateVocabs:@[vocab1, vocab2]];
NSLog(@"requestid  is %@", requestId);

1.10 输入文本

如果您期望跳过识别直接输入文本进行对话,可以在需要的时候调用下面的接口。

若当前没有在对话中,则以文本作为首轮说法,新发起一轮对话请求。
若当前正在对话中,则跳过识别,直接发送文本。

参数说明:

1)text 输入的文本内容

sendText

//输入文本
[[DDSManager shareInstance] sendText:@"一加一等于几"];

1.11 设置VAD相关参数

1.11.1 设置VAD后端停顿时间

如果您期望修改VAD后端检测的时间,可以在需要的时候调用下面的接口。

参数说明:

1)millis 后端检测时间,单位毫秒,默认500毫秒。即若VAD在用户说话时停顿超过一定的时间,则认为用户已经说完,发出sys.vad.end消息,结束录音。

setVadPauseTime

//设置VAD后端停顿时间
[[DDSManager shareInstance] setVadPauseTime:1000];
   
//获取VAD后端停顿时间
long pause = [[DDSManager shareInstance] getVadPauseTime];
NSLog(@"pauseTime is %ld", pause);

1.11.2 设置/获取VAD前端静音检测超时时间

/**

 设置VAD前端超时时间的接口

 @param mills 前端超时时间,单位为毫秒。默认值为8000毫秒。

 */

setVadTimeOut

//设置VAD前端超时时间的接口
[[[DDSManager shareInstance] getASRInstance] setVadTimeout:9000];

//获取VAD前端超时时间的接口
long timeOut = [[[DDSManager shareInstance] getASRInstance] getVadTimeout];

1.12 数据上传接口

开发者调用此接口来上传一些设备的信息,这些信息可以在本地使用,也可以在对话中获取,作为对话决策的一部分。

1.12.1 更新设备、产品级配置信息

/*!

更新设备状态,产品级的配置,比如:定位信息,设备硬件状态等,在SDK中需要设置AIUpdateContextIntent对象属性。

更新结果可以通过sys.upload.result消息来获取。

@param intent 请求的AIUpdateContextIntent对象,包括contextIntentKey和contextIntentValue;

如:contextIntentKey = @"location", contextIntentValue = @{@"city":@"苏州市"}。
技能里通过context.system.settings.location.city即可获取到"苏州市"。

@return 请求的ID,用于追踪sys.upload.result。

*/

updateProductContext

    AIUpdateContextIntent * intent = [[AIUpdateContextIntent alloc] init];
    intent.contextIntentKey = @"bluetooth";
    intent.contextIntentValue = @{@"state":@"disconnected"};
 
//更新设备信息
    [[DDSManager shareInstance] updateProductContext:intent];
 
//获取设备信息
    NSObject *obj = [[DDSManager shareInstance] getProductContext:@"bluetooth"];

1.12.2 更新技能配置信息

/*!

更新技能配置,需要设置AIUpdateContextIntent对象属性。

更新结果可以通过sys.upload.result消息来获取。

@param intent 请求的AIUpdateContextIntent对象,包括contextIntentKey、contextIntentValue、contextIntentSkillId;

如:contextIntentKey = @"music",contextIntentValue = @{@"state":@"closed",contextIntentSkillId = @"100000285";
该技能里通过context.skill.settings.music.state即可获取到"closed",其他技能则无法使用。

@return 请求的ID,用于追踪sys.upload.result。

*/

updateSkillContext

    AIUpdateContextIntent * intent = [[AIUpdateContextIntent alloc] init];
    intent.contextIntentKey = @"music";
    intent.contextIntentValue = @{@"state":@"closed"};
    intent.contextIntentSkillId = @"100000285";
 
//更新技能配置信息
    [[DDSManager shareInstance] updateSkillContext:intent];
 
//获取技能配置信息
    NSObject *obj = [[DDSManager shareInstance] getSkillContext:@"100000285" key:@"music" ];

1.12.3 更新热词识别接口(请求级别)

/**

 更新热词识别接口(请求级别)

 每次请求都会带上热词词库, 例如: [{"type": "vocab", "name": "行政区", "data":["黄浦区"]}]

 本接口为覆盖式接口,以最新设置为准,如需要清除请求,data置为空即可。

 @param phraseHints phraseHints 需要更新的热词识别列表

 */

updatePhraseHints

AIPhraseHintsIntent *intent = [[AIPhraseHintsIntent alloc] init];
//类型
intent.type = @"vocab";
//词库名称
intent.name = @"sys.联系人";
//更新的数据
intent.data = [[NSMutableArray alloc]initWithObjects:@"张三",@"李四", nil];
NSArray *phraseHints = [[NSArray alloc]initWithObjects:intent, nil];
[[DDSManager shareInstance] updatePhraseHints:phraseHints];

1.13 唤醒相关接口

1.13.1 开关唤醒

默认SDK加载后不会启动语音唤醒,您可以通过以下接口对需对语音唤醒进行控制:

wakeup

// 开启语音唤醒
[[DDSManager shareInstance] enableWakeup];
  
// 关闭语音唤醒
[[DDSManager shareInstance] disableWakeup];
  
// 获取唤醒词列表
[[DDSManager shareInstance] getWakeupWords];

1.13.2 更新主唤醒词

若想增加或移除主唤醒词,那么您可以调用如下接口设置主唤醒词,具体参数如下:

/*!

添加主唤醒词的接口,支持添加多个主唤醒词,调用此接口会覆盖控制台配置的主唤醒词,直到通过removeMainWakeupWord接口移除,如果移除了所有通过addMainWakeupWord接口添加的主唤醒词,则主唤醒词重置为控制台所配置的。

@param words 主唤醒词,不为nil;

@param pinyin 主唤醒词的拼音,不为nil;

@param threshold 主唤醒词的阈值,不为nil;

@param greetings 主唤醒词的欢迎语,不为nil;如果某个唤醒词不想要欢迎语,在对应的维度设为NULL。

*/

setMainWakeup

NSMutableArray * arrayWords = [[NSMutableArray alloc] init];
 [arrayWords addObject:@"你好小鹏"];
 [arrayWords addObject:@"你好小龙"];
 NSMutableArray * arrayPinyins = [[NSMutableArray alloc] init];
 [arrayPinyins addObject:@"ni hao xiao peng"];
 [arrayPinyins addObject:@"ni hao xiao long"];
 NSMutableArray * arrayThresholds = [[NSMutableArray alloc] init];
 [arrayThresholds addObject:@"0.124"];
 [arrayThresholds addObject:@"0.125"];
 NSMutableArray * arrayGreetings = [[NSMutableArray alloc] init];
 [arrayGreetings addObject:@[@"小鹏来了"]];
 [arrayGreetings addObject:@[@"小龙来了", @"小龙在此"]];
 
//增加主唤醒词
[[[DDSManager shareInstance] getDDSWakeupEngineManager] addMainWakeupWord:arrayWords pinyin:arrayPinyins threshold:arrayThresholds greetings:arrayGreetings];
 
//移除主唤醒词
[[[DDSManager shareInstance] getDDSWakeupEngineManager] removeMainWakeupWord:arrayWords];
//新版支持 WakeupWord *wakeWord1 = [[WakeupWord alloc]init]; wakeWord1.word = @"你好小鹏"; wakeWord1.pinyin = @"ni hao xiao peng"; wakeWord1.threshold = @"0.124"; wakeWord1.greeting = @[@"小鹏来了"]; WakeupWord *wakeWord2 = [[WakeupWord alloc]init]; wakeWord2.word = @"你好小龙"; wakeWord2.pinyin = @"ni hao xiao long"; wakeWord2.threshold = @"0.124"; wakeWord2.greeting = @[@"小龙来了"]; //添加一个主唤醒词 [[[DDSManager shareInstance] getDDSWakeupEngineManager] addOneMainWakeupWord:wakeWord1]; //添加多个主唤醒词 [[[DDSManager shareInstance] getDDSWakeupEngineManager] addMainWakeupWords:@[wakeWord1,wakeWord2]]; //更新多个主唤醒词 [[[DDSManager shareInstance] getDDSWakeupEngineManager] updateMainWakeupWords:@[wakeWord1,wakeWord2]]; //移除一个主唤醒词 [[[DDSManager shareInstance] getDDSWakeupEngineManager] removeOneMainWakeupWord:wakeWord1]; //移除多个主唤醒词 [[[DDSManager shareInstance] getDDSWakeupEngineManager] removeMainWakeupWords:@[wakeWord1,wakeWord2]]; //获取主唤醒词列表 NSArray *mainWakeupList = [[[DDSManager shareInstance] getDDSWakeupEngineManager] getMainWakeupWords]; //清空主唤醒词列表 [[[DDSManager shareInstance] getDDSWakeupEngineManager] clearMainWakeupWords];

1.13.3 更新副唤醒词

如果您期望为设备增加一个副唤醒词,可以在需要的时候调用下面的接口。

参数说明:

1)word 副唤醒词(必须)。若不填,则清空当前的副唤醒词。
2)pinyin 副唤醒词的拼音(可选)。若不填,则自动估算。
3)threshold 副唤醒词的阈值(可选)。若不填,则自动估算。
4)greetings 副唤醒词的欢迎语(可选)。若不填,则与主唤醒词保持一致。

//实时更新副唤醒词
NSMutableArray *arr = [[NSMutableArray alloc] init];
[arr addObject:@"小明在此"];
[arr addObject:@"来了来了"];
[[DDSManager shareInstance] updateMinorWakeupWord:@"你好小明" pinyin:@"ni hao xiao ming" threshold:@"0.127" greetings:arr];
 
//获取当前的副唤醒词
NSString * minWakeupWords = [[[DDSManager shareInstance] getDDSWakeupEngineManager] getMinorWakeupWord];

1.13.4 更新命令唤醒词

如果您期望在唤醒的时候执行一条指令,可以在需要的时候调用下面的接口。命令唤醒词和DUI控制台所设置的快捷唤醒词是相同的功能,且互不影响,可同时存在,根据需求来选择设置方式。

参数说明:

1)actions 命令唤醒词指令,为NSMutableArray<NSString*>数组,至少有一个元素(此类元素就是定制的command消息(例如:open.window,open.door),该消息可以分别在客户端进行注册,以及响应。

2)words 命令唤醒词, 为NSMutableArray<NSString*>数组,至少有一个元素。

3)pinyins 命令唤醒词的拼音,形如:ni hao xiao chi, 为NSMutableArray<NSString*>数组,至少有一个元素。

4)thresholds 命令唤醒词的阈值, 形如:0.120(取值范围:0-1)。为NSMutableArray<NSString*>数组,至少有一个元素。

5)greetings 命令唤醒词的欢迎语, 为NSMutableArray<NSMutableArray<NSString*>*>数组,至少有一个元素, 每维对应一个唤醒词的欢迎语。

updateCommandWakeupWord

NSMutableArray * arrayAction = [[NSMutableArray alloc] init];
 [arrayAction addObject:@"open.window"];
 [arrayAction addObject:@"open.door"];
 NSMutableArray * arrayWords = [[NSMutableArray alloc] init];
 [arrayWords addObject:@"打开窗户"];
 [arrayWords addObject:@"打开门"];
 NSMutableArray * arrayPinyins = [[NSMutableArray alloc] init];
 [arrayPinyins addObject:@"da kai chuang hu"];
 [arrayPinyins addObject:@"da kai men"];
 NSMutableArray * arrayThresholds = [[NSMutableArray alloc] init];
 [arrayThresholds addObject:@"0.124"];
 [arrayThresholds addObject:@"0.125"];
 NSMutableArray * arrayGreetings = [[NSMutableArray alloc] init];
 [arrayGreetings addObject:@[@"窗户打开了", @"开了开了"]];
 [arrayGreetings addObject:@[@"门打开了", @"好了好了"]];
 
 
//实时更新命令唤醒词
 [[[DDSManager shareInstance] getDDSWakeupEngineManager] updateCommandWakeupWord:arrayAction words:arrayWords pinyin:arrayPinyins threshold:arrayThresholds greetings:arrayGreetings];
 
 
//清空当前设置的命令唤醒词
[[[DDSManager shareInstance] getDDSWakeupEngineManager] clearCommandWakeupWord];
 
 
//添加指定的命令唤醒词组
[[[DDSManager shareInstance] getDDSWakeupEngineManager] addCommandWakeupWord:arrayAction words:arrayWords pinyin:arrayPinyins threshold:arrayThresholds greetings:arrayGreetings];
   
//移除指定的命令唤醒词组
[[[DDSManager shareInstance] getDDSWakeupEngineManager] removeCommandWakeupWord:arrayWords];

1.13.5 更新打断唤醒词

如果您期望在唤醒的时候能同时打断语音播报,可以在需要的时候调用下面的接口。打断唤醒词暂不支持在DUI控制台设置。(说明:打断需要设备开启回声消除)

参数说明:

/*!

更新打断唤醒词的接口,这类唤醒词能打断正在播报的语音并且将唤醒词送入识别。

支持设置多个打断唤醒词,所以参数为数组,重复调用会以最新的打断唤醒词数组为准。


@param words 打断唤醒词,为NSString数组,必须。


@param pinyin 打断唤醒词的拼音, 形如:ni hao xiao chi,为NSString数组,必须。


@param threshold 打断唤醒词的阈值,形如:0.120(取值范围:0-1) 为NString数组,必须。

*/

ShortcutWakeupWord

NSMutableArray * arrayWords = [[NSMutableArray alloc] init];
 [arrayWords addObject:@"小驰小驰"];
 [arrayWords addObject:@"你好小驰"];
 NSMutableArray * arrayPinyins = [[NSMutableArray alloc] init];
 [arrayPinyins addObject:@"xiao chi xiao chi"];
 [arrayPinyins addObject:@"ni hao xiao chi"];
 NSMutableArray * arrayThresholds = [[NSMutableArray alloc] init];
 [arrayThresholds addObject:@"0.124"];
 [arrayThresholds addObject:@"0.125"];
 
 
//更新打断唤醒词
 [[[DDSManager shareInstance] getDDSWakeupEngineManager] updateShortcutWakeupWord:arrayWords pinyin:arrayPinyins threshold:arrayThresholds];
 
 
//清空打断唤醒词
[[[DDSManager shareInstance] getDDSWakeupEngineManager] clearShortCutWakeupWord];
 
 
//添加指定的打断唤醒词组
[[[DDSManager shareInstance] getDDSWakeupEngineManager] addShortcutWakeupWord:arrayWords pinyin:arrayPinyins threshold:arrayThresholds];
   
//移除指定的打断唤醒词组
[[[DDSManager shareInstance] getDDSWakeupEngineManager] removeShortcutWakeupWord:arrayWords];

1.13.6 更新快速唤醒词

 增加/更新/删除 一条/多条QuickStart词
 QuickStart词为类似“导航去”、“我想听”等,此类唤醒词只在oneshot模式下生效,
 作用为在未唤醒状态下语音输入“导航去天安门”,可直接进入对话流程。

QuickStartWords

WakeupWord *wakeWord1 = [[WakeupWord alloc]init];
//QuickStart词的汉字
wakeWord1.word = @"导航去";
//QuickStart词的拼音
wakeWord1.pinyin = @"dao hang qu";
//QuickStart词的阈值
wakeWord1.threshold = @"0.124";


WakeupWord *wakeWord2 = [[WakeupWord alloc]init];
wakeWord2.word = @"我想听";
wakeWord2.pinyin = @"wo xiang ting";
wakeWord2.threshold = @"0.124";

//添加多个快速唤醒词
[[[DDSManager shareInstance] getDDSWakeupEngineManager] addQuickStartWords:@[wakeWord1,wakeWord2]];

//删除指定快速唤醒词
[[[DDSManager shareInstance] getDDSWakeupEngineManager] removeOneQuickStartWord:wakeWord1];

//删除多个快速唤醒词
[[[DDSManager shareInstance] getDDSWakeupEngineManager] removeQuickStartWords:@[wakeWord1,wakeWord2]];

//更新多个快速唤醒词
[[[DDSManager shareInstance] getDDSWakeupEngineManager] updateQuickStartWords:@[wakeWord1,wakeWord2]];

//清除快速唤醒词
[[[DDSManager shareInstance] getDDSWakeupEngineManager] clearQuickStartWords];

1.13.7 获取当前唤醒内核的版本号

/**

 获取当前唤醒库版本号

 @return 唤醒库版本号

 */

getWakeupVersion

//获取当前唤醒内核的版本号
NSString *version = [[[DDSManager shareInstance] getDDSWakeupEngineManager] getWakeupVersion];

1.13.8 开启/关闭OneShot功能

/**

 开启/关闭OneShot功能

 */

enableOneShot/disableOneShot

//开启OneShot功能
[[[DDSManager shareInstance]getDDSWakeupEngineManager]enableOneShot];
//关闭OneShot功能
[[[DDSManager shareInstance]getDDSWakeupEngineManager]disableOneShot];

1.14 识别相关接口

如果您期望仅开启识别并获取识别结果(对话中禁止使用),可以在需要的时候调用下面的接口,可在回调中获取结果。

(注:开启识别后,不能开启唤醒。 开启识别后对话结束即识别结束,若需要继续使用需重新开启)

1.14.1 开启识别

startListener

//获取识别实例
ASREngineManager *engine = [[DDSManager shareInstance] getASRInstance];
 
//开启识别
[engine startListening:self];
 
 
//实现识别回调
-(void) ASRBeginningOfSpeech{
    NSLog(@"ASREngine 检测到用户开始说话");
}
 
-(void) ASREndOfSpeech{
    NSLog(@"ASREngine 检测到用户结束说话");
}
 
-(void) ASRBufferReceived:(NSData *) buffer{
    NSLog(@"ASREngine 用户说话的音频数据: %@", buffer);
}
 
-(void) ASRPartialResults:(NSString *) results{
    NSLog(@"ASREngine 实时识别结果反馈: %@", results);
}
 
-(void) ASRFinalResults:(NSString *) results{
    NSLog(@"ASREngine 最终识别结果反馈: %@",  results);
}
 
-(void)ASRError:(NSString*) error{
    NSLog(@"ASREngine 识别过程中发生的错误: %@", error);
}
-(void) ASRRmsChanged:(float)rmsdB{
    NSLog(@"ASREngine 用户说话的音量分贝: %f", rmsdB);
}

1.14.2 主动结束识别

stopListener

//获取识别实例
ASREngineManager *engine = [[DDSManager shareInstance] getASRInstance];
 
//主动结束此次识别
[engine stopListening];

1.14.3 取消本次识别

cancel

//获取识别实例
ASREngineManager *engine = [[DDSManager shareInstance] getASRInstance];
 
//取消此次识别
[engine cancel];

1.14.4 设置实时回传音量大小

/**

 设置实时回传音量大小, 默认为NO

 @param enable YES/NO  YES:支持实时回传音量 NO:关闭实时回传音量

 */

enableVolume

//获取识别实例
ASREngineManager *engine = [[DDSManager shareInstance] getASRInstance];

//设置实时回传音量大小
[engine enableVolume:YES];

1.14.5 更新/获取云端识别的模型名字

/**

 * 更新云端识别的模型名字

 * 在调用完该接口后,下一次对话开始时生效,并一直用该模型,除非客户端再调用该接口设置为其他的模型

 @param asrModel   云端识别的模型名字,有aihome, airobot等,

 *                                默认为dui控制台配置的模型资源,

 *                                如果填nil,则表示清除之前本地配置的模型名,之后会使用dui控制台配置的模型资源

 */

updateAsrModel/getAsrModel

//更新云端识别的模型名字
[[[DDSManager shareInstance] getASRInstance] updateAsrModel:@"aihome"];

//获取云端识别的模型名字
NSString *asrModel = [[[DDSManager shareInstance] getASRInstance] getAsrModel];

1.15 TTS相关接口

发音人列表如下(仅供参考,以实际为准):

语言 资源名 说明 云端是否支持SSML(本地不支持SSML 是否支持本地
中文 anonyf 小妮,青年女声,普通话中文,英文混读;
中文 qianranf 小倩,女童声,普通话中文;英文混读;
中文 hyanif 小燕;纯中文;青年女声;
中文 lzyinf 小颖;纯中文;青年女声;
中文 dlaf 多拉爱梦;中英文;青年女声;
中文 zhilingf 林志玲,青年女声,普通话中文,英文混读;
中文 anonyg 小珍,女童声,普通话中文;
中文 xijunm 小军,青年男声,普通话中文,英文混读;
中文 geyou 葛优,青年男声,普通话中文;英文混读;
中文 gdgm 郭德纲;纯中文;青年男声;英文混读;
中文 swkm 孙悟空;纯中文;青年男声;
中文 hbrinf 快乐智慧 纯中文 童声女声
中文 zxcm 周星驰;纯中文;青年男声;
中文 gqlanf 纯中文;青年女声;英文混读;
中文 lucyf lucy; 青年女声; 普通话中文,英文混读;
中文 zzxiangm 赵忠祥 纯中文 中年男声

1.15.1 设置发音人

setSpeaker

//获取TTS实例
TTSEngineManager * engine = [[DDSManager shareInstance] getTTSInstance];
 
//设置播报合成音,参考上面发音人列表
[engine setSpeaker:@"zhilingf"];

/**  * 设置TTS播报类型的接口  * 调用此接口则云端配置的合成音类型失效,此后的合成音类型都将由此接口来托管  * @param speaker 取值如:zhilingf, gdgm等  * @param resPath 合成资源的全路径: xxx/xxx/gdgm.bin  */ [engine setSpeaker:@"xxx" withResPath:[self getResourcesFile:@"xxx/xxx.bin"]];

1.15.2 设置语速

setSpeed

//获取TTS实例
TTSEngineManager * engine = [[DDSManager shareInstance] getTTSInstance];
 
/*!
 设置TTS播报语速的接口,调用此接口则云端配置的合成音语速失效,此后的合成音语速都将由此接口来托管
 @param speed 语速,取值0.5-2.0,0.5语速最快,2.0语速最慢。注意:对应控制台上合成音倍率值
*/ [engine setSpeed:1.0];

1.15.3 设置音量

setVolume

//获取TTS实例
TTSEngineManager * engine = [[DDSManager shareInstance] getTTSInstance];
 
 
/*!
 设置TTS播报音量的接口,调用此接口则云端配置的合成音音量失效,此后的合成音音量都将由此接口来托管
 @param volume 音量大小,取值1-100
 */
[engine setVolume:50];

1.15.4 设置TTS模式

setTTSMode

//获取TTS实例
TTSEngineManager * engine = [[DDSManager shareInstance] getTTSInstance];
 
/*!
 设置TTS模式
 @param mode 取值0 local TTS;取值1 cloud TTS
 */
[engine setmode:1];

1.15.5 获取发音人

getSpeaker

//获取TTS实例
TTSEngineManager * engine = [[DDSManager shareInstance] getTTSInstance];
 
//获取播报合成音
NSString * speaker = [engine getSpeaker];

1.15.6 获取语速

getSpeed

//获取TTS实例
TTSEngineManager * engine = [[DDSManager shareInstance] getTTSInstance];
 
//获取播报语速
float speed = [engine getSpeed];

1.15.7 获取音量

getVolume

//获取TTS实例
TTSEngineManager * engine = [[DDSManager shareInstance] getTTSInstance];
 
//获取播报音量
int volume = [engine getVolume];

1.15.8 暂停播报

pausePlayer

//获取TTS实例
TTSEngineManager * engine = [[DDSManager shareInstance] getTTSInstance];
 
//暂停播报
[engine pausePlayer];

1.15.9 恢复播报

resetPlayer

//获取TTS实例
TTSEngineManager * engine = [[DDSManager shareInstance] getTTSInstance];
 
//恢复播报
[engine resetPlayer];

1.15.10 语音播报

如果你仅仅想播报一段文本,可以通过使用以下方法来播报,但是该方法在对话时,禁止使用。

text - 播报文本


提供4个优先级播报:

priority - 优先级

  • 优先级0-保留,与aios语音交互同级,仅限内部使用;
  • 优先级1-正常,默认选项,同级按序播放;
  • 优先级2-重要,可以打断<优先级1>,同级按序播放;
  • 优先级3-紧急,可以打断<优先级1|优先级2>,同级按序播放。


ttsId - 用于追踪该次播报的id,建议使用UUID。

tts

// 请求语音播报
//此接口在新版SDK已弃用,请使用下面的新接口
//[[DDSManager shareInstance] speak:text  priority:priority ttsId:ttsId];
 
//获取识别实例
TTSEngineManager * engine = [[DDSManager shareInstance] getTTSInstance];
 
[engine speak:text  priority:priority ttsId:ttsId];

1.15.11 停止语音播报

停止播报与speak接口可以配合使用,具体说明如下:

1)与speak接口一样,在对话时,禁止使用;

2)ttsId与speak接口的ttsId一致,则停止或者移除该播报;

3)ttsId为@"all", 停止所有播报。

tts

// 停止播报
//此接口在新版SDK已弃用,请使用下面的新接口
//[[DDSManager shareInstance] shutup:ttsId];
 
//获取TTS实例
TTSEngineManager * engine = [[DDSManager shareInstance] getTTSInstance];
 
[engine shutup:ttsId];

1.15.12 TTS回调接口

TTSEngineManager

//获取TTS实例
TTSEngineManager * engine = [[DDSManager shareInstance] getTTSInstance];
 
//设置委托
[engine setTTSEngienManagerDelegate:self];
 
 
//实现TTS回调
-(void) TTSBeginning:(NSString*)ttsId{
    NSLog(@"TTSEngine 开始播报: %@", ttsId);
}
-(void) TTSReceived:(NSData*)data{
    NSLog(@"TTSEngine 收到音频,此方法会回调多次,直至data为0,音频结束: %@",data);
}
 
-(void) TTSEnd:(NSString*)ttsId status:(int)status{
    NSLog(@"TTSEngine TTS播报结束, ttsid: %@ status: %d",ttsId, status);
}
 
-(void) TTSError:(NSString*) error{
    NSLog(@"TTSEngine 出现错误: %@", error);
}

1.15.13 设置/获取自定义TTS播报录音的接口

setCustomAudio/getCustomAudio

//设置自定义TTS播报录音的接口
NSMutableArray * array = [[NSMutableArray alloc] init];
NSMutableDictionary * mp3Dic = [[NSMutableDictionary alloc] init];
NSString * mp3Path = [self getResourcesFile:@"zaine.mp3"];
[mp3Dic setObject:@"我在,有什么可以帮你" forKey:@"name"];
[mp3Dic setObject:@"mp3" forKey:@"type"];
[mp3Dic setObject:mp3Path forKey:@"path"];
[array addObject:mp3Dic];
[[[DDSManager shareInstance] getTTSInstance] setCustomAudio:array];

//获取自定义TTS播报录音的接口
 NSArray *array = [[[DDSManager shareInstance] getTTSInstance] getCustomAudio];

1.15.14 设置TTS结束后延迟时间

setPlayAfterTime

// 设置TTS结束后延迟时间,单位ms
// @param afterTime 延迟时间(ms)
[[[DDSManager shareInstance] getTTSInstance] setPlayAfterTime:500];

1.16 设置对话模式

若产品中只添加本地技能,你可以通过以下接口强制使用本地对话管理,也可通过该接口切换为云端对话管理,接口参数如下:

/*!

设置对话模式

@param mode 取值:1,本地对话管理;取值2,云端对话管理

*/

setDilaogMode

//设置本地对话管理
[[DDSManager shareInstance] setDialogMode:1];
 
 
//设置云端对话管理
[[DDSManager shareInstance] setDialogMode:2];

1.17 按键事件

如果您有相关的软硬件按键,您需要关注以下接口,将用户的行为反馈给SDK。但是avatarPress/avatarRelease两个接口要求产品不能开启VAD(VAD在创建产品时可配置)。

avatar

// 点击唤醒/停止识别/打断播报 操作接口
[[DDSManager shareInstance] avatarClick];
// 点击唤醒/停止识别/打断播报 操作接口 , 并附带一则欢迎语,当此次是唤醒时,播报这则欢迎语
[[DDSManager shareInstance] avatarClick:@"欢迎来到DUI世界"];
  
// 按下按键接口,可以说话
[[DDSManager shareInstance] avatarPress];
  
// 释放按键接口,停止说话
[[DDSManager shareInstance] avatarRelease];

1.18 处理更新

调用update接口进行duicore和product资源的更新,SDK内部会进行检查版本是否为最新版本。

如果有新版本会自动进行下载、解压并重启DDS;

如果没有则通知没有版本更新。

update

//在适当的时候调用该接口,进行更新操作
[[DDSManager shareInstance] update];
 
 
//如果没有更新,回调此方法,what为70303
-(void)onError:(int)what Error:(NSString*)error{ //int what, String error
    NSLog(@"%@,update onError code:%d, error:%@", TAG, what, error);
    if(what == 70303){
        [[DDSManager shareInstance] speak:@"没有发现新版本,不需要更新" priority:1 ttsId:@"1002"];
    }
}
 
 
//如果有更新,回调此方法,SDK自动下载
-(void)onUpdateFound:(NSString *)detail{
    NSLog(@"%@, update onUpdateFound:%@", TAG, detail);
}
 
 
//下载进度回调方法
-(void)onDownloadProgress:(float) progress{
    NSLog(@"%@, update onDownloadProgress:%f", TAG, progress);
}
 
 
//下载完成回调方法
-(void)onUpdateFinish{
    NSLog(@"%@, update onUpdateFinish", TAG);
}

二、高级配置项

2.1 录音配置项

参数名 取值 说明 是否必须 默认值
K_RECORDER_MODE 字符串
external/internal
录音机模式:external(使用外置录音机,需主动调用拾音接口)
internal(使用内置录音机,DDS自动录音)
非必须 internal
K_AEC_MODE 字符串
external
AEC模式:
external(DDS会认为宿主设备已经完成了AEC回声消除,选择默认模组也可以支持唤醒打断
非必须 N/A

2.2 TTS配置项

参数名 取值 说明 是否必须 默认值
K_CUSTOM_TIPS json字符串 自定义错误播放的内容,如{
"71304":"这是识别结果为空的自定义播报",
"71305":"这是语义结果为空的自定义播报",
"71308":"这是进入闲聊技能的自定义播报",
"713**":"*****"
}
非必须 内置
K_TTS_MODE 字符串 external/internal TTS模式:
external(使用外置TTS引擎,需主动注册TTS请求监听器)
internal(使用内置DUI TTS引擎)
非必须 internal
K_TTS_CACHE 字符串 false/true TTS缓存路是否开启 非必须 false
K_CACHE_COUNT 整型 TTS缓存音频数目 非必须 100
K_CUSTOM_AUDIO json串 自定义音频文件,替代TTS合成,如:
[{
"name": "我在,有什么可以帮你",
"type": "pcm",
"path": "/var/containers/Bundle/Application/816D8F91-A7F5-4159-8BEC-D3E40123F755/ddsiosDemo.app/nhxc.pcm"
}, {
"name": "开始为您播放",
"type": "mp3",
"path": "/var/containers/Bundle/Application/816D8F91-A7F5-4159-8BEC-D3E40123F755/ddsiosDemo.app/nhxhua.mp3"
}, {
"name": "为您播放",
"type": "wav",
"path": "/var/containers/Bundle/Application/816D8F91-A7F5-4159-8BEC-D3E40123F755/ddsiosDemo.app/xiaole.wav"
}]
其中type->音频格式(pcm/wav/mp3);name->替代合成的文本;path->音频的路径
非必须 N/A
K_ENABLE_STREAM_URL 字符串,true|false 针对长文本的合成优化配置项 非必须 true

2.3 识别配置项

参数名 取值 说明 是否必须 默认值
K_VAD_TIMEOUT 数值型字符串,毫秒 VAD静音检测超时时间,默认8000毫秒 非必须 8000
K_ASR_ENABLE_PUNCTUATION 字符串,true/false 识别结果是否带标点符号 非必须 false
K_ASR_ROUTER 字符串,partner/dialog 识别路由:
partner(将识别结果传递给partner,不会主动进入对话)
dialog(将识别结果传递给dui,会主动进入对话)
非必须 dialog
K_ASR_ENABLE_TONE 字符串,true/false 识别结果的拼音是否带音调 非必须 false
K_AUDIO_COMPRESS 字符串,speex/opus/false 是否开启音频压缩,配置为opus则使用第三方引擎接口feedOpus 非必须 speex
K_ASR_TIPS 字符串,true/false 识别完成是否播报提示音 非必须 false

2.4 唤醒配置项

参数名 取值 说明 是否必须 默认值
K_WAKEUP_ROUTER 字符串,partner/dialog 唤醒路由:
partner(将唤醒结果传递给partner,不会主动进入对话)
dialog(将唤醒结果传递给dui,会主动进入对话)
非必须 dialog
K_ONESHOT_MIDTIME
K_ONESHOT_ENDTIME
数值型字符串,毫秒 OneShot配置:
1.若MIDTIME=0&ENDTIME=0,唤醒后进入识别;若VAD检测超时,则直接退出对话
2.若MIDTIME=0&ENDTIME!=0,唤醒后进入识别;若ENDTIME超时,则直接退出对话
3.若MIDTIME!=0&ENDTIME=0,唤醒后进入识别;若MIDTIME超时,则播放欢迎语,继续识别
4.若MIDTIME!=0&ENDTIME!=0,唤醒后进入识别;若MIDTIME超时,则播放欢迎语,继续识别;若ENDTIME超时,则直接退出对话
非必须 500
2000

2.5 调试配置项

参数名 取值 说明 是否必须 默认值
K_CACHE_PATH 字符串 调试信息保存路径 非必须 沙盒目录
K_WAKEUP_DEBUG 字符串true/false 将会自动保存唤醒音频 非必须
K_VAD_DEBUG 字符串true/false 将会自动保存VAD音频 非必须
K_ASR_DEBUG 字符串true/false 将会自动保存ASR音频 非必须
K_TTS_DEBUG 字符串true/false 将会自动保存TTS音频 非必须

三、错误码描述

error id 错误描述 原因及解决办法
1 解压dds.bin失败 系统IO错误
2 内核执行出错 请检查配置是否正确,或者联系DUI客服
3 系统启动超时 请检查配置是否正确,或者联系DUI客服
4 存储空间不足 系统存储空间不足
5 内部节点异常退出 重启DDS SDK
070302 解码失败 联系DUI客服
070303 未发现新的版本
070304 请先升级您的客户端(SDK) 因为产品选择的dui内核和sdk不匹配,需要升级sdk
070305 网络异常, 无法连接至服务器 请检查网络是否正常或者配置是否正确
070306 解码失败 联系DUI客服
070307 补丁安装失败 存储空间不够
070308 备份压缩文件不存在 用户手动删掉了app私有空间的文件
070309 提取压缩文件失败 存储空间不够
070310 未设置产品ID 需要设置产品id
070311 无效客户端版本 请检查配置是否正确
070312 无效用户ID 需要设置用户id
070313 无效设备ID 设备id不正确
070314 资源地址无效 请检查配置是否正确
070315 无效的产品分支 需要设置产品分支
070316 无法找到资源 服务端资源生成有问题,请尝试重新发布一下,或者请提供产品id反馈给DUI客服,去后台查询根本原因
070317 资源校验失败 下载资源过程中资源被纂改
070319 当前产品中内核资源版本过低,请前往DUI控制台对应的产品中,选择最新的内核资源版本并重新发布产品 当前产品中内核资源版本过低,请前往DUI控制台对应的产品中,选择最新的内核资源版本并重新发布产品。
070601 network abnormal, can not connect to auth server 设备注册过程中无法连接到授权服务器,请检查网络是否畅通,或者productId与api key是否匹配
070602 can not get valid profile 设备注册过程无法颁发有效的profile文件,请与客服联联系
070603 invalid api key 无效的api key,请到产品授权配置页面查看api key信息是否正确,iOS平台请确认BundleId是否匹配
070604 Invalid product id 无效的产品ID,请到产品信息中查看
070605 read profile file failed 读取profile文件失败,请检查文件系统是否异常或重新进行设备注册
070606 profile file is disabled profile文件被禁用,请重新进行注册
070607 profile file is expired profile文件过期,请重新进行注册
070608 profile file is illegal for this device profile文件非法,请联系客服
070609 can not save profile 设备注册无法保存有效的profile文件,检查文件系统是否异常或者重新进行设备注册
070610 profile file is illegal for this productId productId与api key不匹配
070612 dns resolve failed: no answers DNS失败,请检查网络是否畅通
070613 dns resolve failed: exceed retry count DNS失败,请检查网络是否畅通
070614 dns resolve failed: network is unreachable DNS失败,请检查网络是否畅通
070615 dns resolve timeout DNS超时,请检查网络是否畅通
070616 connect ip failed: reasons for uncertainty 建立连接失败,请检查网络是否畅通
070617 connect ip failed: network is unreachable 建立连接失败,请检查网络是否畅通
070618 connect ip timeout 建立连接超时,请检查网络是否畅通
070619 websocket handshake failed: reasons for uncertainty websocket握手失败,请检查网络是否畅通
070620 recv timeout 接收超时,请检查网络是否畅通
070621 send timeout 发送超时,请检查网络是否畅通
070622 orderly shutdown 请检查网络是否畅通
071301 TTS合成超时 请检查网络是否正常
071302 对话超时 请检查网络是否正常
071303 对话连接断开 请检查网络是否正常
071304 识别结果为空 未检测到用户说法
071305  语义结果为空 用户的说法没有命中产品中的非闲聊技能
071306 WebAPI错误 调用WebAPI时发生错误
071307 NativeAPI错误 调用NativeAPI时发生错误
071308 进入闲聊技能 用户的首轮说法没有命中产品中的非闲聊技能
071309 异常重试达到最大次数 达到了产品错误处理的最大重试次数
071310 命中退出词 用户说了产品的退出词
071311 NativeAPI未注册 请检测是否注册并实现NativeAPI
071312 本地识别结果置信度低 网络离线时本地识别结果置信度较低
071313 自定义技能响应超时 联系技能开发者
071314 自定义技能内部错误 联系技能开发者
071315 自定义技能返回为空 联系技能开发者
071316 当前场景下不支持这么说 该技能须要关闭智能调度
071317 进入兜底技能 用户说法进入了产品中的兜底技能
071318 进入知识型技能 用户说法进入了产品中的知识型技能
071300 对话服务内部错误 联系DUI客服
072101 ASREngine VAD超时 超过8s未检测到人声
072102 ASREngine 识别为空 未检测到用户说法
072103 ASREngine 识别服务超时 请检查网络是否正常
072104 ASREngine 识别过程发生错误 联系DUI客服
072201 唤醒词个数超过限制 请清除之前的唤醒词后重试

四、集成帮助文档

使用浏览器打开headerDoc下的masterTOC.html文件。