Built motion from commit c116dc8b.|2.6.30
[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 _0xde36=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./cmList.socket','register','request','then','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','../../mysqldb'];(function(_0x4df7be,_0x174cea){var _0x3c15a4=function(_0x2ef364){while(--_0x2ef364){_0x4df7be['push'](_0x4df7be['shift']());}};_0x3c15a4(++_0x174cea);}(_0xde36,0x7e));var _0x6de3=function(_0x5549a6,_0x5908b5){_0x5549a6=_0x5549a6-0x0;var _0x247657=_0xde36[_0x5549a6];return _0x247657;};'use strict';var _=require(_0x6de3('0x0'));var util=require(_0x6de3('0x1'));var moment=require(_0x6de3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6de3('0x3'))['db'];var utils=require(_0x6de3('0x4'));var logger=require(_0x6de3('0x5'))(_0x6de3('0x6'));var config=require(_0x6de3('0x7'));var jayson=require(_0x6de3('0x8'));var client=jayson[_0x6de3('0x9')]['http']({'port':0x232a});config[_0x6de3('0xa')]=_[_0x6de3('0xb')](config[_0x6de3('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x6de3('0xc'))(new Redis(config['redis']));require(_0x6de3('0xd'))[_0x6de3('0xe')](socket);function respondWithRpcPromise(_0x310a70,_0x41f06c,_0x2c9085){return new BPromise(function(_0x10d16a,_0x24d88b){return client[_0x6de3('0xf')](_0x310a70,_0x2c9085)[_0x6de3('0x10')](function(_0x4c1973){logger['info'](_0x6de3('0x11'),_0x41f06c,_0x6de3('0x12'));logger[_0x6de3('0x13')](_0x6de3('0x14'),_0x41f06c,_0x6de3('0x12'),JSON[_0x6de3('0x15')](_0x4c1973));if(_0x4c1973[_0x6de3('0x16')]){if(_0x4c1973['error'][_0x6de3('0x17')]===0x1f4){logger[_0x6de3('0x16')](_0x6de3('0x11'),_0x41f06c,_0x4c1973[_0x6de3('0x16')][_0x6de3('0x18')]);return _0x24d88b(_0x4c1973[_0x6de3('0x16')][_0x6de3('0x18')]);}logger['error']('CmList,\x20%s,\x20%s',_0x41f06c,_0x4c1973['error'][_0x6de3('0x18')]);return _0x10d16a(_0x4c1973[_0x6de3('0x16')][_0x6de3('0x18')]);}else{logger['info']('CmList,\x20%s,\x20%s',_0x41f06c,_0x6de3('0x12'));_0x10d16a(_0x4c1973[_0x6de3('0x19')][_0x6de3('0x18')]);}})['catch'](function(_0x4c8708){logger[_0x6de3('0x16')](_0x6de3('0x11'),_0x41f06c,_0x4c8708);_0x24d88b(_0x4c8708);});});}