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 _0xbaf8=['Polly','text','mp3','path','bluebird','synthesizeSpeech','AudioStream','exports'];(function(_0x54888e,_0x3b962f){var _0x2113ad=function(_0x563202){while(--_0x563202){_0x54888e['push'](_0x54888e['shift']());}};_0x2113ad(++_0x3b962f);}(_0xbaf8,0x11b));var _0x8baf=function(_0x153863,_0x41363d){_0x153863=_0x153863-0x0;var _0x3bfc32=_0xbaf8[_0x153863];return _0x3bfc32;};'use strict';var fs=require('fs');var path=require(_0x8baf('0x0'));var BPromise=require(_0x8baf('0x1'));var rs=require('randomstring');var AWS=require('aws-sdk');function pollyResult(_0x368213,_0x25edc3,_0x5c339e){return new BPromise(function(_0x1336ba,_0x379c34){_0x368213[_0x8baf('0x2')](_0x25edc3,function(_0x2736bb,_0x162ac7){if(_0x2736bb){_0x379c34(_0x2736bb);}else if(_0x162ac7){if(_0x162ac7[_0x8baf('0x3')]instanceof Buffer){fs['writeFile'](_0x5c339e,_0x162ac7['AudioStream'],function(_0x5a63b5){if(_0x5a63b5){_0x379c34(_0x5a63b5);}else{_0x1336ba();}});}else{_0x379c34(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x379c34(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x8baf('0x4')]=function(_0x582cbf,_0x21f7a9,_0x22bb59,_0x46637c,_0x562ca0,_0x250099,_0x4eb01a){var _0x1e4a69=new AWS[(_0x8baf('0x5'))]({'accessKeyId':_0x582cbf,'secretAccessKey':_0x21f7a9,'region':_0x22bb59});var _0x51f284={'Text':_0x562ca0,'TextType':_0x250099||_0x8baf('0x6'),'OutputFormat':_0x8baf('0x7'),'VoiceId':_0x46637c};return pollyResult(_0x1e4a69,_0x51f284,_0x4eb01a);};