Built motion from commit a61a4a20.|2.5.46
[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 _0x892c=['path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3'];(function(_0x5a95e8,_0x3d7f25){var _0x213601=function(_0x46146c){while(--_0x46146c){_0x5a95e8['push'](_0x5a95e8['shift']());}};_0x213601(++_0x3d7f25);}(_0x892c,0x197));var _0xc892=function(_0x12f570,_0x2bdad1){_0x12f570=_0x12f570-0x0;var _0x820efc=_0x892c[_0x12f570];return _0x820efc;};'use strict';var fs=require('fs');var path=require(_0xc892('0x0'));var BPromise=require(_0xc892('0x1'));var rs=require(_0xc892('0x2'));var AWS=require(_0xc892('0x3'));function pollyResult(_0x4e6169,_0x2dafcd,_0x57af39){return new BPromise(function(_0x464486,_0x5effed){_0x4e6169[_0xc892('0x4')](_0x2dafcd,function(_0x12536c,_0x91fd93){if(_0x12536c){_0x5effed(_0x12536c);}else if(_0x91fd93){if(_0x91fd93[_0xc892('0x5')]instanceof Buffer){fs['writeFile'](_0x57af39,_0x91fd93['AudioStream'],function(_0x1e801b){if(_0x1e801b){_0x5effed(_0x1e801b);}else{_0x464486();}});}else{_0x5effed(new Error(_0xc892('0x6')));}}else{_0x5effed(new Error(_0xc892('0x7')));}});});}module['exports']=function(_0x3aa53f,_0x30e23c,_0x2019e8,_0x226364,_0x455724,_0x518718,_0x346524){var _0x4a9815=new AWS[(_0xc892('0x8'))]({'accessKeyId':_0x3aa53f,'secretAccessKey':_0x30e23c,'region':_0x2019e8});var _0x5074c0={'Text':_0x455724,'TextType':_0x518718||_0xc892('0x9'),'OutputFormat':_0xc892('0xa'),'VoiceId':_0x226364};return pollyResult(_0x4a9815,_0x5074c0,_0x346524);};