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 _0xf7d7=['aws-sdk','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3','path','bluebird'];(function(_0x5e07c1,_0x287430){var _0x634cea=function(_0x8008ef){while(--_0x8008ef){_0x5e07c1['push'](_0x5e07c1['shift']());}};_0x634cea(++_0x287430);}(_0xf7d7,0xbc));var _0x7f7d=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0xf7d7[_0x5a95fa];return _0x1a61b8;};'use strict';var fs=require('fs');var path=require(_0x7f7d('0x0'));var BPromise=require(_0x7f7d('0x1'));var rs=require('randomstring');var AWS=require(_0x7f7d('0x2'));function pollyResult(_0x3a2256,_0x18abfa,_0x1b68a3){return new BPromise(function(_0x602e32,_0x26af48){_0x3a2256['synthesizeSpeech'](_0x18abfa,function(_0x539984,_0x2401dc){if(_0x539984){_0x26af48(_0x539984);}else if(_0x2401dc){if(_0x2401dc[_0x7f7d('0x3')]instanceof Buffer){fs[_0x7f7d('0x4')](_0x1b68a3,_0x2401dc['AudioStream'],function(_0x4a7ebf){if(_0x4a7ebf){_0x26af48(_0x4a7ebf);}else{_0x602e32();}});}else{_0x26af48(new Error(_0x7f7d('0x5')));}}else{_0x26af48(new Error(_0x7f7d('0x6')));}});});}module['exports']=function(_0x353084,_0xe15cf8,_0xaa6102,_0x4cd254,_0x4d02e2,_0x4ec0ff,_0x1b2bd4){var _0x5c1a72=new AWS[(_0x7f7d('0x7'))]({'accessKeyId':_0x353084,'secretAccessKey':_0xe15cf8,'region':_0xaa6102});var _0x431546={'Text':_0x4d02e2,'TextType':_0x4ec0ff||_0x7f7d('0x8'),'OutputFormat':_0x7f7d('0x9'),'VoiceId':_0x4cd254};return pollyResult(_0x5c1a72,_0x431546,_0x1b2bd4);};