Built motion from commit 10af8726.|2.6.34
[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 _0x2821=['url','bluebird','https://speech.googleapis.com','exports','string','filepath\x20should\x20be\x20a\x20string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','toString','base64','POST','/v1/speech:recognize?key=','8000'];(function(_0x13debf,_0x247a58){var _0x43483e=function(_0x12718f){while(--_0x12718f){_0x13debf['push'](_0x13debf['shift']());}};_0x43483e(++_0x247a58);}(_0x2821,0x87));var _0x1282=function(_0x54657a,_0x51aa2f){_0x54657a=_0x54657a-0x0;var _0xc9daa8=_0x2821[_0x54657a];return _0xc9daa8;};'use strict';var url=require(_0x1282('0x0'));var BPromise=require(_0x1282('0x1'));var fs=require('fs');var host=_0x1282('0x2');module[_0x1282('0x3')]=function(_0x27c0ae,_0x1bebaa,_0x279fa6){return new BPromise(function(_0x1e303b,_0x3f5e68){var _0x7c8e0f;if(typeof _0x27c0ae!==_0x1282('0x4')||_0x27c0ae['length']===0x0){return _0x3f5e68(_0x1282('0x5'));}if(typeof _0x1bebaa!==_0x1282('0x4')||_0x1bebaa[_0x1282('0x6')]===0x0){return _0x3f5e68(_0x1282('0x7'));}if(typeof _0x279fa6!==_0x1282('0x8')&&(typeof _0x279fa6!==_0x1282('0x4')||_0x279fa6[_0x1282('0x6')]===0x0)){return _0x3f5e68(_0x1282('0x9'));}try{_0x7c8e0f=fs['readFileSync'](_0x27c0ae)[_0x1282('0xa')](_0x1282('0xb'));}catch(_0x3bda99){return _0x3f5e68(_0x3bda99);}return _0x1e303b({'method':_0x1282('0xc'),'uri':host+_0x1282('0xd')+_0x1bebaa,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x1282('0xe'),'languageCode':_0x279fa6},'audio':{'content':_0x7c8e0f}},'json':!![]});});};