Built motion from commit (unavailable).|2.4.18
[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 _0xeeb7=['AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3','bluebird','randomstring','aws-sdk','synthesizeSpeech'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xeeb7,0x1d5));var _0x7eeb=function(_0x377a6e,_0x59b99d){_0x377a6e=_0x377a6e-0x0;var _0x37f751=_0xeeb7[_0x377a6e];return _0x37f751;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x7eeb('0x0'));var rs=require(_0x7eeb('0x1'));var AWS=require(_0x7eeb('0x2'));function pollyResult(_0x56c39e,_0x53e34f,_0x59ceda){return new BPromise(function(_0x16c310,_0x3cbe00){_0x56c39e[_0x7eeb('0x3')](_0x53e34f,function(_0x2bf73e,_0x108d49){if(_0x2bf73e){_0x3cbe00(_0x2bf73e);}else if(_0x108d49){if(_0x108d49[_0x7eeb('0x4')]instanceof Buffer){fs[_0x7eeb('0x5')](_0x59ceda,_0x108d49[_0x7eeb('0x4')],function(_0x366e62){if(_0x366e62){_0x3cbe00(_0x366e62);}else{_0x16c310();}});}else{_0x3cbe00(new Error(_0x7eeb('0x6')));}}else{_0x3cbe00(new Error(_0x7eeb('0x7')));}});});}module['exports']=function(_0x1f10a4,_0x5b966c,_0x30fb4a,_0x4f181c,_0xcb78b6,_0x55638f,_0x31eee0){var _0x4fc42e=new AWS[(_0x7eeb('0x8'))]({'accessKeyId':_0x1f10a4,'secretAccessKey':_0x5b966c,'region':_0x30fb4a});var _0x5c6fd0={'Text':_0xcb78b6,'TextType':_0x55638f||_0x7eeb('0x9'),'OutputFormat':_0x7eeb('0xa'),'VoiceId':_0x4f181c};return pollyResult(_0x4fc42e,_0x5c6fd0,_0x31eee0);};