Built motion from commit 5293bb2a.|2.6.30
[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 _0xe0f4=['mp3','path','bluebird','randomstring','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text'];(function(_0x4f52b,_0x350118){var _0x54bbad=function(_0x4eff13){while(--_0x4eff13){_0x4f52b['push'](_0x4f52b['shift']());}};_0x54bbad(++_0x350118);}(_0xe0f4,0x18d));var _0x4e0f=function(_0x434295,_0x19cda5){_0x434295=_0x434295-0x0;var _0x251e5a=_0xe0f4[_0x434295];return _0x251e5a;};'use strict';var fs=require('fs');var path=require(_0x4e0f('0x0'));var BPromise=require(_0x4e0f('0x1'));var rs=require(_0x4e0f('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x138199,_0x52c0e,_0x4ac618){return new BPromise(function(_0x1505a9,_0x27849a){_0x138199[_0x4e0f('0x3')](_0x52c0e,function(_0x5324ef,_0x5cbdf8){if(_0x5324ef){_0x27849a(_0x5324ef);}else if(_0x5cbdf8){if(_0x5cbdf8[_0x4e0f('0x4')]instanceof Buffer){fs[_0x4e0f('0x5')](_0x4ac618,_0x5cbdf8[_0x4e0f('0x4')],function(_0x42440a){if(_0x42440a){_0x27849a(_0x42440a);}else{_0x1505a9();}});}else{_0x27849a(new Error(_0x4e0f('0x6')));}}else{_0x27849a(new Error(_0x4e0f('0x7')));}});});}module[_0x4e0f('0x8')]=function(_0x27d567,_0x46b2d0,_0x501fc4,_0x18dd2b,_0x5ae3ab,_0x1912ae,_0x146690){var _0x458fa6=new AWS['Polly']({'accessKeyId':_0x27d567,'secretAccessKey':_0x46b2d0,'region':_0x501fc4});var _0xbcf8f8={'Text':_0x5ae3ab,'TextType':_0x1912ae||_0x4e0f('0x9'),'OutputFormat':_0x4e0f('0xa'),'VoiceId':_0x18dd2b};return pollyResult(_0x458fa6,_0xbcf8f8,_0x146690);};