Built motion from commit (unavailable).|2.5.28
[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 _0xe6f5=['then','info','request\x20sent','stringify','error','code','message','CmList,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','defaults','redis','localhost','./cmList.socket','register','request'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xe6f5,0xf3));var _0x5e6f=function(_0xc15e8f,_0x156424){_0xc15e8f=_0xc15e8f-0x0;var _0x478f6f=_0xe6f5[_0xc15e8f];return _0x478f6f;};'use strict';var _=require(_0x5e6f('0x0'));var util=require(_0x5e6f('0x1'));var moment=require(_0x5e6f('0x2'));var BPromise=require(_0x5e6f('0x3'));var rs=require(_0x5e6f('0x4'));var fs=require('fs');var Redis=require(_0x5e6f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5e6f('0x6'));var logger=require(_0x5e6f('0x7'))(_0x5e6f('0x8'));var config=require(_0x5e6f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5e6f('0xa')]['http']({'port':0x232a});config['redis']=_[_0x5e6f('0xb')](config[_0x5e6f('0xc')],{'host':_0x5e6f('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5e6f('0xc')]));require(_0x5e6f('0xe'))[_0x5e6f('0xf')](socket);function respondWithRpcPromise(_0x2546cb,_0x5f5043,_0x51c3db){return new BPromise(function(_0x26f1fb,_0x69f25c){return client[_0x5e6f('0x10')](_0x2546cb,_0x51c3db)[_0x5e6f('0x11')](function(_0x217df4){logger[_0x5e6f('0x12')]('CmList,\x20%s,\x20%s',_0x5f5043,_0x5e6f('0x13'));logger['debug']('CmList,\x20%s,\x20%s,\x20%s',_0x5f5043,_0x5e6f('0x13'),JSON[_0x5e6f('0x14')](_0x217df4));if(_0x217df4['error']){if(_0x217df4[_0x5e6f('0x15')][_0x5e6f('0x16')]===0x1f4){logger[_0x5e6f('0x15')]('CmList,\x20%s,\x20%s',_0x5f5043,_0x217df4[_0x5e6f('0x15')][_0x5e6f('0x17')]);return _0x69f25c(_0x217df4[_0x5e6f('0x15')][_0x5e6f('0x17')]);}logger[_0x5e6f('0x15')](_0x5e6f('0x18'),_0x5f5043,_0x217df4[_0x5e6f('0x15')][_0x5e6f('0x17')]);return _0x26f1fb(_0x217df4[_0x5e6f('0x15')]['message']);}else{logger[_0x5e6f('0x12')]('CmList,\x20%s,\x20%s',_0x5f5043,_0x5e6f('0x13'));_0x26f1fb(_0x217df4['result'][_0x5e6f('0x17')]);}})[_0x5e6f('0x19')](function(_0x25fef4){logger[_0x5e6f('0x15')](_0x5e6f('0x18'),_0x5f5043,_0x25fef4);_0x69f25c(_0x25fef4);});});}