6e8b00fec6fafc41f82ea093453ce8fb8cbd9e4f
[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 _0x65a5=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x1eaa7f,_0x2a4568){var _0x1e3a07=function(_0x42c6a4){while(--_0x42c6a4){_0x1eaa7f['push'](_0x1eaa7f['shift']());}};_0x1e3a07(++_0x2a4568);}(_0x65a5,0x175));var _0x565a=function(_0x456032,_0x1a799d){_0x456032=_0x456032-0x0;var _0x1a53cd=_0x65a5[_0x456032];return _0x1a53cd;};'use strict';var _=require(_0x565a('0x0'));var util=require(_0x565a('0x1'));var moment=require('moment');var BPromise=require(_0x565a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x565a('0x3'));var db=require(_0x565a('0x4'))['db'];var utils=require(_0x565a('0x5'));var logger=require(_0x565a('0x6'))('rpc');var config=require(_0x565a('0x7'));var jayson=require(_0x565a('0x8'));var client=jayson[_0x565a('0x9')][_0x565a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x206df1,_0x5e01d1,_0x31e41d){return new BPromise(function(_0x42f7d8,_0x210af0){return client['request'](_0x206df1,_0x31e41d)[_0x565a('0xb')](function(_0x32564c){logger[_0x565a('0xc')](_0x565a('0xd'),_0x5e01d1,_0x565a('0xe'));logger[_0x565a('0xf')](_0x565a('0x10'),_0x5e01d1,'request\x20sent',JSON[_0x565a('0x11')](_0x32564c));if(_0x32564c[_0x565a('0x12')]){if(_0x32564c[_0x565a('0x12')][_0x565a('0x13')]===0x1f4){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x5e01d1,_0x32564c['error']['message']);return _0x210af0(_0x32564c[_0x565a('0x12')]['message']);}logger[_0x565a('0x12')](_0x565a('0xd'),_0x5e01d1,_0x32564c['error']['message']);return _0x42f7d8(_0x32564c[_0x565a('0x12')][_0x565a('0x14')]);}else{logger[_0x565a('0xc')](_0x565a('0xd'),_0x5e01d1,_0x565a('0xe'));_0x42f7d8(_0x32564c['result'][_0x565a('0x14')]);}})['catch'](function(_0x454e82){logger['error'](_0x565a('0xd'),_0x5e01d1,_0x454e82);_0x210af0(_0x454e82);});});}