Built motion from commit (unavailable).|2.0.73
[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 _0xe3c7=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','path','bluebird','synthesizeSpeech','AudioStream','writeFile'];(function(_0x53056c,_0x1d56a9){var _0x5cec88=function(_0x2ad06b){while(--_0x2ad06b){_0x53056c['push'](_0x53056c['shift']());}};_0x5cec88(++_0x1d56a9);}(_0xe3c7,0x1b3));var _0x7e3c=function(_0x193551,_0x29ab95){_0x193551=_0x193551-0x0;var _0x188c8f=_0xe3c7[_0x193551];return _0x188c8f;};'use strict';var fs=require('fs');var path=require(_0x7e3c('0x0'));var BPromise=require(_0x7e3c('0x1'));var rs=require('randomstring');var AWS=require('aws-sdk');function pollyResult(_0x507253,_0x30c2c7,_0x252b06){return new BPromise(function(_0x95ab66,_0x43dc26){_0x507253[_0x7e3c('0x2')](_0x30c2c7,function(_0x5650e8,_0x13a54a){if(_0x5650e8){_0x43dc26(_0x5650e8);}else if(_0x13a54a){if(_0x13a54a[_0x7e3c('0x3')]instanceof Buffer){fs[_0x7e3c('0x4')](_0x252b06,_0x13a54a[_0x7e3c('0x3')],function(_0x44ba29){if(_0x44ba29){_0x43dc26(_0x44ba29);}else{_0x95ab66();}});}else{_0x43dc26(new Error(_0x7e3c('0x5')));}}else{_0x43dc26(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x7e3c('0x6')]=function(_0x112dd1,_0x1d0bd8,_0x5005c8,_0x5ed16a,_0x7903a3,_0x4f9944,_0x43671d){var _0x230ddf=new AWS[(_0x7e3c('0x7'))]({'accessKeyId':_0x112dd1,'secretAccessKey':_0x1d0bd8,'region':_0x5005c8});var _0x5d569a={'Text':_0x7903a3,'TextType':_0x4f9944||'text','OutputFormat':'mp3','VoiceId':_0x5ed16a};return pollyResult(_0x230ddf,_0x5d569a,_0x43671d);};