Built motion from commit (unavailable).|2.5.14
[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 _0xb7d9=['exports','Polly','text','mp3','bluebird','randomstring','synthesizeSpeech','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x32cce8,_0x18762f){var _0x4a732b=function(_0x5a3a21){while(--_0x5a3a21){_0x32cce8['push'](_0x32cce8['shift']());}};_0x4a732b(++_0x18762f);}(_0xb7d9,0xd5));var _0x9b7d=function(_0x26236f,_0x36916c){_0x26236f=_0x26236f-0x0;var _0x11c59f=_0xb7d9[_0x26236f];return _0x11c59f;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x9b7d('0x0'));var rs=require(_0x9b7d('0x1'));var AWS=require('aws-sdk');function pollyResult(_0x5160f1,_0x3053f8,_0x4a9931){return new BPromise(function(_0x594a78,_0x545888){_0x5160f1[_0x9b7d('0x2')](_0x3053f8,function(_0x106750,_0x4a54ad){if(_0x106750){_0x545888(_0x106750);}else if(_0x4a54ad){if(_0x4a54ad['AudioStream']instanceof Buffer){fs[_0x9b7d('0x3')](_0x4a9931,_0x4a54ad[_0x9b7d('0x4')],function(_0x3a5a03){if(_0x3a5a03){_0x545888(_0x3a5a03);}else{_0x594a78();}});}else{_0x545888(new Error(_0x9b7d('0x5')));}}else{_0x545888(new Error(_0x9b7d('0x6')));}});});}module[_0x9b7d('0x7')]=function(_0xf3a8fc,_0x1e769b,_0x4110e4,_0x2b03c6,_0x13ca00,_0x2423b2,_0x74eca3){var _0xf2a9e7=new AWS[(_0x9b7d('0x8'))]({'accessKeyId':_0xf3a8fc,'secretAccessKey':_0x1e769b,'region':_0x4110e4});var _0x137174={'Text':_0x13ca00,'TextType':_0x2423b2||_0x9b7d('0x9'),'OutputFormat':_0x9b7d('0xa'),'VoiceId':_0x2b03c6};return pollyResult(_0xf2a9e7,_0x137174,_0x74eca3);};