Built motion from commit (unavailable).|2.5.15
[motion2.git] / server / api / userChatQueue / userChatQueue.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 _0x8420=['rpc','../../config/environment','client','http','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x3a6318,_0x392af1){var _0x14c2de=function(_0x4861e5){while(--_0x4861e5){_0x3a6318['push'](_0x3a6318['shift']());}};_0x14c2de(++_0x392af1);}(_0x8420,0x176));var _0x0842=function(_0x400906,_0x568a81){_0x400906=_0x400906-0x0;var _0x2e4f05=_0x8420[_0x400906];return _0x2e4f05;};'use strict';var _=require(_0x0842('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0842('0x1'));var rs=require(_0x0842('0x2'));var fs=require('fs');var Redis=require(_0x0842('0x3'));var db=require(_0x0842('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0842('0x5'))(_0x0842('0x6'));var config=require(_0x0842('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0842('0x8')][_0x0842('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x466690,_0x29a560,_0x68c6ca){return new BPromise(function(_0xa4f590,_0x2c2012){return client['request'](_0x466690,_0x68c6ca)[_0x0842('0xa')](function(_0x2726b1){logger[_0x0842('0xb')](_0x0842('0xc'),_0x29a560,_0x0842('0xd'));logger[_0x0842('0xe')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x29a560,'request\x20sent',JSON[_0x0842('0xf')](_0x2726b1));if(_0x2726b1[_0x0842('0x10')]){if(_0x2726b1['error']['code']===0x1f4){logger[_0x0842('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x29a560,_0x2726b1[_0x0842('0x10')]['message']);return _0x2c2012(_0x2726b1[_0x0842('0x10')][_0x0842('0x11')]);}logger[_0x0842('0x10')](_0x0842('0xc'),_0x29a560,_0x2726b1['error'][_0x0842('0x11')]);return _0xa4f590(_0x2726b1[_0x0842('0x10')][_0x0842('0x11')]);}else{logger[_0x0842('0xb')](_0x0842('0xc'),_0x29a560,_0x0842('0xd'));_0xa4f590(_0x2726b1['result'][_0x0842('0x11')]);}})[_0x0842('0x12')](function(_0x5f4295){logger[_0x0842('0x10')](_0x0842('0xc'),_0x29a560,_0x5f4295);_0x2c2012(_0x5f4295);});});}