Built motion from commit da617fac.|2.6.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 _0xf2f7=['mp3','randomstring','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text'];(function(_0x1115f5,_0x137af2){var _0x20029b=function(_0x45698f){while(--_0x45698f){_0x1115f5['push'](_0x1115f5['shift']());}};_0x20029b(++_0x137af2);}(_0xf2f7,0x13c));var _0x7f2f=function(_0x27a5dd,_0x35cde6){_0x27a5dd=_0x27a5dd-0x0;var _0x523a2d=_0xf2f7[_0x27a5dd];return _0x523a2d;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require('bluebird');var rs=require(_0x7f2f('0x0'));var AWS=require('aws-sdk');function pollyResult(_0x266b55,_0x45cb0b,_0x8dd364){return new BPromise(function(_0x1d62db,_0x4bb232){_0x266b55[_0x7f2f('0x1')](_0x45cb0b,function(_0x140c29,_0x12469b){if(_0x140c29){_0x4bb232(_0x140c29);}else if(_0x12469b){if(_0x12469b[_0x7f2f('0x2')]instanceof Buffer){fs[_0x7f2f('0x3')](_0x8dd364,_0x12469b['AudioStream'],function(_0x52b580){if(_0x52b580){_0x4bb232(_0x52b580);}else{_0x1d62db();}});}else{_0x4bb232(new Error(_0x7f2f('0x4')));}}else{_0x4bb232(new Error(_0x7f2f('0x5')));}});});}module['exports']=function(_0x209441,_0x2926e7,_0x11d63f,_0x169cc9,_0x31a34f,_0x1c1ae2,_0x411efb){var _0x294fab=new AWS[(_0x7f2f('0x6'))]({'accessKeyId':_0x209441,'secretAccessKey':_0x2926e7,'region':_0x11d63f});var _0x18cdd2={'Text':_0x31a34f,'TextType':_0x1c1ae2||_0x7f2f('0x7'),'OutputFormat':_0x7f2f('0x8'),'VoiceId':_0x169cc9};return pollyResult(_0x294fab,_0x18cdd2,_0x411efb);};