資源簡介
本模塊已經編譯好了 可以直接使用 也有源碼在里面 對freeswitch的空號識別有興趣 已經想學習編寫freeswitch模塊的人 可以下載看看

代碼片段和文件信息
/*?asr?mod.?Copyright?2017?xuhuaiyi?ALL?RIGHTS?RESERVED!
????Author:?cdevelop@qq.com(wwww.ddrj.com)
????之前寫了一個商業模塊mod_vad,以及二次開發接口SmartIVR(RESTful?API)詳細看?http://www.dingdingtong.cn/smartivr/
????很多用戶只想測試一下ASR的效果以及希望自己掌握獲取FreeSWITCH語音數據的原理和過程,所以特意寫了這個開源項目供大家參考。
????本項目的技術交流可以加群:340129771
????如果需要商業服務和支持可以聯系QQ:1280791187,或者微信:cdevelop
????
????本項目是通過阿里云實時語音識別接口把通話中的語音流發送到阿里識別服務器,識別結果通過ESL事件通知業務程序。
*/
#include?“switch.h“
#include?“NlsClient.h“
?SWITCH_MODULE_LOAD_FUNCTION(mod_asr_load);
?SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_asr_shutdown);
?
?extern?“C“?{
?????SWITCH_MODULE_DEFINITION(mod_asr?mod_asr_load?mod_asr_shutdown?NULL);
?};
//?NlsClient?nlc;
?NlsSpeechCallback??callback;
typedef?struct?{
????switch_core_session_t???*session;
????switch_media_bug_t??????*bug;
????NlsRequest??????????????*request;
????char????????????????????*id;
????char????????????????????*seceret;
????int?????????????????????stop;
}?switch_da_t;
void?OnResultDataRecved(NlsEvent*?str?void*?para)
{
????switch_log_printf(SWITCH_CHANNEL_LOG?SWITCH_LOG_NOTICE?“?OnResultDataRecved?%s?%s\n“?str->getId()?str->getResponse());
????
????/*
????{“finish“:1“request_id“:“13d5daad670947a5a7a12c581f5dc8b7““status_code“:200“version“:“2.0“}
????{“finish“:0“request_id“:“13d5daad670947a5a7a12c581f5dc8b7““result“:{“sentence_id“:10“begin_time“:50960“end_time“:52915“status_code“:0“text“:“電話掛掉吧拜拜“}“status_code“:200“version“:“2.0“}
????{“finish“:0“request_id“:“13d5daad670947a5a7a12c581f5dc8b7““result“:{“sentence_id“:10“begin_time“:50960“end_time“:-1“status_code“:1“text“:“電話掛“}“status_code“:200“version“:“2.0“}
????{“finish“:0“request_id“:“76a6e062ec9b4db68f5f6016c7f700aa““result“:{“sentence_id“:1“begin_time“:1100“end_time“:3505“status_code“:0“text“:“哎,好的一訂單大概多少錢啊“}“status_code“:200“version“:“2.0“}
????{“finish“:0“request_id“:“76a6e062ec9b4db68f5f6016c7f700aa““result“:{“sentence_id“:1“begin_time“:1100“end_time“:-1“status_code“:1“text“:“哎,好的一訂單大概多少錢“}“status_code“:200“version“:“2.0“}
????*/
????switch_event_t?*event?=?NULL;
????if?(switch_event_create(&event?SWITCH_EVENT_CUSTOM)?==?SWITCH_STATUS_SUCCESS)?{
????????event->subclass_name?=?strdup(“asr“);
????????switch_event_add_header_string(event?SWITCH_STACK_BOTTOM?“Event-Subclass“?event->subclass_name);
????????switch_event_add_header_string(event?SWITCH_STACK_BOTTOM?“ASR-Response“?str->getResponse());
????????switch_event_add_header_string(event?SWITCH_STACK_BOTTOM?“Channel“?str->getId());
// switch_event_add_header_string(event?SWITCH_STACK_BOTTOM,“uuid“?uuid)
????????switch_event_fire(&event);
????}
}
void?OnOperationFailed(NlsEvent*?str?void*?para)
{
????switch_log_printf(SWITCH_CHANNEL_LOG?SWITCH_LOG_WARNING?“?OnOperationFailed?%s?%s\n“?str->getId()?str->getErrorMessage());
????switch_event_t?*event?=?NULL;
????if?(switch_event_create(&event?SWITCH_EVENT_CUSTOM)?==?SWITCH_STATUS_SUCCESS)?{
????????event->subclass_name?=?strdup(“asr“);
????????switch_event_add_hea
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????309??2018-09-11?17:27??asr64\.git\config
?????文件?????????73??2018-09-11?17:27??asr64\.git\desc
?????文件?????????23??2018-09-11?17:27??asr64\.git\HEAD
?????文件????????478??2018-09-11?17:27??asr64\.git\hooks\applypatch-msg.sample
?????文件????????896??2018-09-11?17:27??asr64\.git\hooks\commit-msg.sample
?????文件???????3327??2018-09-11?17:27??asr64\.git\hooks\fsmonitor-watchman.sample
?????文件????????189??2018-09-11?17:27??asr64\.git\hooks\post-update.sample
?????文件????????424??2018-09-11?17:27??asr64\.git\hooks\pre-applypatch.sample
?????文件???????1642??2018-09-11?17:27??asr64\.git\hooks\pre-commit.sample
?????文件???????1348??2018-09-11?17:27??asr64\.git\hooks\pre-push.sample
?????文件???????4898??2018-09-11?17:27??asr64\.git\hooks\pre-reba
?????文件????????544??2018-09-11?17:27??asr64\.git\hooks\pre-receive.sample
?????文件???????1492??2018-09-11?17:27??asr64\.git\hooks\prepare-commit-msg.sample
?????文件???????3610??2018-09-11?17:27??asr64\.git\hooks\update.sample
?????文件????????918??2018-09-11?17:27??asr64\.git\index
?????文件????????240??2018-09-11?17:27??asr64\.git\info\exclude
?????文件????????211??2018-09-11?17:27??asr64\.git\logs\HEAD
?????文件????????211??2018-09-11?17:27??asr64\.git\logs\refs\heads\master
?????文件????????211??2018-09-11?17:27??asr64\.git\logs\refs\remotes\origin\HEAD
?????文件????????174??2018-09-11?17:27??asr64\.git\ob
?????文件?????195687??2018-09-11?17:27??asr64\.git\ob
?????文件???????3136??2018-09-11?17:27??asr64\.git\ob
?????文件???????2608??2018-09-11?17:27??asr64\.git\ob
?????文件????????215??2018-09-11?17:27??asr64\.git\ob
?????文件????????685??2018-09-11?17:27??asr64\.git\ob
?????文件????????215??2018-09-11?17:27??asr64\.git\ob
?????文件????????159??2018-09-11?17:27??asr64\.git\ob
?????文件?????????88??2018-09-11?17:27??asr64\.git\ob
?????文件????????169??2018-09-11?17:27??asr64\.git\ob
?????文件????????167??2018-09-11?17:27??asr64\.git\ob
............此處省略272個文件信息
- 上一篇:Horner算法小程序
- 下一篇:詞法分析語法分析實驗報告及源碼
評論
共有 條評論