1ffb23a23d4c9947c943a68e6489fb5b28f9b1d3
[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 _0xeafb=['Polly','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports'];(function(_0x4b4f24,_0x5654a8){var _0x1c13d4=function(_0x4940bf){while(--_0x4940bf){_0x4b4f24['push'](_0x4b4f24['shift']());}};_0x1c13d4(++_0x5654a8);}(_0xeafb,0x1b2));var _0xbeaf=function(_0x2b18c9,_0x49659f){_0x2b18c9=_0x2b18c9-0x0;var _0x8b913c=_0xeafb[_0x2b18c9];return _0x8b913c;};'use strict';var fs=require('fs');var path=require(_0xbeaf('0x0'));var BPromise=require(_0xbeaf('0x1'));var rs=require(_0xbeaf('0x2'));var AWS=require(_0xbeaf('0x3'));function pollyResult(_0x29e43c,_0x213e18,_0x928f30){return new BPromise(function(_0x1425ef,_0x2a2920){_0x29e43c[_0xbeaf('0x4')](_0x213e18,function(_0x4a4f12,_0x3d644b){if(_0x4a4f12){_0x2a2920(_0x4a4f12);}else if(_0x3d644b){if(_0x3d644b[_0xbeaf('0x5')]instanceof Buffer){fs[_0xbeaf('0x6')](_0x928f30,_0x3d644b[_0xbeaf('0x5')],function(_0x7cfc93){if(_0x7cfc93){_0x2a2920(_0x7cfc93);}else{_0x1425ef();}});}else{_0x2a2920(new Error(_0xbeaf('0x7')));}}else{_0x2a2920(new Error(_0xbeaf('0x8')));}});});}module[_0xbeaf('0x9')]=function(_0x1d72aa,_0x2fe68f,_0x44dea4,_0x4332aa,_0x34743a,_0xfd033e,_0xc88adc){var _0x4d9eb9=new AWS[(_0xbeaf('0xa'))]({'accessKeyId':_0x1d72aa,'secretAccessKey':_0x2fe68f,'region':_0x44dea4});var _0x26fe9e={'Text':_0x34743a,'TextType':_0xfd033e||'text','OutputFormat':_0xbeaf('0xb'),'VoiceId':_0x4332aa};return pollyResult(_0x4d9eb9,_0x26fe9e,_0xc88adc);};