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 _0xf7b5=['path','bluebird','randomstring','aws-sdk','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf7b5,0x1c2));var _0x5f7b=function(_0x54edc9,_0x345f01){_0x54edc9=_0x54edc9-0x0;var _0x2ae7a9=_0xf7b5[_0x54edc9];return _0x2ae7a9;};'use strict';var fs=require('fs');var path=require(_0x5f7b('0x0'));var BPromise=require(_0x5f7b('0x1'));var rs=require(_0x5f7b('0x2'));var AWS=require(_0x5f7b('0x3'));function pollyResult(_0x1093c0,_0x5081a5,_0x5b873f){return new BPromise(function(_0x50b658,_0x5429e2){_0x1093c0['synthesizeSpeech'](_0x5081a5,function(_0xb7c07c,_0x269f54){if(_0xb7c07c){_0x5429e2(_0xb7c07c);}else if(_0x269f54){if(_0x269f54['AudioStream']instanceof Buffer){fs[_0x5f7b('0x4')](_0x5b873f,_0x269f54['AudioStream'],function(_0x12f9ec){if(_0x12f9ec){_0x5429e2(_0x12f9ec);}else{_0x50b658();}});}else{_0x5429e2(new Error(_0x5f7b('0x5')));}}else{_0x5429e2(new Error(_0x5f7b('0x6')));}});});}module['exports']=function(_0x376909,_0x500ac0,_0x8c7629,_0x2fbea1,_0x286a50,_0x2f13f6,_0x214a16){var _0x2d9fe3=new AWS[(_0x5f7b('0x7'))]({'accessKeyId':_0x376909,'secretAccessKey':_0x500ac0,'region':_0x8c7629});var _0x3c7f34={'Text':_0x286a50,'TextType':_0x2f13f6||_0x5f7b('0x8'),'OutputFormat':_0x5f7b('0x9'),'VoiceId':_0x2fbea1};return pollyResult(_0x2d9fe3,_0x3c7f34,_0x214a16);};