6a0712c067b24134f858fa27cd0808a79f5a621f
[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 _0xac5e=['request','UserOpenchannelQueue,\x20%s,\x20%s','debug','code','error','message','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac5e,0xed));var _0xeac5=function(_0x48c789,_0x4f0a4a){_0x48c789=_0x48c789-0x0;var _0x377a9c=_0xac5e[_0x48c789];return _0x377a9c;};'use strict';var _=require(_0xeac5('0x0'));var util=require(_0xeac5('0x1'));var moment=require('moment');var BPromise=require(_0xeac5('0x2'));var rs=require(_0xeac5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeac5('0x4'))['db'];var utils=require(_0xeac5('0x5'));var logger=require('../../config/logger')(_0xeac5('0x6'));var config=require(_0xeac5('0x7'));var jayson=require(_0xeac5('0x8'));var client=jayson[_0xeac5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37899c,_0xa7346d,_0x5be97a){return new BPromise(function(_0x140e71,_0x4fb3c5){return client[_0xeac5('0xa')](_0x37899c,_0x5be97a)['then'](function(_0x482382){logger['info'](_0xeac5('0xb'),_0xa7346d,'request\x20sent');logger[_0xeac5('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0xa7346d,'request\x20sent',JSON['stringify'](_0x482382));if(_0x482382['error']){if(_0x482382['error'][_0xeac5('0xd')]===0x1f4){logger[_0xeac5('0xe')](_0xeac5('0xb'),_0xa7346d,_0x482382['error'][_0xeac5('0xf')]);return _0x4fb3c5(_0x482382[_0xeac5('0xe')][_0xeac5('0xf')]);}logger[_0xeac5('0xe')](_0xeac5('0xb'),_0xa7346d,_0x482382[_0xeac5('0xe')]['message']);return _0x140e71(_0x482382[_0xeac5('0xe')][_0xeac5('0xf')]);}else{logger[_0xeac5('0x10')](_0xeac5('0xb'),_0xa7346d,'request\x20sent');_0x140e71(_0x482382[_0xeac5('0x11')][_0xeac5('0xf')]);}})[_0xeac5('0x12')](function(_0x158a8a){logger['error'](_0xeac5('0xb'),_0xa7346d,_0x158a8a);_0x4fb3c5(_0x158a8a);});});}