Built motion from commit e1760111.|2.6.18
[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 _0x7ec4=['client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','error','message','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x879e31,_0x139d02){var _0x3467e8=function(_0x544fc6){while(--_0x544fc6){_0x879e31['push'](_0x879e31['shift']());}};_0x3467e8(++_0x139d02);}(_0x7ec4,0xa8));var _0x47ec=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x7ec4[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x47ec('0x0'));var util=require('util');var moment=require(_0x47ec('0x1'));var BPromise=require('bluebird');var rs=require(_0x47ec('0x2'));var fs=require('fs');var Redis=require(_0x47ec('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x47ec('0x4'));var logger=require(_0x47ec('0x5'))(_0x47ec('0x6'));var config=require(_0x47ec('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x47ec('0x8')][_0x47ec('0x9')]({'port':0x232a});config[_0x47ec('0xa')]=_[_0x47ec('0xb')](config[_0x47ec('0xa')],{'host':_0x47ec('0xc'),'port':0x18eb});var socket=require(_0x47ec('0xd'))(new Redis(config[_0x47ec('0xa')]));require('./cmList.socket')['register'](socket);function respondWithRpcPromise(_0x230142,_0xff3a82,_0x4de815){return new BPromise(function(_0x57b755,_0x178867){return client[_0x47ec('0xe')](_0x230142,_0x4de815)[_0x47ec('0xf')](function(_0x4ae92f){logger[_0x47ec('0x10')](_0x47ec('0x11'),_0xff3a82,_0x47ec('0x12'));logger[_0x47ec('0x13')]('CmList,\x20%s,\x20%s,\x20%s',_0xff3a82,_0x47ec('0x12'),JSON['stringify'](_0x4ae92f));if(_0x4ae92f['error']){if(_0x4ae92f[_0x47ec('0x14')]['code']===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0xff3a82,_0x4ae92f[_0x47ec('0x14')][_0x47ec('0x15')]);return _0x178867(_0x4ae92f['error'][_0x47ec('0x15')]);}logger['error']('CmList,\x20%s,\x20%s',_0xff3a82,_0x4ae92f[_0x47ec('0x14')][_0x47ec('0x15')]);return _0x57b755(_0x4ae92f[_0x47ec('0x14')][_0x47ec('0x15')]);}else{logger[_0x47ec('0x10')](_0x47ec('0x11'),_0xff3a82,_0x47ec('0x12'));_0x57b755(_0x4ae92f['result'][_0x47ec('0x15')]);}})['catch'](function(_0x212937){logger[_0x47ec('0x14')](_0x47ec('0x11'),_0xff3a82,_0x212937);_0x178867(_0x212937);});});}