Built motion from commit (unavailable).|2.5.12
[motion2.git] / server / services / agi / scripts / aws / polly / 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 _0x6e1e=['aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird','randomstring'];(function(_0x43dc7e,_0x49a390){var _0x21e12d=function(_0x15cc1a){while(--_0x15cc1a){_0x43dc7e['push'](_0x43dc7e['shift']());}};_0x21e12d(++_0x49a390);}(_0x6e1e,0x1a1));var _0xe6e1=function(_0x5eb355,_0x400565){_0x5eb355=_0x5eb355-0x0;var _0x5438af=_0x6e1e[_0x5eb355];return _0x5438af;};'use strict';var fs=require('fs');var path=require(_0xe6e1('0x0'));var BPromise=require(_0xe6e1('0x1'));var rs=require(_0xe6e1('0x2'));var AWS=require(_0xe6e1('0x3'));function pollyResult(_0x59ca50,_0x3c35cd,_0x23bfb6){return new BPromise(function(_0x308d05,_0x5170e3){_0x59ca50[_0xe6e1('0x4')](_0x3c35cd,function(_0x577b24,_0x1a61d6){if(_0x577b24){_0x5170e3(_0x577b24);}else if(_0x1a61d6){if(_0x1a61d6[_0xe6e1('0x5')]instanceof Buffer){fs[_0xe6e1('0x6')](_0x23bfb6,_0x1a61d6[_0xe6e1('0x5')],function(_0x559f39){if(_0x559f39){_0x5170e3(_0x559f39);}else{_0x308d05();}});}else{_0x5170e3(new Error(_0xe6e1('0x7')));}}else{_0x5170e3(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0xe6e1('0x8')]=function(_0x5b718a,_0x3fcd24,_0x490963,_0x3df98b,_0x5f0d45,_0x181dd2,_0x4747e6){var _0x2decde=new AWS[(_0xe6e1('0x9'))]({'accessKeyId':_0x5b718a,'secretAccessKey':_0x3fcd24,'region':_0x490963});var _0x9765fe={'Text':_0x5f0d45,'TextType':_0x181dd2||_0xe6e1('0xa'),'OutputFormat':_0xe6e1('0xb'),'VoiceId':_0x3df98b};return pollyResult(_0x2decde,_0x9765fe,_0x4747e6);};