0938a8cd65ea4beb44715d9655d4c1b19d46310d
[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 _0x45a3=['jayson/promise','http','defaults','localhost','socket.io-emitter','redis','./cmList.socket','register','then','info','CmList,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x419aa4,_0x5926a7){var _0x557d9b=function(_0x43c9ac){while(--_0x43c9ac){_0x419aa4['push'](_0x419aa4['shift']());}};_0x557d9b(++_0x5926a7);}(_0x45a3,0x1d2));var _0x345a=function(_0x1680bb,_0x2b4dbc){_0x1680bb=_0x1680bb-0x0;var _0x163f0c=_0x45a3[_0x1680bb];return _0x163f0c;};'use strict';var _=require(_0x345a('0x0'));var util=require(_0x345a('0x1'));var moment=require('moment');var BPromise=require(_0x345a('0x2'));var rs=require(_0x345a('0x3'));var fs=require('fs');var Redis=require(_0x345a('0x4'));var db=require(_0x345a('0x5'))['db'];var utils=require(_0x345a('0x6'));var logger=require(_0x345a('0x7'))('rpc');var config=require(_0x345a('0x8'));var jayson=require(_0x345a('0x9'));var client=jayson['client'][_0x345a('0xa')]({'port':0x232a});config['redis']=_[_0x345a('0xb')](config['redis'],{'host':_0x345a('0xc'),'port':0x18eb});var socket=require(_0x345a('0xd'))(new Redis(config[_0x345a('0xe')]));require(_0x345a('0xf'))[_0x345a('0x10')](socket);function respondWithRpcPromise(_0x879a72,_0x421014,_0x251187){return new BPromise(function(_0x177386,_0x12d919){return client['request'](_0x879a72,_0x251187)[_0x345a('0x11')](function(_0x79e204){logger[_0x345a('0x12')](_0x345a('0x13'),_0x421014,_0x345a('0x14'));logger['debug']('CmList,\x20%s,\x20%s,\x20%s',_0x421014,'request\x20sent',JSON['stringify'](_0x79e204));if(_0x79e204[_0x345a('0x15')]){if(_0x79e204['error'][_0x345a('0x16')]===0x1f4){logger[_0x345a('0x15')](_0x345a('0x13'),_0x421014,_0x79e204[_0x345a('0x15')]['message']);return _0x12d919(_0x79e204['error']['message']);}logger[_0x345a('0x15')]('CmList,\x20%s,\x20%s',_0x421014,_0x79e204[_0x345a('0x15')][_0x345a('0x17')]);return _0x177386(_0x79e204[_0x345a('0x15')]['message']);}else{logger[_0x345a('0x12')]('CmList,\x20%s,\x20%s',_0x421014,'request\x20sent');_0x177386(_0x79e204[_0x345a('0x18')][_0x345a('0x17')]);}})['catch'](function(_0x21ec3e){logger[_0x345a('0x15')](_0x345a('0x13'),_0x421014,_0x21ec3e);_0x12d919(_0x21ec3e);});});}