e8c380072db8b69a0a180245f3902112f54382ac
[motion2.git] / server / api / userOpenchannelQueue / userOpenchannelQueue.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 _0x299a=['jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x5be795,_0x1cb1b8){var _0x4e8a3b=function(_0x5584ef){while(--_0x5584ef){_0x5be795['push'](_0x5be795['shift']());}};_0x4e8a3b(++_0x1cb1b8);}(_0x299a,0x1d7));var _0xa299=function(_0x1f331e,_0x47d5cb){_0x1f331e=_0x1f331e-0x0;var _0x1a020c=_0x299a[_0x1f331e];return _0x1a020c;};'use strict';var _=require('lodash');var util=require(_0xa299('0x0'));var moment=require(_0xa299('0x1'));var BPromise=require(_0xa299('0x2'));var rs=require(_0xa299('0x3'));var fs=require('fs');var Redis=require(_0xa299('0x4'));var db=require(_0xa299('0x5'))['db'];var utils=require(_0xa299('0x6'));var logger=require('../../config/logger')(_0xa299('0x7'));var config=require(_0xa299('0x8'));var jayson=require(_0xa299('0x9'));var client=jayson[_0xa299('0xa')][_0xa299('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bbefe,_0x17dbb0,_0x3a29cf){return new BPromise(function(_0x42cf44,_0x5f05e7){return client[_0xa299('0xc')](_0x3bbefe,_0x3a29cf)[_0xa299('0xd')](function(_0x4c5a4f){logger[_0xa299('0xe')](_0xa299('0xf'),_0x17dbb0,'request\x20sent');logger[_0xa299('0x10')](_0xa299('0x11'),_0x17dbb0,_0xa299('0x12'),JSON[_0xa299('0x13')](_0x4c5a4f));if(_0x4c5a4f[_0xa299('0x14')]){if(_0x4c5a4f[_0xa299('0x14')][_0xa299('0x15')]===0x1f4){logger[_0xa299('0x14')](_0xa299('0xf'),_0x17dbb0,_0x4c5a4f[_0xa299('0x14')]['message']);return _0x5f05e7(_0x4c5a4f[_0xa299('0x14')][_0xa299('0x16')]);}logger[_0xa299('0x14')](_0xa299('0xf'),_0x17dbb0,_0x4c5a4f[_0xa299('0x14')][_0xa299('0x16')]);return _0x42cf44(_0x4c5a4f[_0xa299('0x14')][_0xa299('0x16')]);}else{logger['info'](_0xa299('0xf'),_0x17dbb0,'request\x20sent');_0x42cf44(_0x4c5a4f['result'][_0xa299('0x16')]);}})[_0xa299('0x17')](function(_0x462f46){logger['error'](_0xa299('0xf'),_0x17dbb0,_0x462f46);_0x5f05e7(_0x462f46);});});}