Built motion from commit eddce310.|2.6.12
[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 _0x80be=['redis','localhost','socket.io-emitter','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x3826d2,_0x5ee3c9){var _0x2ec504=function(_0x1f6e2a){while(--_0x1f6e2a){_0x3826d2['push'](_0x3826d2['shift']());}};_0x2ec504(++_0x5ee3c9);}(_0x80be,0x10b));var _0xe80b=function(_0x3cba80,_0x3024e7){_0x3cba80=_0x3cba80-0x0;var _0x11cb67=_0x80be[_0x3cba80];return _0x11cb67;};'use strict';var _=require(_0xe80b('0x0'));var util=require('util');var moment=require(_0xe80b('0x1'));var BPromise=require(_0xe80b('0x2'));var rs=require(_0xe80b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe80b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe80b('0x5'))('rpc');var config=require(_0xe80b('0x6'));var jayson=require(_0xe80b('0x7'));var client=jayson[_0xe80b('0x8')]['http']({'port':0x232a});config[_0xe80b('0x9')]=_['defaults'](config[_0xe80b('0x9')],{'host':_0xe80b('0xa'),'port':0x18eb});var socket=require(_0xe80b('0xb'))(new Redis(config[_0xe80b('0x9')]));require('./cmList.socket')[_0xe80b('0xc')](socket);function respondWithRpcPromise(_0x50d4d0,_0x47200d,_0x11b9d5){return new BPromise(function(_0x58a319,_0x115813){return client[_0xe80b('0xd')](_0x50d4d0,_0x11b9d5)[_0xe80b('0xe')](function(_0x15880c){logger[_0xe80b('0xf')](_0xe80b('0x10'),_0x47200d,_0xe80b('0x11'));logger['debug']('CmList,\x20%s,\x20%s,\x20%s',_0x47200d,_0xe80b('0x11'),JSON[_0xe80b('0x12')](_0x15880c));if(_0x15880c[_0xe80b('0x13')]){if(_0x15880c[_0xe80b('0x13')]['code']===0x1f4){logger['error'](_0xe80b('0x10'),_0x47200d,_0x15880c[_0xe80b('0x13')]['message']);return _0x115813(_0x15880c[_0xe80b('0x13')][_0xe80b('0x14')]);}logger['error']('CmList,\x20%s,\x20%s',_0x47200d,_0x15880c[_0xe80b('0x13')]['message']);return _0x58a319(_0x15880c[_0xe80b('0x13')][_0xe80b('0x14')]);}else{logger['info']('CmList,\x20%s,\x20%s',_0x47200d,_0xe80b('0x11'));_0x58a319(_0x15880c[_0xe80b('0x15')][_0xe80b('0x14')]);}})[_0xe80b('0x16')](function(_0x334e21){logger[_0xe80b('0x13')](_0xe80b('0x10'),_0x47200d,_0x334e21);_0x115813(_0x334e21);});});}