11767775a487efcbe501dda578ab78227acbf308
[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 _0xf783=['../../config/logger','rpc','../../config/environment','client','http','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x3dc952,_0x446113){var _0x17eed2=function(_0x573757){while(--_0x573757){_0x3dc952['push'](_0x3dc952['shift']());}};_0x17eed2(++_0x446113);}(_0xf783,0x72));var _0x3f78=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf783[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3f78('0x0'));var util=require('util');var moment=require(_0x3f78('0x1'));var BPromise=require(_0x3f78('0x2'));var rs=require(_0x3f78('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3f78('0x4'))['db'];var utils=require(_0x3f78('0x5'));var logger=require(_0x3f78('0x6'))(_0x3f78('0x7'));var config=require(_0x3f78('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3f78('0x9')][_0x3f78('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x449bc4,_0x212d5f,_0x5e912){return new BPromise(function(_0x4d29f3,_0x3de0b8){return client['request'](_0x449bc4,_0x5e912)['then'](function(_0x23028f){logger[_0x3f78('0xb')](_0x3f78('0xc'),_0x212d5f,_0x3f78('0xd'));logger[_0x3f78('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x212d5f,_0x3f78('0xd'),JSON[_0x3f78('0xf')](_0x23028f));if(_0x23028f[_0x3f78('0x10')]){if(_0x23028f[_0x3f78('0x10')][_0x3f78('0x11')]===0x1f4){logger[_0x3f78('0x10')](_0x3f78('0xc'),_0x212d5f,_0x23028f['error'][_0x3f78('0x12')]);return _0x3de0b8(_0x23028f['error'][_0x3f78('0x12')]);}logger[_0x3f78('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x212d5f,_0x23028f[_0x3f78('0x10')]['message']);return _0x4d29f3(_0x23028f[_0x3f78('0x10')]['message']);}else{logger[_0x3f78('0xb')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x212d5f,_0x3f78('0xd'));_0x4d29f3(_0x23028f['result'][_0x3f78('0x12')]);}})[_0x3f78('0x13')](function(_0x289169){logger[_0x3f78('0x10')](_0x3f78('0xc'),_0x212d5f,_0x289169);_0x3de0b8(_0x289169);});});}