Built motion from commit (unavailable).|2.3.91
[motion2.git] / server / services / agi / scripts / google / asr / lib / api.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x74d0=['https://speech.googleapis.com','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','toString','base64','POST','/v1/speech:recognize?key=','url','bluebird'];(function(_0x3f7d24,_0x3ce1d5){var _0x143f6e=function(_0x4689be){while(--_0x4689be){_0x3f7d24['push'](_0x3f7d24['shift']());}};_0x143f6e(++_0x3ce1d5);}(_0x74d0,0x191));var _0x074d=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x74d0[_0x297fd3];return _0x2af381;};'use strict';var url=require(_0x074d('0x0'));var BPromise=require(_0x074d('0x1'));var fs=require('fs');var host=_0x074d('0x2');module['exports']=function(_0x3b6b3a,_0xc18df,_0xd8e3f8){return new BPromise(function(_0x19ff78,_0x2c4122){var _0x2c28d7;if(typeof _0x3b6b3a!==_0x074d('0x3')||_0x3b6b3a[_0x074d('0x4')]===0x0){return _0x2c4122(_0x074d('0x5'));}if(typeof _0xc18df!=='string'||_0xc18df[_0x074d('0x4')]===0x0){return _0x2c4122(_0x074d('0x6'));}if(typeof _0xd8e3f8!==_0x074d('0x7')&&(typeof _0xd8e3f8!==_0x074d('0x3')||_0xd8e3f8[_0x074d('0x4')]===0x0)){return _0x2c4122(_0x074d('0x8'));}try{_0x2c28d7=fs['readFileSync'](_0x3b6b3a)[_0x074d('0x9')](_0x074d('0xa'));}catch(_0x3cac42){return _0x2c4122(_0x3cac42);}return _0x19ff78({'method':_0x074d('0xb'),'uri':host+_0x074d('0xc')+_0xc18df,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0xd8e3f8},'audio':{'content':_0x2c28d7}},'json':!![]});});};