Built motion from commit (unavailable).|2.5.12
[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 _0x39bf=['key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','exports','string','length'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x39bf,0x1e5));var _0xf39b=function(_0x13f0cd,_0x2cd3d2){_0x13f0cd=_0x13f0cd-0x0;var _0x117bee=_0x39bf[_0x13f0cd];return _0x117bee;};'use strict';var url=require(_0xf39b('0x0'));var BPromise=require(_0xf39b('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0xf39b('0x2')]=function(_0x5a6764,_0x13cdc5,_0x1aaf9f){return new BPromise(function(_0x4be97c,_0x4908d6){var _0x40ced9;if(typeof _0x5a6764!==_0xf39b('0x3')||_0x5a6764[_0xf39b('0x4')]===0x0){return _0x4908d6('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x13cdc5!=='string'||_0x13cdc5[_0xf39b('0x4')]===0x0){return _0x4908d6(_0xf39b('0x5'));}if(typeof _0x1aaf9f!=='undefined'&&(typeof _0x1aaf9f!==_0xf39b('0x3')||_0x1aaf9f[_0xf39b('0x4')]===0x0)){return _0x4908d6(_0xf39b('0x6'));}try{_0x40ced9=fs[_0xf39b('0x7')](_0x5a6764)[_0xf39b('0x8')](_0xf39b('0x9'));}catch(_0x719f3){return _0x4908d6(_0x719f3);}return _0x4be97c({'method':_0xf39b('0xa'),'uri':host+_0xf39b('0xb')+_0x13cdc5,'body':{'config':{'encoding':_0xf39b('0xc'),'sampleRateHertz':_0xf39b('0xd'),'languageCode':_0x1aaf9f},'audio':{'content':_0x40ced9}},'json':!![]});});};