Built motion from commit 753c950e.|2.5.42
[motion2.git] / server / api / cmList / cmList.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 _0x78a0=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird'];(function(_0x25d6f2,_0x162bf0){var _0x64fdcd=function(_0x20e5b7){while(--_0x20e5b7){_0x25d6f2['push'](_0x25d6f2['shift']());}};_0x64fdcd(++_0x162bf0);}(_0x78a0,0xf7));var _0x078a=function(_0x5b7606,_0x3367ef){_0x5b7606=_0x5b7606-0x0;var _0x186584=_0x78a0[_0x5b7606];return _0x186584;};'use strict';var _=require('lodash');var util=require(_0x078a('0x0'));var moment=require(_0x078a('0x1'));var BPromise=require(_0x078a('0x2'));var rs=require(_0x078a('0x3'));var fs=require('fs');var Redis=require(_0x078a('0x4'));var db=require(_0x078a('0x5'))['db'];var utils=require(_0x078a('0x6'));var logger=require(_0x078a('0x7'))('rpc');var config=require(_0x078a('0x8'));var jayson=require(_0x078a('0x9'));var client=jayson['client'][_0x078a('0xa')]({'port':0x232a});config['redis']=_[_0x078a('0xb')](config['redis'],{'host':_0x078a('0xc'),'port':0x18eb});var socket=require(_0x078a('0xd'))(new Redis(config[_0x078a('0xe')]));require('./cmList.socket')['register'](socket);function respondWithRpcPromise(_0x5a79de,_0x10691c,_0x61499d){return new BPromise(function(_0x3c81e6,_0x2f6c9b){return client['request'](_0x5a79de,_0x61499d)['then'](function(_0x56e692){logger[_0x078a('0xf')](_0x078a('0x10'),_0x10691c,_0x078a('0x11'));logger[_0x078a('0x12')](_0x078a('0x13'),_0x10691c,_0x078a('0x11'),JSON[_0x078a('0x14')](_0x56e692));if(_0x56e692[_0x078a('0x15')]){if(_0x56e692[_0x078a('0x15')][_0x078a('0x16')]===0x1f4){logger[_0x078a('0x15')](_0x078a('0x10'),_0x10691c,_0x56e692[_0x078a('0x15')][_0x078a('0x17')]);return _0x2f6c9b(_0x56e692[_0x078a('0x15')][_0x078a('0x17')]);}logger['error'](_0x078a('0x10'),_0x10691c,_0x56e692[_0x078a('0x15')]['message']);return _0x3c81e6(_0x56e692['error'][_0x078a('0x17')]);}else{logger[_0x078a('0xf')]('CmList,\x20%s,\x20%s',_0x10691c,_0x078a('0x11'));_0x3c81e6(_0x56e692['result']['message']);}})[_0x078a('0x18')](function(_0x276c95){logger[_0x078a('0x15')](_0x078a('0x10'),_0x10691c,_0x276c95);_0x2f6c9b(_0x276c95);});});}