Built motion from commit 1fa89557.|2.6.10
[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 _0xc7d9=['randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./cmList.socket','register','request','then','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','CmList,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird'];(function(_0x1db153,_0x524ef6){var _0x204399=function(_0x1cef0e){while(--_0x1cef0e){_0x1db153['push'](_0x1db153['shift']());}};_0x204399(++_0x524ef6);}(_0xc7d9,0x175));var _0x9c7d=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xc7d9[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x9c7d('0x0'));var util=require(_0x9c7d('0x1'));var moment=require(_0x9c7d('0x2'));var BPromise=require(_0x9c7d('0x3'));var rs=require(_0x9c7d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9c7d('0x5'))['db'];var utils=require(_0x9c7d('0x6'));var logger=require('../../config/logger')(_0x9c7d('0x7'));var config=require(_0x9c7d('0x8'));var jayson=require(_0x9c7d('0x9'));var client=jayson[_0x9c7d('0xa')][_0x9c7d('0xb')]({'port':0x232a});config[_0x9c7d('0xc')]=_['defaults'](config['redis'],{'host':_0x9c7d('0xd'),'port':0x18eb});var socket=require(_0x9c7d('0xe'))(new Redis(config['redis']));require(_0x9c7d('0xf'))[_0x9c7d('0x10')](socket);function respondWithRpcPromise(_0x257e11,_0x1fcf91,_0xfd3fc2){return new BPromise(function(_0xaebc8f,_0x4b9bbe){return client[_0x9c7d('0x11')](_0x257e11,_0xfd3fc2)[_0x9c7d('0x12')](function(_0x10e5f){logger[_0x9c7d('0x13')]('CmList,\x20%s,\x20%s',_0x1fcf91,_0x9c7d('0x14'));logger[_0x9c7d('0x15')](_0x9c7d('0x16'),_0x1fcf91,'request\x20sent',JSON[_0x9c7d('0x17')](_0x10e5f));if(_0x10e5f[_0x9c7d('0x18')]){if(_0x10e5f['error'][_0x9c7d('0x19')]===0x1f4){logger[_0x9c7d('0x18')](_0x9c7d('0x1a'),_0x1fcf91,_0x10e5f[_0x9c7d('0x18')][_0x9c7d('0x1b')]);return _0x4b9bbe(_0x10e5f[_0x9c7d('0x18')][_0x9c7d('0x1b')]);}logger['error']('CmList,\x20%s,\x20%s',_0x1fcf91,_0x10e5f[_0x9c7d('0x18')][_0x9c7d('0x1b')]);return _0xaebc8f(_0x10e5f['error'][_0x9c7d('0x1b')]);}else{logger[_0x9c7d('0x13')](_0x9c7d('0x1a'),_0x1fcf91,_0x9c7d('0x14'));_0xaebc8f(_0x10e5f[_0x9c7d('0x1c')][_0x9c7d('0x1b')]);}})['catch'](function(_0x4709ec){logger[_0x9c7d('0x18')](_0x9c7d('0x1a'),_0x1fcf91,_0x4709ec);_0x4b9bbe(_0x4709ec);});});}