Built motion from commit e6806ed6.|2.6.0
[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 _0xb79c=['jayson/promise','client','http','defaults','redis','localhost','./cmList.socket','request','info','request\x20sent','debug','error','code','CmList,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2de688,_0x15b0f9){var _0x49fb62=function(_0x27357c){while(--_0x27357c){_0x2de688['push'](_0x2de688['shift']());}};_0x49fb62(++_0x15b0f9);}(_0xb79c,0x160));var _0xcb79=function(_0x120725,_0x5363b3){_0x120725=_0x120725-0x0;var _0x393f4a=_0xb79c[_0x120725];return _0x393f4a;};'use strict';var _=require(_0xcb79('0x0'));var util=require(_0xcb79('0x1'));var moment=require(_0xcb79('0x2'));var BPromise=require(_0xcb79('0x3'));var rs=require(_0xcb79('0x4'));var fs=require('fs');var Redis=require(_0xcb79('0x5'));var db=require(_0xcb79('0x6'))['db'];var utils=require(_0xcb79('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xcb79('0x8'));var client=jayson[_0xcb79('0x9')][_0xcb79('0xa')]({'port':0x232a});config['redis']=_[_0xcb79('0xb')](config[_0xcb79('0xc')],{'host':_0xcb79('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcb79('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f9252,_0x320e50,_0x2b72b3){return new BPromise(function(_0x49e3f8,_0x4bb5d6){return client[_0xcb79('0xf')](_0x3f9252,_0x2b72b3)['then'](function(_0x1c1840){logger[_0xcb79('0x10')]('CmList,\x20%s,\x20%s',_0x320e50,_0xcb79('0x11'));logger[_0xcb79('0x12')]('CmList,\x20%s,\x20%s,\x20%s',_0x320e50,_0xcb79('0x11'),JSON['stringify'](_0x1c1840));if(_0x1c1840[_0xcb79('0x13')]){if(_0x1c1840[_0xcb79('0x13')][_0xcb79('0x14')]===0x1f4){logger['error'](_0xcb79('0x15'),_0x320e50,_0x1c1840['error'][_0xcb79('0x16')]);return _0x4bb5d6(_0x1c1840[_0xcb79('0x13')][_0xcb79('0x16')]);}logger[_0xcb79('0x13')]('CmList,\x20%s,\x20%s',_0x320e50,_0x1c1840[_0xcb79('0x13')][_0xcb79('0x16')]);return _0x49e3f8(_0x1c1840[_0xcb79('0x13')]['message']);}else{logger[_0xcb79('0x10')](_0xcb79('0x15'),_0x320e50,_0xcb79('0x11'));_0x49e3f8(_0x1c1840[_0xcb79('0x17')][_0xcb79('0x16')]);}})['catch'](function(_0x35784c){logger[_0xcb79('0x13')](_0xcb79('0x15'),_0x320e50,_0x35784c);_0x4bb5d6(_0x35784c);});});}