Built motion from commit (unavailable).|2.5.0
[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 _0x28b2=['stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s'];(function(_0x148915,_0x36b71d){var _0x4dc4a5=function(_0x313079){while(--_0x313079){_0x148915['push'](_0x148915['shift']());}};_0x4dc4a5(++_0x36b71d);}(_0x28b2,0xae));var _0x228b=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x28b2[_0x1928c9];return _0x51b5fb;};'use strict';var _=require('lodash');var util=require(_0x228b('0x0'));var moment=require(_0x228b('0x1'));var BPromise=require(_0x228b('0x2'));var rs=require(_0x228b('0x3'));var fs=require('fs');var Redis=require(_0x228b('0x4'));var db=require(_0x228b('0x5'))['db'];var utils=require(_0x228b('0x6'));var logger=require('../../config/logger')(_0x228b('0x7'));var config=require(_0x228b('0x8'));var jayson=require(_0x228b('0x9'));var client=jayson['client'][_0x228b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11fce0,_0x46b83e,_0xa197ff){return new BPromise(function(_0x38603f,_0x187ad7){return client[_0x228b('0xb')](_0x11fce0,_0xa197ff)[_0x228b('0xc')](function(_0x45beb3){logger[_0x228b('0xd')](_0x228b('0xe'),_0x46b83e,_0x228b('0xf'));logger[_0x228b('0x10')](_0x228b('0x11'),_0x46b83e,_0x228b('0xf'),JSON[_0x228b('0x12')](_0x45beb3));if(_0x45beb3[_0x228b('0x13')]){if(_0x45beb3[_0x228b('0x13')][_0x228b('0x14')]===0x1f4){logger[_0x228b('0x13')](_0x228b('0xe'),_0x46b83e,_0x45beb3['error']['message']);return _0x187ad7(_0x45beb3[_0x228b('0x13')][_0x228b('0x15')]);}logger[_0x228b('0x13')]('MailServerOut,\x20%s,\x20%s',_0x46b83e,_0x45beb3[_0x228b('0x13')]['message']);return _0x38603f(_0x45beb3['error']['message']);}else{logger[_0x228b('0xd')](_0x228b('0xe'),_0x46b83e,'request\x20sent');_0x38603f(_0x45beb3[_0x228b('0x16')][_0x228b('0x15')]);}})[_0x228b('0x17')](function(_0x591fda){logger['error'](_0x228b('0xe'),_0x46b83e,_0x591fda);_0x187ad7(_0x591fda);});});}