14bec59f1908dfbd6d3254577ebd01777d89f26f
[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 _0xbc61=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird'];(function(_0x579ad9,_0x278055){var _0x17e9c8=function(_0x2623a0){while(--_0x2623a0){_0x579ad9['push'](_0x579ad9['shift']());}};_0x17e9c8(++_0x278055);}(_0xbc61,0x1e9));var _0x1bc6=function(_0x4e7069,_0x38b821){_0x4e7069=_0x4e7069-0x0;var _0x215bdb=_0xbc61[_0x4e7069];return _0x215bdb;};'use strict';var _=require(_0x1bc6('0x0'));var util=require(_0x1bc6('0x1'));var moment=require(_0x1bc6('0x2'));var BPromise=require(_0x1bc6('0x3'));var rs=require(_0x1bc6('0x4'));var fs=require('fs');var Redis=require(_0x1bc6('0x5'));var db=require(_0x1bc6('0x6'))['db'];var utils=require(_0x1bc6('0x7'));var logger=require('../../config/logger')(_0x1bc6('0x8'));var config=require(_0x1bc6('0x9'));var jayson=require(_0x1bc6('0xa'));var client=jayson[_0x1bc6('0xb')]['http']({'port':0x232a});config['redis']=_[_0x1bc6('0xc')](config[_0x1bc6('0xd')],{'host':_0x1bc6('0xe'),'port':0x18eb});var socket=require(_0x1bc6('0xf'))(new Redis(config['redis']));require(_0x1bc6('0x10'))[_0x1bc6('0x11')](socket);function respondWithRpcPromise(_0x3aabe4,_0x57852f,_0x547a1c){return new BPromise(function(_0x33a1d3,_0x144bb8){return client[_0x1bc6('0x12')](_0x3aabe4,_0x547a1c)[_0x1bc6('0x13')](function(_0x5c2e3b){logger[_0x1bc6('0x14')](_0x1bc6('0x15'),_0x57852f,_0x1bc6('0x16'));logger[_0x1bc6('0x17')](_0x1bc6('0x18'),_0x57852f,_0x1bc6('0x16'),JSON[_0x1bc6('0x19')](_0x5c2e3b));if(_0x5c2e3b['error']){if(_0x5c2e3b[_0x1bc6('0x1a')]['code']===0x1f4){logger[_0x1bc6('0x1a')](_0x1bc6('0x15'),_0x57852f,_0x5c2e3b[_0x1bc6('0x1a')][_0x1bc6('0x1b')]);return _0x144bb8(_0x5c2e3b[_0x1bc6('0x1a')]['message']);}logger[_0x1bc6('0x1a')](_0x1bc6('0x15'),_0x57852f,_0x5c2e3b[_0x1bc6('0x1a')][_0x1bc6('0x1b')]);return _0x33a1d3(_0x5c2e3b[_0x1bc6('0x1a')][_0x1bc6('0x1b')]);}else{logger['info'](_0x1bc6('0x15'),_0x57852f,'request\x20sent');_0x33a1d3(_0x5c2e3b['result'][_0x1bc6('0x1b')]);}})[_0x1bc6('0x1c')](function(_0x1bec03){logger[_0x1bc6('0x1a')](_0x1bc6('0x15'),_0x57852f,_0x1bec03);_0x144bb8(_0x1bec03);});});}