Built motion from commit (unavailable).|2.5.6
[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 _0xc30d=['writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream'];(function(_0x247d60,_0x1a3ebf){var _0x3a0251=function(_0x386c88){while(--_0x386c88){_0x247d60['push'](_0x247d60['shift']());}};_0x3a0251(++_0x1a3ebf);}(_0xc30d,0xd6));var _0xdc30=function(_0x3eea50,_0x54d651){_0x3eea50=_0x3eea50-0x0;var _0x3f1f0e=_0xc30d[_0x3eea50];return _0x3f1f0e;};'use strict';var fs=require('fs');var path=require(_0xdc30('0x0'));var BPromise=require(_0xdc30('0x1'));var rs=require(_0xdc30('0x2'));var AWS=require(_0xdc30('0x3'));function pollyResult(_0x116ce4,_0x15b974,_0x511502){return new BPromise(function(_0x5a57e4,_0x514f66){_0x116ce4[_0xdc30('0x4')](_0x15b974,function(_0x55417a,_0x3e714d){if(_0x55417a){_0x514f66(_0x55417a);}else if(_0x3e714d){if(_0x3e714d[_0xdc30('0x5')]instanceof Buffer){fs[_0xdc30('0x6')](_0x511502,_0x3e714d[_0xdc30('0x5')],function(_0x3a9893){if(_0x3a9893){_0x514f66(_0x3a9893);}else{_0x5a57e4();}});}else{_0x514f66(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x514f66(new Error(_0xdc30('0x7')));}});});}module['exports']=function(_0x32b62a,_0x1a76ba,_0x3d1d3e,_0x21e13f,_0x1604b5,_0x2362d0,_0x1c2d8e){var _0x2a3426=new AWS[(_0xdc30('0x8'))]({'accessKeyId':_0x32b62a,'secretAccessKey':_0x1a76ba,'region':_0x3d1d3e});var _0x43e1a1={'Text':_0x1604b5,'TextType':_0x2362d0||_0xdc30('0x9'),'OutputFormat':'mp3','VoiceId':_0x21e13f};return pollyResult(_0x2a3426,_0x43e1a1,_0x1c2d8e);};