Built motion from commit 97153652.|2.6.26
[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 _0xfb5f=['CmList,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./cmList.socket','register','request','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x2c4bb3,_0x1e2c8e){var _0x6d826e=function(_0x3269aa){while(--_0x3269aa){_0x2c4bb3['push'](_0x2c4bb3['shift']());}};_0x6d826e(++_0x1e2c8e);}(_0xfb5f,0x8f));var _0xffb5=function(_0x22e29e,_0x156ed3){_0x22e29e=_0x22e29e-0x0;var _0x3064ac=_0xfb5f[_0x22e29e];return _0x3064ac;};'use strict';var _=require(_0xffb5('0x0'));var util=require('util');var moment=require(_0xffb5('0x1'));var BPromise=require(_0xffb5('0x2'));var rs=require(_0xffb5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xffb5('0x4'))['db'];var utils=require(_0xffb5('0x5'));var logger=require(_0xffb5('0x6'))(_0xffb5('0x7'));var config=require(_0xffb5('0x8'));var jayson=require(_0xffb5('0x9'));var client=jayson[_0xffb5('0xa')][_0xffb5('0xb')]({'port':0x232a});config[_0xffb5('0xc')]=_[_0xffb5('0xd')](config[_0xffb5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xffb5('0xe'))(new Redis(config['redis']));require(_0xffb5('0xf'))[_0xffb5('0x10')](socket);function respondWithRpcPromise(_0x49e42a,_0x5dac95,_0x19cb8e){return new BPromise(function(_0x24c89c,_0x38ad7d){return client[_0xffb5('0x11')](_0x49e42a,_0x19cb8e)['then'](function(_0x58ca6a){logger[_0xffb5('0x12')]('CmList,\x20%s,\x20%s',_0x5dac95,_0xffb5('0x13'));logger[_0xffb5('0x14')](_0xffb5('0x15'),_0x5dac95,_0xffb5('0x13'),JSON['stringify'](_0x58ca6a));if(_0x58ca6a[_0xffb5('0x16')]){if(_0x58ca6a[_0xffb5('0x16')][_0xffb5('0x17')]===0x1f4){logger[_0xffb5('0x16')]('CmList,\x20%s,\x20%s',_0x5dac95,_0x58ca6a[_0xffb5('0x16')]['message']);return _0x38ad7d(_0x58ca6a['error'][_0xffb5('0x18')]);}logger[_0xffb5('0x16')](_0xffb5('0x19'),_0x5dac95,_0x58ca6a[_0xffb5('0x16')][_0xffb5('0x18')]);return _0x24c89c(_0x58ca6a['error'][_0xffb5('0x18')]);}else{logger[_0xffb5('0x12')](_0xffb5('0x19'),_0x5dac95,'request\x20sent');_0x24c89c(_0x58ca6a[_0xffb5('0x1a')]['message']);}})[_0xffb5('0x1b')](function(_0x26fd02){logger[_0xffb5('0x16')](_0xffb5('0x19'),_0x5dac95,_0x26fd02);_0x38ad7d(_0x26fd02);});});}