Built motion from commit d5e4af8c.|2.6.23
[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 _0xaab0=['jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','CmList,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x49ce5d,_0x4eb106){var _0x43f4f7=function(_0x21b881){while(--_0x21b881){_0x49ce5d['push'](_0x49ce5d['shift']());}};_0x43f4f7(++_0x4eb106);}(_0xaab0,0x1b6));var _0x0aab=function(_0x4114dd,_0x2ad862){_0x4114dd=_0x4114dd-0x0;var _0x26f44c=_0xaab0[_0x4114dd];return _0x26f44c;};'use strict';var _=require(_0x0aab('0x0'));var util=require(_0x0aab('0x1'));var moment=require(_0x0aab('0x2'));var BPromise=require('bluebird');var rs=require(_0x0aab('0x3'));var fs=require('fs');var Redis=require(_0x0aab('0x4'));var db=require(_0x0aab('0x5'))['db'];var utils=require(_0x0aab('0x6'));var logger=require(_0x0aab('0x7'))(_0x0aab('0x8'));var config=require(_0x0aab('0x9'));var jayson=require(_0x0aab('0xa'));var client=jayson[_0x0aab('0xb')]['http']({'port':0x232a});config[_0x0aab('0xc')]=_[_0x0aab('0xd')](config['redis'],{'host':_0x0aab('0xe'),'port':0x18eb});var socket=require(_0x0aab('0xf'))(new Redis(config[_0x0aab('0xc')]));require('./cmList.socket')[_0x0aab('0x10')](socket);function respondWithRpcPromise(_0x6fbbe1,_0x3684e7,_0x2ca118){return new BPromise(function(_0x1249d8,_0x81b958){return client[_0x0aab('0x11')](_0x6fbbe1,_0x2ca118)[_0x0aab('0x12')](function(_0x4aaa6a){logger['info']('CmList,\x20%s,\x20%s',_0x3684e7,_0x0aab('0x13'));logger['debug'](_0x0aab('0x14'),_0x3684e7,'request\x20sent',JSON[_0x0aab('0x15')](_0x4aaa6a));if(_0x4aaa6a[_0x0aab('0x16')]){if(_0x4aaa6a['error'][_0x0aab('0x17')]===0x1f4){logger[_0x0aab('0x16')](_0x0aab('0x18'),_0x3684e7,_0x4aaa6a[_0x0aab('0x16')][_0x0aab('0x19')]);return _0x81b958(_0x4aaa6a['error'][_0x0aab('0x19')]);}logger['error']('CmList,\x20%s,\x20%s',_0x3684e7,_0x4aaa6a['error'][_0x0aab('0x19')]);return _0x1249d8(_0x4aaa6a[_0x0aab('0x16')]['message']);}else{logger['info'](_0x0aab('0x18'),_0x3684e7,_0x0aab('0x13'));_0x1249d8(_0x4aaa6a[_0x0aab('0x1a')]['message']);}})[_0x0aab('0x1b')](function(_0x539dd4){logger[_0x0aab('0x16')](_0x0aab('0x18'),_0x3684e7,_0x539dd4);_0x81b958(_0x539dd4);});});}