Built motion from commit da617fac.|2.6.6
[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 _0x1b3e=['client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x1d30b4,_0x5d44d2){var _0x3cb697=function(_0x23bbea){while(--_0x23bbea){_0x1d30b4['push'](_0x1d30b4['shift']());}};_0x3cb697(++_0x5d44d2);}(_0x1b3e,0x1d6));var _0xe1b3=function(_0x1ea405,_0x325090){_0x1ea405=_0x1ea405-0x0;var _0xfef21e=_0x1b3e[_0x1ea405];return _0xfef21e;};'use strict';var _=require('lodash');var util=require(_0xe1b3('0x0'));var moment=require(_0xe1b3('0x1'));var BPromise=require(_0xe1b3('0x2'));var rs=require(_0xe1b3('0x3'));var fs=require('fs');var Redis=require(_0xe1b3('0x4'));var db=require(_0xe1b3('0x5'))['db'];var utils=require(_0xe1b3('0x6'));var logger=require(_0xe1b3('0x7'))('rpc');var config=require(_0xe1b3('0x8'));var jayson=require(_0xe1b3('0x9'));var client=jayson[_0xe1b3('0xa')][_0xe1b3('0xb')]({'port':0x232a});config[_0xe1b3('0xc')]=_[_0xe1b3('0xd')](config['redis'],{'host':_0xe1b3('0xe'),'port':0x18eb});var socket=require(_0xe1b3('0xf'))(new Redis(config[_0xe1b3('0xc')]));require('./cmList.socket')[_0xe1b3('0x10')](socket);function respondWithRpcPromise(_0xde750f,_0x335fdf,_0x50fb2a){return new BPromise(function(_0xa03191,_0x257426){return client[_0xe1b3('0x11')](_0xde750f,_0x50fb2a)[_0xe1b3('0x12')](function(_0x373f62){logger[_0xe1b3('0x13')](_0xe1b3('0x14'),_0x335fdf,'request\x20sent');logger[_0xe1b3('0x15')](_0xe1b3('0x16'),_0x335fdf,_0xe1b3('0x17'),JSON[_0xe1b3('0x18')](_0x373f62));if(_0x373f62[_0xe1b3('0x19')]){if(_0x373f62[_0xe1b3('0x19')][_0xe1b3('0x1a')]===0x1f4){logger[_0xe1b3('0x19')](_0xe1b3('0x14'),_0x335fdf,_0x373f62[_0xe1b3('0x19')][_0xe1b3('0x1b')]);return _0x257426(_0x373f62[_0xe1b3('0x19')]['message']);}logger[_0xe1b3('0x19')]('CmList,\x20%s,\x20%s',_0x335fdf,_0x373f62[_0xe1b3('0x19')]['message']);return _0xa03191(_0x373f62[_0xe1b3('0x19')][_0xe1b3('0x1b')]);}else{logger[_0xe1b3('0x13')](_0xe1b3('0x14'),_0x335fdf,_0xe1b3('0x17'));_0xa03191(_0x373f62[_0xe1b3('0x1c')][_0xe1b3('0x1b')]);}})[_0xe1b3('0x1d')](function(_0x2d605e){logger[_0xe1b3('0x19')](_0xe1b3('0x14'),_0x335fdf,_0x2d605e);_0x257426(_0x2d605e);});});}