46009f539d2a6e1c3256aa2859990151b683b01d
[motion2.git] / server / api / chatOfflineMessage / chatOfflineMessage.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 _0x966a=['http','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x234616,_0x2e9486){var _0x5e9290=function(_0x2eb4a7){while(--_0x2eb4a7){_0x234616['push'](_0x234616['shift']());}};_0x5e9290(++_0x2e9486);}(_0x966a,0x138));var _0xa966=function(_0x17edc6,_0x41a70e){_0x17edc6=_0x17edc6-0x0;var _0x30179c=_0x966a[_0x17edc6];return _0x30179c;};'use strict';var _=require(_0xa966('0x0'));var util=require('util');var moment=require(_0xa966('0x1'));var BPromise=require(_0xa966('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa966('0x3'));var db=require(_0xa966('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa966('0x5'))('rpc');var config=require(_0xa966('0x6'));var jayson=require(_0xa966('0x7'));var client=jayson['client'][_0xa966('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5b2197,_0x5e27c3,_0x2907f5){return new BPromise(function(_0x57dd5b,_0x38c7b1){return client['request'](_0x5b2197,_0x2907f5)[_0xa966('0x9')](function(_0xe41693){logger[_0xa966('0xa')](_0xa966('0xb'),_0x5e27c3,_0xa966('0xc'));logger[_0xa966('0xd')](_0xa966('0xe'),_0x5e27c3,_0xa966('0xc'),JSON[_0xa966('0xf')](_0xe41693));if(_0xe41693['error']){if(_0xe41693[_0xa966('0x10')][_0xa966('0x11')]===0x1f4){logger[_0xa966('0x10')](_0xa966('0xb'),_0x5e27c3,_0xe41693[_0xa966('0x10')][_0xa966('0x12')]);return _0x38c7b1(_0xe41693[_0xa966('0x10')][_0xa966('0x12')]);}logger['error'](_0xa966('0xb'),_0x5e27c3,_0xe41693[_0xa966('0x10')][_0xa966('0x12')]);return _0x57dd5b(_0xe41693['error'][_0xa966('0x12')]);}else{logger[_0xa966('0xa')](_0xa966('0xb'),_0x5e27c3,_0xa966('0xc'));_0x57dd5b(_0xe41693[_0xa966('0x13')]['message']);}})['catch'](function(_0x4b3d0f){logger[_0xa966('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5e27c3,_0x4b3d0f);_0x38c7b1(_0x4b3d0f);});});}