cd98df3193a2992600647c351df60c8c524060ee
[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 _0x8e6c=['mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly'];(function(_0x6b0b72,_0x46aff8){var _0x37d3b0=function(_0x531d7a){while(--_0x531d7a){_0x6b0b72['push'](_0x6b0b72['shift']());}};_0x37d3b0(++_0x46aff8);}(_0x8e6c,0x15d));var _0xc8e6=function(_0x2aedab,_0x318f72){_0x2aedab=_0x2aedab-0x0;var _0x814ad3=_0x8e6c[_0x2aedab];return _0x814ad3;};'use strict';var fs=require('fs');var path=require(_0xc8e6('0x0'));var BPromise=require(_0xc8e6('0x1'));var rs=require(_0xc8e6('0x2'));var AWS=require(_0xc8e6('0x3'));function pollyResult(_0x4445b3,_0x92ba51,_0x45fd7c){return new BPromise(function(_0x2406f9,_0x592339){_0x4445b3[_0xc8e6('0x4')](_0x92ba51,function(_0x42013d,_0x35f7cd){if(_0x42013d){_0x592339(_0x42013d);}else if(_0x35f7cd){if(_0x35f7cd[_0xc8e6('0x5')]instanceof Buffer){fs[_0xc8e6('0x6')](_0x45fd7c,_0x35f7cd[_0xc8e6('0x5')],function(_0x2f559a){if(_0x2f559a){_0x592339(_0x2f559a);}else{_0x2406f9();}});}else{_0x592339(new Error(_0xc8e6('0x7')));}}else{_0x592339(new Error(_0xc8e6('0x8')));}});});}module[_0xc8e6('0x9')]=function(_0x3d6979,_0x799eb7,_0x4139e3,_0x2ffba3,_0x9b2748,_0xbebf0d,_0x248fa7){var _0x2de6f1=new AWS[(_0xc8e6('0xa'))]({'accessKeyId':_0x3d6979,'secretAccessKey':_0x799eb7,'region':_0x4139e3});var _0x42e44a={'Text':_0x9b2748,'TextType':_0xbebf0d||'text','OutputFormat':_0xc8e6('0xb'),'VoiceId':_0x2ffba3};return pollyResult(_0x2de6f1,_0x42e44a,_0x248fa7);};