Built motion from commit (unavailable).|2.2.2
[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 _0xb9b4=['debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','then','CmList,\x20%s,\x20%s','request\x20sent'];(function(_0x28f65d,_0x4b01b6){var _0x5f3041=function(_0x4f3cdc){while(--_0x4f3cdc){_0x28f65d['push'](_0x28f65d['shift']());}};_0x5f3041(++_0x4b01b6);}(_0xb9b4,0x77));var _0x4b9b=function(_0x58dddc,_0xc8de04){_0x58dddc=_0x58dddc-0x0;var _0x3749ec=_0xb9b4[_0x58dddc];return _0x3749ec;};'use strict';var _=require(_0x4b9b('0x0'));var util=require(_0x4b9b('0x1'));var moment=require(_0x4b9b('0x2'));var BPromise=require(_0x4b9b('0x3'));var rs=require(_0x4b9b('0x4'));var fs=require('fs');var Redis=require(_0x4b9b('0x5'));var db=require(_0x4b9b('0x6'))['db'];var utils=require(_0x4b9b('0x7'));var logger=require(_0x4b9b('0x8'))(_0x4b9b('0x9'));var config=require('../../config/environment');var jayson=require(_0x4b9b('0xa'));var client=jayson[_0x4b9b('0xb')][_0x4b9b('0xc')]({'port':0x232a});config[_0x4b9b('0xd')]=_[_0x4b9b('0xe')](config[_0x4b9b('0xd')],{'host':_0x4b9b('0xf'),'port':0x18eb});var socket=require(_0x4b9b('0x10'))(new Redis(config[_0x4b9b('0xd')]));require(_0x4b9b('0x11'))['register'](socket);function respondWithRpcPromise(_0x3a8998,_0x108467,_0x53d0f2){return new BPromise(function(_0x1a13fb,_0x24f937){return client['request'](_0x3a8998,_0x53d0f2)[_0x4b9b('0x12')](function(_0x577f4a){logger['info'](_0x4b9b('0x13'),_0x108467,_0x4b9b('0x14'));logger[_0x4b9b('0x15')](_0x4b9b('0x16'),_0x108467,_0x4b9b('0x14'),JSON[_0x4b9b('0x17')](_0x577f4a));if(_0x577f4a[_0x4b9b('0x18')]){if(_0x577f4a[_0x4b9b('0x18')]['code']===0x1f4){logger[_0x4b9b('0x18')](_0x4b9b('0x13'),_0x108467,_0x577f4a[_0x4b9b('0x18')][_0x4b9b('0x19')]);return _0x24f937(_0x577f4a[_0x4b9b('0x18')][_0x4b9b('0x19')]);}logger[_0x4b9b('0x18')](_0x4b9b('0x13'),_0x108467,_0x577f4a['error'][_0x4b9b('0x19')]);return _0x1a13fb(_0x577f4a[_0x4b9b('0x18')]['message']);}else{logger[_0x4b9b('0x1a')](_0x4b9b('0x13'),_0x108467,'request\x20sent');_0x1a13fb(_0x577f4a['result'][_0x4b9b('0x19')]);}})[_0x4b9b('0x1b')](function(_0x2d7596){logger[_0x4b9b('0x18')](_0x4b9b('0x13'),_0x108467,_0x2d7596);_0x24f937(_0x2d7596);});});}