Built motion from commit bab6f49e.|2.6.17
[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 _0x9afc=['localhost','socket.io-emitter','./cmList.socket','register','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x2f4580,_0x1f7610){var _0x18959d=function(_0x3a445f){while(--_0x3a445f){_0x2f4580['push'](_0x2f4580['shift']());}};_0x18959d(++_0x1f7610);}(_0x9afc,0x10a));var _0xc9af=function(_0xe97e4c,_0x486a93){_0xe97e4c=_0xe97e4c-0x0;var _0x2a2f09=_0x9afc[_0xe97e4c];return _0x2a2f09;};'use strict';var _=require(_0xc9af('0x0'));var util=require(_0xc9af('0x1'));var moment=require(_0xc9af('0x2'));var BPromise=require(_0xc9af('0x3'));var rs=require(_0xc9af('0x4'));var fs=require('fs');var Redis=require(_0xc9af('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc9af('0x6'));var logger=require(_0xc9af('0x7'))(_0xc9af('0x8'));var config=require(_0xc9af('0x9'));var jayson=require(_0xc9af('0xa'));var client=jayson[_0xc9af('0xb')][_0xc9af('0xc')]({'port':0x232a});config[_0xc9af('0xd')]=_['defaults'](config[_0xc9af('0xd')],{'host':_0xc9af('0xe'),'port':0x18eb});var socket=require(_0xc9af('0xf'))(new Redis(config[_0xc9af('0xd')]));require(_0xc9af('0x10'))[_0xc9af('0x11')](socket);function respondWithRpcPromise(_0x1d2abb,_0x1c825d,_0x29f690){return new BPromise(function(_0x8b6545,_0x5cbcbb){return client['request'](_0x1d2abb,_0x29f690)[_0xc9af('0x12')](function(_0x4aacc3){logger[_0xc9af('0x13')](_0xc9af('0x14'),_0x1c825d,_0xc9af('0x15'));logger[_0xc9af('0x16')](_0xc9af('0x17'),_0x1c825d,_0xc9af('0x15'),JSON[_0xc9af('0x18')](_0x4aacc3));if(_0x4aacc3[_0xc9af('0x19')]){if(_0x4aacc3['error']['code']===0x1f4){logger[_0xc9af('0x19')](_0xc9af('0x14'),_0x1c825d,_0x4aacc3[_0xc9af('0x19')][_0xc9af('0x1a')]);return _0x5cbcbb(_0x4aacc3[_0xc9af('0x19')]['message']);}logger[_0xc9af('0x19')]('CmList,\x20%s,\x20%s',_0x1c825d,_0x4aacc3[_0xc9af('0x19')][_0xc9af('0x1a')]);return _0x8b6545(_0x4aacc3['error']['message']);}else{logger[_0xc9af('0x13')](_0xc9af('0x14'),_0x1c825d,_0xc9af('0x15'));_0x8b6545(_0x4aacc3[_0xc9af('0x1b')][_0xc9af('0x1a')]);}})['catch'](function(_0x29fc87){logger[_0xc9af('0x19')](_0xc9af('0x14'),_0x1c825d,_0x29fc87);_0x5cbcbb(_0x29fc87);});});}