Built motion from commit (unavailable).|2.3.2
[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 _0x1692=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3','path','bluebird','aws-sdk','AudioStream','writeFile'];(function(_0x37a9d7,_0x2b6fde){var _0x1343d3=function(_0x3bde45){while(--_0x3bde45){_0x37a9d7['push'](_0x37a9d7['shift']());}};_0x1343d3(++_0x2b6fde);}(_0x1692,0x109));var _0x2169=function(_0x50c718,_0x267b32){_0x50c718=_0x50c718-0x0;var _0x2bcabf=_0x1692[_0x50c718];return _0x2bcabf;};'use strict';var fs=require('fs');var path=require(_0x2169('0x0'));var BPromise=require(_0x2169('0x1'));var rs=require('randomstring');var AWS=require(_0x2169('0x2'));function pollyResult(_0x433655,_0x687eec,_0x2bc03b){return new BPromise(function(_0x204ca4,_0x4a250f){_0x433655['synthesizeSpeech'](_0x687eec,function(_0x2a58ff,_0x4363f2){if(_0x2a58ff){_0x4a250f(_0x2a58ff);}else if(_0x4363f2){if(_0x4363f2[_0x2169('0x3')]instanceof Buffer){fs[_0x2169('0x4')](_0x2bc03b,_0x4363f2[_0x2169('0x3')],function(_0x17034e){if(_0x17034e){_0x4a250f(_0x17034e);}else{_0x204ca4();}});}else{_0x4a250f(new Error(_0x2169('0x5')));}}else{_0x4a250f(new Error(_0x2169('0x6')));}});});}module['exports']=function(_0x192e91,_0x49fd1c,_0x49cabf,_0x8848e4,_0xb12ff9,_0x24431b,_0x49dd5d){var _0x41ba5f=new AWS[(_0x2169('0x7'))]({'accessKeyId':_0x192e91,'secretAccessKey':_0x49fd1c,'region':_0x49cabf});var _0xc6dc02={'Text':_0xb12ff9,'TextType':_0x24431b||_0x2169('0x8'),'OutputFormat':_0x2169('0x9'),'VoiceId':_0x8848e4};return pollyResult(_0x41ba5f,_0xc6dc02,_0x49dd5d);};