Built motion from commit (unavailable).|2.4.4
[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 _0x5902=['redis','localhost','socket.io-emitter','./cmList.socket','register','request','info','request\x20sent','debug','error','code','CmList,\x20%s,\x20%s','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x54929d,_0x11667e){var _0x2ebf26=function(_0x5cc410){while(--_0x5cc410){_0x54929d['push'](_0x54929d['shift']());}};_0x2ebf26(++_0x11667e);}(_0x5902,0x18a));var _0x2590=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x5902[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0x2590('0x0'));var moment=require(_0x2590('0x1'));var BPromise=require(_0x2590('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2590('0x3'));var db=require(_0x2590('0x4'))['db'];var utils=require(_0x2590('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x2590('0x6')]=_['defaults'](config['redis'],{'host':_0x2590('0x7'),'port':0x18eb});var socket=require(_0x2590('0x8'))(new Redis(config[_0x2590('0x6')]));require(_0x2590('0x9'))[_0x2590('0xa')](socket);function respondWithRpcPromise(_0x5c3440,_0x210c23,_0x5f1ce2){return new BPromise(function(_0x52d5b7,_0x530792){return client[_0x2590('0xb')](_0x5c3440,_0x5f1ce2)['then'](function(_0x384d69){logger[_0x2590('0xc')]('CmList,\x20%s,\x20%s',_0x210c23,_0x2590('0xd'));logger[_0x2590('0xe')]('CmList,\x20%s,\x20%s,\x20%s',_0x210c23,_0x2590('0xd'),JSON['stringify'](_0x384d69));if(_0x384d69[_0x2590('0xf')]){if(_0x384d69[_0x2590('0xf')][_0x2590('0x10')]===0x1f4){logger[_0x2590('0xf')](_0x2590('0x11'),_0x210c23,_0x384d69['error'][_0x2590('0x12')]);return _0x530792(_0x384d69[_0x2590('0xf')]['message']);}logger[_0x2590('0xf')]('CmList,\x20%s,\x20%s',_0x210c23,_0x384d69[_0x2590('0xf')][_0x2590('0x12')]);return _0x52d5b7(_0x384d69[_0x2590('0xf')]['message']);}else{logger['info'](_0x2590('0x11'),_0x210c23,_0x2590('0xd'));_0x52d5b7(_0x384d69['result'][_0x2590('0x12')]);}})[_0x2590('0x13')](function(_0x292029){logger[_0x2590('0xf')]('CmList,\x20%s,\x20%s',_0x210c23,_0x292029);_0x530792(_0x292029);});});}