Built motion from commit (unavailable).|2.4.21
[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 _0x0a72=['info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./cmList.socket','register','request','then','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0a72,0xf6));var _0x20a7=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x0a72[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0x20a7('0x0'));var util=require(_0x20a7('0x1'));var moment=require(_0x20a7('0x2'));var BPromise=require('bluebird');var rs=require(_0x20a7('0x3'));var fs=require('fs');var Redis=require(_0x20a7('0x4'));var db=require(_0x20a7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x20a7('0x6'))(_0x20a7('0x7'));var config=require(_0x20a7('0x8'));var jayson=require(_0x20a7('0x9'));var client=jayson['client'][_0x20a7('0xa')]({'port':0x232a});config[_0x20a7('0xb')]=_[_0x20a7('0xc')](config[_0x20a7('0xb')],{'host':_0x20a7('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x20a7('0xb')]));require(_0x20a7('0xe'))[_0x20a7('0xf')](socket);function respondWithRpcPromise(_0x567e36,_0x4f314e,_0x447ad7){return new BPromise(function(_0x40736f,_0x433a0e){return client[_0x20a7('0x10')](_0x567e36,_0x447ad7)[_0x20a7('0x11')](function(_0x73a3dc){logger['info'](_0x20a7('0x12'),_0x4f314e,_0x20a7('0x13'));logger[_0x20a7('0x14')](_0x20a7('0x15'),_0x4f314e,_0x20a7('0x13'),JSON['stringify'](_0x73a3dc));if(_0x73a3dc['error']){if(_0x73a3dc['error']['code']===0x1f4){logger[_0x20a7('0x16')](_0x20a7('0x12'),_0x4f314e,_0x73a3dc['error']['message']);return _0x433a0e(_0x73a3dc['error'][_0x20a7('0x17')]);}logger[_0x20a7('0x16')](_0x20a7('0x12'),_0x4f314e,_0x73a3dc[_0x20a7('0x16')][_0x20a7('0x17')]);return _0x40736f(_0x73a3dc[_0x20a7('0x16')][_0x20a7('0x17')]);}else{logger[_0x20a7('0x18')](_0x20a7('0x12'),_0x4f314e,_0x20a7('0x13'));_0x40736f(_0x73a3dc[_0x20a7('0x19')][_0x20a7('0x17')]);}})[_0x20a7('0x1a')](function(_0x2213ee){logger['error']('CmList,\x20%s,\x20%s',_0x4f314e,_0x2213ee);_0x433a0e(_0x2213ee);});});}