Built motion from commit (unavailable).|2.5.14
[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 _0x2eb0=['request','then','debug','stringify','error','CmList,\x20%s,\x20%s','message','info','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','localhost','socket.io-emitter','./cmList.socket','register'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x2eb0,0x1d6));var _0x02eb=function(_0x12def4,_0x183f05){_0x12def4=_0x12def4-0x0;var _0x20e4bd=_0x2eb0[_0x12def4];return _0x20e4bd;};'use strict';var _=require(_0x02eb('0x0'));var util=require(_0x02eb('0x1'));var moment=require(_0x02eb('0x2'));var BPromise=require('bluebird');var rs=require(_0x02eb('0x3'));var fs=require('fs');var Redis=require(_0x02eb('0x4'));var db=require(_0x02eb('0x5'))['db'];var utils=require(_0x02eb('0x6'));var logger=require(_0x02eb('0x7'))('rpc');var config=require(_0x02eb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x02eb('0x9')][_0x02eb('0xa')]({'port':0x232a});config['redis']=_[_0x02eb('0xb')](config['redis'],{'host':_0x02eb('0xc'),'port':0x18eb});var socket=require(_0x02eb('0xd'))(new Redis(config['redis']));require(_0x02eb('0xe'))[_0x02eb('0xf')](socket);function respondWithRpcPromise(_0x1302bd,_0x5b2556,_0x57faf8){return new BPromise(function(_0xdedb19,_0x2f0b7a){return client[_0x02eb('0x10')](_0x1302bd,_0x57faf8)[_0x02eb('0x11')](function(_0x22658a){logger['info']('CmList,\x20%s,\x20%s',_0x5b2556,'request\x20sent');logger[_0x02eb('0x12')]('CmList,\x20%s,\x20%s,\x20%s',_0x5b2556,'request\x20sent',JSON[_0x02eb('0x13')](_0x22658a));if(_0x22658a['error']){if(_0x22658a[_0x02eb('0x14')]['code']===0x1f4){logger[_0x02eb('0x14')](_0x02eb('0x15'),_0x5b2556,_0x22658a[_0x02eb('0x14')]['message']);return _0x2f0b7a(_0x22658a['error'][_0x02eb('0x16')]);}logger[_0x02eb('0x14')](_0x02eb('0x15'),_0x5b2556,_0x22658a['error'][_0x02eb('0x16')]);return _0xdedb19(_0x22658a[_0x02eb('0x14')][_0x02eb('0x16')]);}else{logger[_0x02eb('0x17')](_0x02eb('0x15'),_0x5b2556,_0x02eb('0x18'));_0xdedb19(_0x22658a[_0x02eb('0x19')][_0x02eb('0x16')]);}})[_0x02eb('0x1a')](function(_0x164871){logger['error'](_0x02eb('0x15'),_0x5b2556,_0x164871);_0x2f0b7a(_0x164871);});});}