Built motion from commit 449495f6.|2.6.27
[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 _0x5ec4=['message','info','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','then','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmList,\x20%s,\x20%s'];(function(_0xacabb,_0x1fbcd9){var _0x2b4a14=function(_0x3a2353){while(--_0x3a2353){_0xacabb['push'](_0xacabb['shift']());}};_0x2b4a14(++_0x1fbcd9);}(_0x5ec4,0x142));var _0x45ec=function(_0x293fbc,_0x5c8873){_0x293fbc=_0x293fbc-0x0;var _0x9dd1ea=_0x5ec4[_0x293fbc];return _0x9dd1ea;};'use strict';var _=require(_0x45ec('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x45ec('0x1'));var rs=require(_0x45ec('0x2'));var fs=require('fs');var Redis=require(_0x45ec('0x3'));var db=require(_0x45ec('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x45ec('0x5'))(_0x45ec('0x6'));var config=require(_0x45ec('0x7'));var jayson=require(_0x45ec('0x8'));var client=jayson[_0x45ec('0x9')][_0x45ec('0xa')]({'port':0x232a});config[_0x45ec('0xb')]=_[_0x45ec('0xc')](config['redis'],{'host':_0x45ec('0xd'),'port':0x18eb});var socket=require(_0x45ec('0xe'))(new Redis(config[_0x45ec('0xb')]));require(_0x45ec('0xf'))[_0x45ec('0x10')](socket);function respondWithRpcPromise(_0x57e8e2,_0x441c41,_0x4840ac){return new BPromise(function(_0x36d5be,_0x548606){return client[_0x45ec('0x11')](_0x57e8e2,_0x4840ac)[_0x45ec('0x12')](function(_0x71ddb2){logger['info']('CmList,\x20%s,\x20%s',_0x441c41,'request\x20sent');logger[_0x45ec('0x13')](_0x45ec('0x14'),_0x441c41,_0x45ec('0x15'),JSON[_0x45ec('0x16')](_0x71ddb2));if(_0x71ddb2['error']){if(_0x71ddb2[_0x45ec('0x17')][_0x45ec('0x18')]===0x1f4){logger[_0x45ec('0x17')](_0x45ec('0x19'),_0x441c41,_0x71ddb2[_0x45ec('0x17')][_0x45ec('0x1a')]);return _0x548606(_0x71ddb2[_0x45ec('0x17')][_0x45ec('0x1a')]);}logger[_0x45ec('0x17')]('CmList,\x20%s,\x20%s',_0x441c41,_0x71ddb2['error'][_0x45ec('0x1a')]);return _0x36d5be(_0x71ddb2[_0x45ec('0x17')][_0x45ec('0x1a')]);}else{logger[_0x45ec('0x1b')](_0x45ec('0x19'),_0x441c41,_0x45ec('0x15'));_0x36d5be(_0x71ddb2['result']['message']);}})[_0x45ec('0x1c')](function(_0x6e2bbf){logger[_0x45ec('0x17')](_0x45ec('0x19'),_0x441c41,_0x6e2bbf);_0x548606(_0x6e2bbf);});});}