Built motion from commit (unavailable).|2.5.8
[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 _0xf37d=['aws-sdk','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','mp3','path','bluebird'];(function(_0x172ed7,_0x3d08fd){var _0xfa8f61=function(_0xe07a21){while(--_0xe07a21){_0x172ed7['push'](_0x172ed7['shift']());}};_0xfa8f61(++_0x3d08fd);}(_0xf37d,0x1ac));var _0xdf37=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0xf37d[_0x2080a3];return _0x8d7d17;};'use strict';var fs=require('fs');var path=require(_0xdf37('0x0'));var BPromise=require(_0xdf37('0x1'));var rs=require('randomstring');var AWS=require(_0xdf37('0x2'));function pollyResult(_0x48c96f,_0x4f890c,_0x3dbbec){return new BPromise(function(_0x12096b,_0x101ea4){_0x48c96f['synthesizeSpeech'](_0x4f890c,function(_0x37df42,_0x428ae3){if(_0x37df42){_0x101ea4(_0x37df42);}else if(_0x428ae3){if(_0x428ae3[_0xdf37('0x3')]instanceof Buffer){fs[_0xdf37('0x4')](_0x3dbbec,_0x428ae3[_0xdf37('0x3')],function(_0x1a5262){if(_0x1a5262){_0x101ea4(_0x1a5262);}else{_0x12096b();}});}else{_0x101ea4(new Error(_0xdf37('0x5')));}}else{_0x101ea4(new Error(_0xdf37('0x6')));}});});}module[_0xdf37('0x7')]=function(_0x4e6480,_0x41deec,_0x2f091e,_0x35106d,_0x23e002,_0x1efb4d,_0x355e47){var _0x126a80=new AWS['Polly']({'accessKeyId':_0x4e6480,'secretAccessKey':_0x41deec,'region':_0x2f091e});var _0x13ab49={'Text':_0x23e002,'TextType':_0x1efb4d||_0xdf37('0x8'),'OutputFormat':_0xdf37('0x9'),'VoiceId':_0x35106d};return pollyResult(_0x126a80,_0x13ab49,_0x355e47);};