1 // *************************************************************************
3 // * xCALLY Motion - The Omnichannel Contact Center *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved *
6 // *************************************************************************
8 // * Email: info@xcally.com *
9 // * Website: https://www.xcally.com *
11 // *************************************************************************
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. *
17 // *************************************************************************
18 var _0xd275=['path','bluebird','randomstring','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3'];(function(_0x59db5c,_0x106794){var _0x2e46e5=function(_0x360ea1){while(--_0x360ea1){_0x59db5c['push'](_0x59db5c['shift']());}};_0x2e46e5(++_0x106794);}(_0xd275,0x1b0));var _0x5d27=function(_0x29a91c,_0x5ac2c5){_0x29a91c=_0x29a91c-0x0;var _0x2ab4ff=_0xd275[_0x29a91c];return _0x2ab4ff;};'use strict';var fs=require('fs');var path=require(_0x5d27('0x0'));var BPromise=require(_0x5d27('0x1'));var rs=require(_0x5d27('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x3f71b2,_0x171c18,_0x513693){return new BPromise(function(_0x17a16b,_0x128f1c){_0x3f71b2['synthesizeSpeech'](_0x171c18,function(_0x3d2e7b,_0x1663e4){if(_0x3d2e7b){_0x128f1c(_0x3d2e7b);}else if(_0x1663e4){if(_0x1663e4[_0x5d27('0x3')]instanceof Buffer){fs[_0x5d27('0x4')](_0x513693,_0x1663e4[_0x5d27('0x3')],function(_0x28b5d8){if(_0x28b5d8){_0x128f1c(_0x28b5d8);}else{_0x17a16b();}});}else{_0x128f1c(new Error(_0x5d27('0x5')));}}else{_0x128f1c(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module['exports']=function(_0x3fe761,_0x596f2f,_0x5e1a2d,_0x5289c4,_0x3fa94f,_0x185e39,_0x45b6fa){var _0x5e6382=new AWS[(_0x5d27('0x6'))]({'accessKeyId':_0x3fe761,'secretAccessKey':_0x596f2f,'region':_0x5e1a2d});var _0x37a0b3={'Text':_0x3fa94f,'TextType':_0x185e39||_0x5d27('0x7'),'OutputFormat':_0x5d27('0x8'),'VoiceId':_0x5289c4};return pollyResult(_0x5e6382,_0x37a0b3,_0x45b6fa);};