Built motion from commit (unavailable).|2.5.19
[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 _0x8a36=['error','code','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','then','CmList,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x2dd75c,_0x1393a7){var _0x5b14ea=function(_0x145a36){while(--_0x145a36){_0x2dd75c['push'](_0x2dd75c['shift']());}};_0x5b14ea(++_0x1393a7);}(_0x8a36,0xd6));var _0x68a3=function(_0x9dca49,_0x2bad01){_0x9dca49=_0x9dca49-0x0;var _0x47ad2d=_0x8a36[_0x9dca49];return _0x47ad2d;};'use strict';var _=require(_0x68a3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x68a3('0x1'));var rs=require(_0x68a3('0x2'));var fs=require('fs');var Redis=require(_0x68a3('0x3'));var db=require(_0x68a3('0x4'))['db'];var utils=require(_0x68a3('0x5'));var logger=require(_0x68a3('0x6'))(_0x68a3('0x7'));var config=require(_0x68a3('0x8'));var jayson=require(_0x68a3('0x9'));var client=jayson[_0x68a3('0xa')][_0x68a3('0xb')]({'port':0x232a});config[_0x68a3('0xc')]=_[_0x68a3('0xd')](config[_0x68a3('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x68a3('0xe'))(new Redis(config['redis']));require('./cmList.socket')[_0x68a3('0xf')](socket);function respondWithRpcPromise(_0x34357d,_0x5c39c4,_0x6f45dd){return new BPromise(function(_0x3f981e,_0x5663b6){return client['request'](_0x34357d,_0x6f45dd)[_0x68a3('0x10')](function(_0x4c7c62){logger['info'](_0x68a3('0x11'),_0x5c39c4,'request\x20sent');logger[_0x68a3('0x12')]('CmList,\x20%s,\x20%s,\x20%s',_0x5c39c4,_0x68a3('0x13'),JSON['stringify'](_0x4c7c62));if(_0x4c7c62[_0x68a3('0x14')]){if(_0x4c7c62['error'][_0x68a3('0x15')]===0x1f4){logger[_0x68a3('0x14')](_0x68a3('0x11'),_0x5c39c4,_0x4c7c62[_0x68a3('0x14')][_0x68a3('0x16')]);return _0x5663b6(_0x4c7c62['error'][_0x68a3('0x16')]);}logger[_0x68a3('0x14')](_0x68a3('0x11'),_0x5c39c4,_0x4c7c62[_0x68a3('0x14')][_0x68a3('0x16')]);return _0x3f981e(_0x4c7c62[_0x68a3('0x14')][_0x68a3('0x16')]);}else{logger[_0x68a3('0x17')](_0x68a3('0x11'),_0x5c39c4,'request\x20sent');_0x3f981e(_0x4c7c62[_0x68a3('0x18')][_0x68a3('0x16')]);}})[_0x68a3('0x19')](function(_0x1154ec){logger[_0x68a3('0x14')](_0x68a3('0x11'),_0x5c39c4,_0x1154ec);_0x5663b6(_0x1154ec);});});}