4dae08a45ff5993353fa137be331f1e8daa727b7
[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 _0x77f9=['ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./cmList.socket','request','then','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird'];(function(_0x559df8,_0x46371a){var _0x18e470=function(_0x2009f0){while(--_0x2009f0){_0x559df8['push'](_0x559df8['shift']());}};_0x18e470(++_0x46371a);}(_0x77f9,0x14f));var _0x977f=function(_0x1e2321,_0x3ae1c5){_0x1e2321=_0x1e2321-0x0;var _0x1d346d=_0x77f9[_0x1e2321];return _0x1d346d;};'use strict';var _=require(_0x977f('0x0'));var util=require('util');var moment=require(_0x977f('0x1'));var BPromise=require(_0x977f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x977f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x977f('0x4'));var logger=require('../../config/logger')(_0x977f('0x5'));var config=require(_0x977f('0x6'));var jayson=require(_0x977f('0x7'));var client=jayson['client'][_0x977f('0x8')]({'port':0x232a});config[_0x977f('0x9')]=_['defaults'](config['redis'],{'host':_0x977f('0xa'),'port':0x18eb});var socket=require(_0x977f('0xb'))(new Redis(config[_0x977f('0x9')]));require(_0x977f('0xc'))['register'](socket);function respondWithRpcPromise(_0x5b436f,_0x17bf2f,_0x150400){return new BPromise(function(_0xa87706,_0x20ea84){return client[_0x977f('0xd')](_0x5b436f,_0x150400)[_0x977f('0xe')](function(_0x448d79){logger['info'](_0x977f('0xf'),_0x17bf2f,_0x977f('0x10'));logger[_0x977f('0x11')](_0x977f('0x12'),_0x17bf2f,_0x977f('0x10'),JSON[_0x977f('0x13')](_0x448d79));if(_0x448d79[_0x977f('0x14')]){if(_0x448d79[_0x977f('0x14')][_0x977f('0x15')]===0x1f4){logger[_0x977f('0x14')](_0x977f('0xf'),_0x17bf2f,_0x448d79['error'][_0x977f('0x16')]);return _0x20ea84(_0x448d79[_0x977f('0x14')][_0x977f('0x16')]);}logger['error'](_0x977f('0xf'),_0x17bf2f,_0x448d79['error'][_0x977f('0x16')]);return _0xa87706(_0x448d79[_0x977f('0x14')]['message']);}else{logger[_0x977f('0x17')](_0x977f('0xf'),_0x17bf2f,'request\x20sent');_0xa87706(_0x448d79[_0x977f('0x18')][_0x977f('0x16')]);}})[_0x977f('0x19')](function(_0xd2bdf){logger[_0x977f('0x14')](_0x977f('0xf'),_0x17bf2f,_0xd2bdf);_0x20ea84(_0xd2bdf);});});}