Built motion from commit (unavailable).|2.4.20
[motion2.git] / server / api / mailServerOut / mailServerOut.rpc.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 _0xbaa1=['request\x20sent','stringify','error','code','message','info','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','MailServerOut,\x20%s,\x20%s'];(function(_0x52ab84,_0x384d32){var _0x481d6a=function(_0x2dc2cc){while(--_0x2dc2cc){_0x52ab84['push'](_0x52ab84['shift']());}};_0x481d6a(++_0x384d32);}(_0xbaa1,0x1bc));var _0x1baa=function(_0x2b6b94,_0x45e9fc){_0x2b6b94=_0x2b6b94-0x0;var _0x5e98a7=_0xbaa1[_0x2b6b94];return _0x5e98a7;};'use strict';var _=require(_0x1baa('0x0'));var util=require(_0x1baa('0x1'));var moment=require(_0x1baa('0x2'));var BPromise=require('bluebird');var rs=require(_0x1baa('0x3'));var fs=require('fs');var Redis=require(_0x1baa('0x4'));var db=require(_0x1baa('0x5'))['db'];var utils=require(_0x1baa('0x6'));var logger=require('../../config/logger')(_0x1baa('0x7'));var config=require(_0x1baa('0x8'));var jayson=require(_0x1baa('0x9'));var client=jayson['client'][_0x1baa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4904dc,_0x2e1d51,_0x46d2cd){return new BPromise(function(_0x3e97ae,_0x163e57){return client['request'](_0x4904dc,_0x46d2cd)['then'](function(_0x56b384){logger['info'](_0x1baa('0xb'),_0x2e1d51,'request\x20sent');logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0x2e1d51,_0x1baa('0xc'),JSON[_0x1baa('0xd')](_0x56b384));if(_0x56b384['error']){if(_0x56b384[_0x1baa('0xe')][_0x1baa('0xf')]===0x1f4){logger[_0x1baa('0xe')](_0x1baa('0xb'),_0x2e1d51,_0x56b384[_0x1baa('0xe')][_0x1baa('0x10')]);return _0x163e57(_0x56b384['error'][_0x1baa('0x10')]);}logger[_0x1baa('0xe')](_0x1baa('0xb'),_0x2e1d51,_0x56b384[_0x1baa('0xe')][_0x1baa('0x10')]);return _0x3e97ae(_0x56b384['error'][_0x1baa('0x10')]);}else{logger[_0x1baa('0x11')](_0x1baa('0xb'),_0x2e1d51,_0x1baa('0xc'));_0x3e97ae(_0x56b384[_0x1baa('0x12')][_0x1baa('0x10')]);}})['catch'](function(_0x4989a9){logger[_0x1baa('0xe')](_0x1baa('0xb'),_0x2e1d51,_0x4989a9);_0x163e57(_0x4989a9);});});}