Built motion from commit 00bf23f6.|2.6.16
[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 _0x580b=['request\x20sent','CmList,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./cmList.socket','request','then','info','CmList,\x20%s,\x20%s'];(function(_0x195c7d,_0x1b273c){var _0x587986=function(_0x266fb4){while(--_0x266fb4){_0x195c7d['push'](_0x195c7d['shift']());}};_0x587986(++_0x1b273c);}(_0x580b,0x8e));var _0xb580=function(_0x3e0c1e,_0x2fd01f){_0x3e0c1e=_0x3e0c1e-0x0;var _0x657a71=_0x580b[_0x3e0c1e];return _0x657a71;};'use strict';var _=require(_0xb580('0x0'));var util=require('util');var moment=require(_0xb580('0x1'));var BPromise=require('bluebird');var rs=require(_0xb580('0x2'));var fs=require('fs');var Redis=require(_0xb580('0x3'));var db=require(_0xb580('0x4'))['db'];var utils=require(_0xb580('0x5'));var logger=require(_0xb580('0x6'))(_0xb580('0x7'));var config=require(_0xb580('0x8'));var jayson=require(_0xb580('0x9'));var client=jayson[_0xb580('0xa')][_0xb580('0xb')]({'port':0x232a});config[_0xb580('0xc')]=_[_0xb580('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb580('0xe'))(new Redis(config[_0xb580('0xc')]));require(_0xb580('0xf'))['register'](socket);function respondWithRpcPromise(_0x17c1ff,_0x152528,_0x3f6e1c){return new BPromise(function(_0x25f91a,_0x3be67a){return client[_0xb580('0x10')](_0x17c1ff,_0x3f6e1c)[_0xb580('0x11')](function(_0x3d0ea7){logger[_0xb580('0x12')](_0xb580('0x13'),_0x152528,_0xb580('0x14'));logger['debug'](_0xb580('0x15'),_0x152528,_0xb580('0x14'),JSON['stringify'](_0x3d0ea7));if(_0x3d0ea7[_0xb580('0x16')]){if(_0x3d0ea7[_0xb580('0x16')][_0xb580('0x17')]===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x152528,_0x3d0ea7[_0xb580('0x16')]['message']);return _0x3be67a(_0x3d0ea7['error'][_0xb580('0x18')]);}logger[_0xb580('0x16')](_0xb580('0x13'),_0x152528,_0x3d0ea7[_0xb580('0x16')]['message']);return _0x25f91a(_0x3d0ea7[_0xb580('0x16')][_0xb580('0x18')]);}else{logger[_0xb580('0x12')](_0xb580('0x13'),_0x152528,_0xb580('0x14'));_0x25f91a(_0x3d0ea7[_0xb580('0x19')][_0xb580('0x18')]);}})[_0xb580('0x1a')](function(_0x3f9526){logger['error'](_0xb580('0x13'),_0x152528,_0x3f9526);_0x3be67a(_0x3f9526);});});}