Built motion from commit d5e4af8c.|2.6.23
[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 _0xb850=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','stringify','error','code','message','catch','moment','bluebird'];(function(_0x8c5b9f,_0xb1296b){var _0x42dcf2=function(_0x502540){while(--_0x502540){_0x8c5b9f['push'](_0x8c5b9f['shift']());}};_0x42dcf2(++_0xb1296b);}(_0xb850,0x9e));var _0x0b85=function(_0x2644dd,_0x39d79e){_0x2644dd=_0x2644dd-0x0;var _0x4dad81=_0xb850[_0x2644dd];return _0x4dad81;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0b85('0x0'));var BPromise=require(_0x0b85('0x1'));var rs=require(_0x0b85('0x2'));var fs=require('fs');var Redis=require(_0x0b85('0x3'));var db=require(_0x0b85('0x4'))['db'];var utils=require(_0x0b85('0x5'));var logger=require('../../config/logger')(_0x0b85('0x6'));var config=require('../../config/environment');var jayson=require(_0x0b85('0x7'));var client=jayson[_0x0b85('0x8')][_0x0b85('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47a428,_0x2fba0e,_0x3665a7){return new BPromise(function(_0xb68be5,_0x357612){return client[_0x0b85('0xa')](_0x47a428,_0x3665a7)[_0x0b85('0xb')](function(_0x11bb88){logger[_0x0b85('0xc')](_0x0b85('0xd'),_0x2fba0e,'request\x20sent');logger[_0x0b85('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x2fba0e,'request\x20sent',JSON[_0x0b85('0xf')](_0x11bb88));if(_0x11bb88[_0x0b85('0x10')]){if(_0x11bb88['error'][_0x0b85('0x11')]===0x1f4){logger[_0x0b85('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2fba0e,_0x11bb88[_0x0b85('0x10')][_0x0b85('0x12')]);return _0x357612(_0x11bb88['error'][_0x0b85('0x12')]);}logger[_0x0b85('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2fba0e,_0x11bb88[_0x0b85('0x10')][_0x0b85('0x12')]);return _0xb68be5(_0x11bb88[_0x0b85('0x10')][_0x0b85('0x12')]);}else{logger[_0x0b85('0xc')](_0x0b85('0xd'),_0x2fba0e,'request\x20sent');_0xb68be5(_0x11bb88['result'][_0x0b85('0x12')]);}})[_0x0b85('0x13')](function(_0x1c7835){logger['error'](_0x0b85('0xd'),_0x2fba0e,_0x1c7835);_0x357612(_0x1c7835);});});}