Built motion from commit 4ffc18b1.|2.6.31
[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 _0xfc6f=['randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','lodash','moment'];(function(_0x55e25c,_0x5de6a6){var _0xb42603=function(_0x14b7b7){while(--_0x14b7b7){_0x55e25c['push'](_0x55e25c['shift']());}};_0xb42603(++_0x5de6a6);}(_0xfc6f,0x152));var _0xffc6=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xfc6f[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0xffc6('0x0'));var util=require('util');var moment=require(_0xffc6('0x1'));var BPromise=require('bluebird');var rs=require(_0xffc6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xffc6('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xffc6('0x4'))(_0xffc6('0x5'));var config=require('../../config/environment');var jayson=require(_0xffc6('0x6'));var client=jayson[_0xffc6('0x7')][_0xffc6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51cb5c,_0x59912a,_0x183fb5){return new BPromise(function(_0xb842a,_0x414d37){return client[_0xffc6('0x9')](_0x51cb5c,_0x183fb5)[_0xffc6('0xa')](function(_0x55a868){logger[_0xffc6('0xb')](_0xffc6('0xc'),_0x59912a,'request\x20sent');logger[_0xffc6('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x59912a,_0xffc6('0xe'),JSON[_0xffc6('0xf')](_0x55a868));if(_0x55a868[_0xffc6('0x10')]){if(_0x55a868['error']['code']===0x1f4){logger[_0xffc6('0x10')](_0xffc6('0xc'),_0x59912a,_0x55a868[_0xffc6('0x10')]['message']);return _0x414d37(_0x55a868[_0xffc6('0x10')][_0xffc6('0x11')]);}logger[_0xffc6('0x10')](_0xffc6('0xc'),_0x59912a,_0x55a868[_0xffc6('0x10')][_0xffc6('0x11')]);return _0xb842a(_0x55a868[_0xffc6('0x10')]['message']);}else{logger[_0xffc6('0xb')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x59912a,'request\x20sent');_0xb842a(_0x55a868[_0xffc6('0x12')][_0xffc6('0x11')]);}})[_0xffc6('0x13')](function(_0x3a8325){logger['error'](_0xffc6('0xc'),_0x59912a,_0x3a8325);_0x414d37(_0x3a8325);});});}