• <strike id="fdgpu"><input id="fdgpu"></input></strike>
    <label id="fdgpu"></label>
    <s id="fdgpu"><code id="fdgpu"></code></s>

  • <label id="fdgpu"></label>
  • <span id="fdgpu"><u id="fdgpu"></u></span>

    <s id="fdgpu"><sub id="fdgpu"></sub></s>
    您當(dāng)前的位置是:  首頁 > 新聞 > 文章精選 >
     首頁 > 新聞 > 文章精選 >

    使用unimrcp中間件結(jié)合語音識(shí)別引擎開發(fā)智能客服-1

    2018-09-13 10:07:20   作者:james.zhu   來源:CTI論壇   評論:0  點(diǎn)擊:


      目前,基于智能客服的呼叫中心非常受歡迎。網(wǎng)上很多人對智能客服的優(yōu)勢也做了很多討論。關(guān)于語音機(jī)器人開發(fā)的文檔和介紹都非常少。事實(shí)上,很多公司的智能客服或電話機(jī)器人一般都基于Asterisk或FreeSWITCH,然后通過開源的MRCP協(xié)議unimrcp 模塊來對接第三方的語音識(shí)別引擎,這些語音識(shí)別引擎包括科大訊飛,百度等公司的ASR產(chǎn)品。在我們以前的文檔中,已經(jīng)非常完整地介紹了整個(gè)MRCP協(xié)議的介紹。現(xiàn)在我們開始介紹如何使用unimrcp 模塊,結(jié)合開發(fā)人員的業(yè)務(wù)邏輯,通過對接第三方的語音識(shí)別來實(shí)現(xiàn)語音機(jī)器人的開發(fā)。今天,我們首先介紹開發(fā)語音機(jī)器人的第一部分。
      在與各類ASR等做對接時(shí),總避免不了有些ASR沒有一個(gè)更為標(biāo)準(zhǔn)的對接方式,有時(shí)就需要自己按mrcp協(xié)議去處理這些ASR識(shí)別引擎。
      在這里我們采用unimrcp這個(gè)開源項(xiàng)目來作為識(shí)別中間件,對FreeSWITCH的語音部分通過unimrcp送給ASR識(shí)別引擎,然后識(shí)別引擎再把結(jié)果送到unimrcp后,由unimrcp再回送到FreeSWITCH結(jié)構(gòu)大致如下:
      在以上的開發(fā)流程中,我們結(jié)合了第三方語音機(jī)器人開發(fā)公司上海寧衛(wèi)的檢測模塊的業(yè)務(wù)流程處理,結(jié)合unimrcp和第三方的MRCP服務(wù)器進(jìn)行對接,ASR 服務(wù)器進(jìn)行識(shí)別處理。
      本之間我們先介紹下unimrcp這個(gè)開源項(xiàng)目。
      這是一個(gè)基于RFC6787和RFC4463的跨平臺(tái)mrcp的輕量實(shí)現(xiàn),其跨平臺(tái)是依賴apache apr庫,而FreeSwitch的跨平臺(tái)也是依賴于這一c實(shí)現(xiàn)庫。在unimrcp中,還有以下一些第三方庫:
    • mpf - Media processing framework.
    • mrcp - Implementation of MRCP basics (message,      parser, resources).
    • mrcpv2-transport - Implementation of the MRCPv2      transport layer.
    • mrcp-signaling - Abstract MRCP signaling (session      management) interface.
    • mrcp-engine - Abstract resource engine interface.
    • mrcp-client - Implementation of an MRCP client stack      based on the abstract signaling interface.
    • mrcp-server - Implementation of an MRCP server stack      based on the abstract signaling and engine interfaces.
    • uni-rtsp - Implementation of a minimal RTSP stack      required for MRCPv1.
    • Mrcp-sofia - Implementation of the abstract signaling interface using      the SofiaSIP library.
      以上的介紹都算是一些基本的知識(shí)要求,而在unimrcp如果要按我們的想法去實(shí)現(xiàn)相關(guān)的對接,則是去實(shí)現(xiàn)一個(gè)個(gè)的插件(plugin).在unimrcp中現(xiàn)在默認(rèn)支持以下四種plugin:
    • demo-synth - Implementation of a TTS plugin which simulates      synthesis.
    • demo-recog - Implementation of an ASR plugin which simulates      recognition.
    • demo-verif - Implementation of an SVI plugin which simulates speaker      verification.
    • mrcp-recorder - Implementation of a recorder plugin.
      在我們現(xiàn)在的語音機(jī)器人開發(fā)中,我們僅使用了語音識(shí)別功能和語音合成功能。當(dāng)然,語音合成或TTS也可以使用其他第三方的模塊來進(jìn)行處理。在這里recorder(錄音)或verif(驗(yàn)證)對我們暫時(shí)不需要,因?yàn)槲覀児┲鶩reeSwitch來實(shí)現(xiàn)recorder更容易,而verif對我們來說,基本沒什么需求,都可以略過。那么我們講講如何實(shí)現(xiàn)和ASR進(jìn)行編程進(jìn)行對接。
      在實(shí)現(xiàn)unimrcp的ASR插件時(shí),要按它的標(biāo)準(zhǔn)去實(shí)現(xiàn)一些接口或方法。
      定義的結(jié)構(gòu)體
      MRCP引擎維護(hù)的方法:
      static const struct mrcp_engine_method_vtable_t engine_vtable = {
      demo_recog_engine_destroy,
      demo_recog_engine_open,
      demo_recog_engine_close,
      demo_recog_engine_channel_create
      };
      這里其實(shí)就是聲明為函數(shù)的指針,其定義如下:
      /** Table of MRCP engine virtual methods */
      struct mrcp_engine_method_vtable_t {
      apt_bool_t (*destroy)(mrcp_engine_t *engine);
      apt_bool_t (*open)(mrcp_engine_t *engine);
      apt_bool_t (*close)(mrcp_engine_t *engine);
      mrcp_engine_channel_t* (*create_channel)(mrcp_engine_t *engine, apr_pool_t *pool);
      };
      按以上兩個(gè)定義,我們可以看到,實(shí)際上就是針對mrcp的通道建立、數(shù)據(jù)傳輸、關(guān)閉、釋放做對應(yīng)的回調(diào)。
      2.  MRCP通道的維護(hù)方法:
      static const struct mrcp_engine_channel_method_vtable_t channel_vtable = {
      demo_recog_channel_destroy,
      demo_recog_channel_open,
      demo_recog_channel_close,
      demo_recog_channel_request_process
      };
      同樣需要考慮這個(gè)mrcp_engine_channel_method_vtable_t結(jié)構(gòu)的具體實(shí)現(xiàn),其定義如下:
      /** Table of channel virtual methods */
      struct mrcp_engine_channel_method_vtable_t {
      apt_bool_t (*destroy)(mrcp_engine_channel_t *channel);
      apt_bool_t (*open)(mrcp_engine_channel_t *channel);
      apt_bool_t (*close)(mrcp_engine_channel_t *channel);
      apt_bool_t (*process_request)(mrcp_engine_channel_t *channel, mrcp_message_t *request);
      };
      通過以上這個(gè)結(jié)構(gòu)體實(shí)現(xiàn)的方法,來完成對于識(shí)別通道的維護(hù)。
      3.  針對音頻流的維護(hù)方法:
      static const mpf_audio_stream_vtable_t audio_stream_vtable = {
      demo_recog_stream_destroy,
      NULL,
      NULL,
      NULL,
      demo_recog_stream_open,
      demo_recog_stream_close,
      demo_recog_stream_write,
      NULL
      };
      這是在mpf(media process framework)中定義的對于流媒體的處理接口要求,原結(jié)構(gòu):
      /** Table of audio stream virtual methods */
      struct mpf_audio_stream_vtable_t {
      apt_bool_t (*destroy)(mpf_audio_stream_t *stream);
      apt_bool_t (*open_rx)(mpf_audio_stream_t *stream, mpf_codec_t *codec);
      apt_bool_t (*close_rx)(mpf_audio_stream_t *stream);
      apt_bool_t (*read_frame)(mpf_audio_stream_t *stream, mpf_frame_t *frame);
      apt_bool_t (*open_tx)(mpf_audio_stream_t *stream, mpf_codec_t *codec);
      apt_bool_t (*close_tx)(mpf_audio_stream_t *stream);
      apt_bool_t (*write_frame)(mpf_audio_stream_t *stream, const mpf_frame_t *frame);
      void (*trace)(mpf_audio_stream_t *stream, mpf_stream_direction_e direction, apt_text_stream_t *output);
      };
      4.  接下來要實(shí)現(xiàn)一個(gè)引擎隊(duì)列維護(hù)對象
      struct demo_recog_engine_t {
      apt_consumer_task_t    *task;
      };
      5.  需要明確聲明一個(gè)對通道進(jìn)行識(shí)別的一個(gè)具體的對象
      struct demo_recog_channel_t {
      demo_recog_engine_t     *demo_engine;
      mrcp_engine_channel_t   *channel;
      mrcp_message_t          *recog_request;
      mrcp_message_t          *stop_response;
      apt_bool_t               timers_started;
      mpf_activity_detector_t *detector;
      FILE                    *audio_out;
      };
      這里需要注意的是這里可以定義定時(shí)器timers_started,用來配合detector這個(gè)mpf的特性來完成語音的有效或者說活動(dòng)性檢測。
      而audio_out可以完成錄音性的東西。
      需要完成的方法
    • demo_recog_engine_channel_create 用來創(chuàng)建一個(gè)要進(jìn)行識(shí)別的通道,基本以sip為主,通過信令來管理。
    • demo_recog_stream_write 對于通過rtp送過來的數(shù)據(jù),送給識(shí)別引擎進(jìn)行處理,更為大量的工作是在這里進(jìn)行處理。
    • 通過業(yè)務(wù)邏輯對話術(shù)進(jìn)行處理和邏輯判斷。此部分的內(nèi)容我們在后續(xù)的增加中會(huì)通過簡單示例來演示如何使用MRCP協(xié)議實(shí)現(xiàn)外呼,通過語音識(shí)別結(jié)合語義匹配實(shí)現(xiàn)銀行催收業(yè)務(wù)和教育培訓(xùn)業(yè)務(wù)的處理




      unimrcp-MRCP協(xié)議學(xué)習(xí)分享,QQ群號(hào):208136295
      關(guān)注微信公眾號(hào):asterisk-cn,獲得有價(jià)值的Asterisk行業(yè)分享
      freepbx 技術(shù)論壇:www.ippbx.org.cn
      Asterisk, freepbx技術(shù)文檔: www.freepbx.org.cn
      歐米(Omni)智能客服解決方案
      融合通信商業(yè)解決方案,協(xié)同解決方案首選產(chǎn)品:www.hiastar.com
      Asterisk/FreePBX唯一中國官方合作伙伴
    【免責(zé)聲明】本文僅代表作者本人觀點(diǎn),與CTI論壇無關(guān)。CTI論壇對文中陳述、觀點(diǎn)判斷保持中立,不對所包含內(nèi)容的準(zhǔn)確性、可靠性或完整性提供任何明示或暗示的保證。請讀者僅作參考,并請自行承擔(dān)全部責(zé)任。

    相關(guān)閱讀:

    專題

    亚洲精品网站在线观看不卡无广告,国产a不卡片精品免费观看,欧美亚洲一区二区三区在线,国产一区二区三区日韩 柳河县| 黄大仙区| 崇礼县| 屏边| 迁西县| 溧阳市| 乌兰察布市| 周口市| 若尔盖县| 桂平市| 卫辉市| 偏关县| 大城县| 昆明市| 丰宁| 珠海市| 苍山县| 黔西| 固原市| 永福县| 无为县| 普定县| 克拉玛依市| 澄江县| 青河县| 资溪县| 龙门县| 肥乡县| 克山县| 岳阳县| 谢通门县| 徐汇区| 海丰县| 宜宾县| 天等县| 成武县| 安吉县| 柳林县| 绥阳县| 茌平县| 乌审旗| http://444 http://444 http://444 http://444 http://444 http://444