Built motion from commit 85328c08.|2.5.50
[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 _0x50f0=['request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info'];(function(_0x2f2004,_0x2ea89a){var _0x2ab262=function(_0x41fe41){while(--_0x41fe41){_0x2f2004['push'](_0x2f2004['shift']());}};_0x2ab262(++_0x2ea89a);}(_0x50f0,0x6b));var _0x050f=function(_0x30bd4d,_0x50eb60){_0x30bd4d=_0x30bd4d-0x0;var _0x306915=_0x50f0[_0x30bd4d];return _0x306915;};'use strict';var _=require(_0x050f('0x0'));var util=require(_0x050f('0x1'));var moment=require(_0x050f('0x2'));var BPromise=require(_0x050f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x050f('0x4'));var db=require(_0x050f('0x5'))['db'];var utils=require(_0x050f('0x6'));var logger=require(_0x050f('0x7'))(_0x050f('0x8'));var config=require('../../config/environment');var jayson=require(_0x050f('0x9'));var client=jayson['client'][_0x050f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2fb30d,_0x2fee32,_0x2944b8){return new BPromise(function(_0x9c050c,_0x5547f4){return client[_0x050f('0xb')](_0x2fb30d,_0x2944b8)['then'](function(_0x41289e){logger[_0x050f('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2fee32,_0x050f('0xd'));logger['debug'](_0x050f('0xe'),_0x2fee32,_0x050f('0xd'),JSON['stringify'](_0x41289e));if(_0x41289e[_0x050f('0xf')]){if(_0x41289e[_0x050f('0xf')][_0x050f('0x10')]===0x1f4){logger[_0x050f('0xf')](_0x050f('0x11'),_0x2fee32,_0x41289e[_0x050f('0xf')][_0x050f('0x12')]);return _0x5547f4(_0x41289e[_0x050f('0xf')][_0x050f('0x12')]);}logger[_0x050f('0xf')](_0x050f('0x11'),_0x2fee32,_0x41289e[_0x050f('0xf')][_0x050f('0x12')]);return _0x9c050c(_0x41289e[_0x050f('0xf')][_0x050f('0x12')]);}else{logger[_0x050f('0xc')](_0x050f('0x11'),_0x2fee32,'request\x20sent');_0x9c050c(_0x41289e[_0x050f('0x13')][_0x050f('0x12')]);}})['catch'](function(_0x12f1b9){logger[_0x050f('0xf')](_0x050f('0x11'),_0x2fee32,_0x12f1b9);_0x5547f4(_0x12f1b9);});});}