Built motion from commit 3c2ce842.|2.6.31
[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 _0x25d2=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x22f963,_0x4bb343){var _0x3ef3ee=function(_0x1bbbac){while(--_0x1bbbac){_0x22f963['push'](_0x22f963['shift']());}};_0x3ef3ee(++_0x4bb343);}(_0x25d2,0x168));var _0x225d=function(_0x44cf8c,_0x26b091){_0x44cf8c=_0x44cf8c-0x0;var _0x27e480=_0x25d2[_0x44cf8c];return _0x27e480;};'use strict';var _=require(_0x225d('0x0'));var util=require(_0x225d('0x1'));var moment=require(_0x225d('0x2'));var BPromise=require(_0x225d('0x3'));var rs=require(_0x225d('0x4'));var fs=require('fs');var Redis=require(_0x225d('0x5'));var db=require(_0x225d('0x6'))['db'];var utils=require(_0x225d('0x7'));var logger=require('../../config/logger')(_0x225d('0x8'));var config=require(_0x225d('0x9'));var jayson=require(_0x225d('0xa'));var client=jayson['client'][_0x225d('0xb')]({'port':0x232a});config[_0x225d('0xc')]=_[_0x225d('0xd')](config[_0x225d('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x225d('0xe'))(new Redis(config['redis']));require('./cmList.socket')['register'](socket);function respondWithRpcPromise(_0x222c66,_0x35370e,_0x146d4b){return new BPromise(function(_0x3b5f02,_0x33424a){return client[_0x225d('0xf')](_0x222c66,_0x146d4b)[_0x225d('0x10')](function(_0x597fb1){logger[_0x225d('0x11')](_0x225d('0x12'),_0x35370e,_0x225d('0x13'));logger[_0x225d('0x14')](_0x225d('0x15'),_0x35370e,'request\x20sent',JSON[_0x225d('0x16')](_0x597fb1));if(_0x597fb1[_0x225d('0x17')]){if(_0x597fb1[_0x225d('0x17')][_0x225d('0x18')]===0x1f4){logger[_0x225d('0x17')](_0x225d('0x12'),_0x35370e,_0x597fb1[_0x225d('0x17')][_0x225d('0x19')]);return _0x33424a(_0x597fb1[_0x225d('0x17')][_0x225d('0x19')]);}logger[_0x225d('0x17')](_0x225d('0x12'),_0x35370e,_0x597fb1['error'][_0x225d('0x19')]);return _0x3b5f02(_0x597fb1[_0x225d('0x17')][_0x225d('0x19')]);}else{logger[_0x225d('0x11')](_0x225d('0x12'),_0x35370e,_0x225d('0x13'));_0x3b5f02(_0x597fb1[_0x225d('0x1a')][_0x225d('0x19')]);}})[_0x225d('0x1b')](function(_0x368ded){logger[_0x225d('0x17')](_0x225d('0x12'),_0x35370e,_0x368ded);_0x33424a(_0x368ded);});});}