Built motion from commit a8c4dd89.|2.6.33
[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 _0xe4bc=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','util','moment'];(function(_0x33f926,_0xaac7e5){var _0x207955=function(_0x6d0b8a){while(--_0x6d0b8a){_0x33f926['push'](_0x33f926['shift']());}};_0x207955(++_0xaac7e5);}(_0xe4bc,0x167));var _0xce4b=function(_0xc1fcb4,_0x14f85f){_0xc1fcb4=_0xc1fcb4-0x0;var _0x165912=_0xe4bc[_0xc1fcb4];return _0x165912;};'use strict';var _=require('lodash');var util=require(_0xce4b('0x0'));var moment=require(_0xce4b('0x1'));var BPromise=require('bluebird');var rs=require(_0xce4b('0x2'));var fs=require('fs');var Redis=require(_0xce4b('0x3'));var db=require(_0xce4b('0x4'))['db'];var utils=require(_0xce4b('0x5'));var logger=require(_0xce4b('0x6'))(_0xce4b('0x7'));var config=require('../../config/environment');var jayson=require(_0xce4b('0x8'));var client=jayson[_0xce4b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a2be,_0x52a509,_0x5f39e0){return new BPromise(function(_0xaf4b9d,_0x3edc04){return client[_0xce4b('0xa')](_0x41a2be,_0x5f39e0)[_0xce4b('0xb')](function(_0x1bcea1){logger[_0xce4b('0xc')](_0xce4b('0xd'),_0x52a509,_0xce4b('0xe'));logger['debug']('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x52a509,_0xce4b('0xe'),JSON[_0xce4b('0xf')](_0x1bcea1));if(_0x1bcea1[_0xce4b('0x10')]){if(_0x1bcea1[_0xce4b('0x10')]['code']===0x1f4){logger[_0xce4b('0x10')](_0xce4b('0xd'),_0x52a509,_0x1bcea1[_0xce4b('0x10')][_0xce4b('0x11')]);return _0x3edc04(_0x1bcea1['error']['message']);}logger[_0xce4b('0x10')](_0xce4b('0xd'),_0x52a509,_0x1bcea1[_0xce4b('0x10')][_0xce4b('0x11')]);return _0xaf4b9d(_0x1bcea1[_0xce4b('0x10')][_0xce4b('0x11')]);}else{logger[_0xce4b('0xc')](_0xce4b('0xd'),_0x52a509,'request\x20sent');_0xaf4b9d(_0x1bcea1[_0xce4b('0x12')][_0xce4b('0x11')]);}})['catch'](function(_0x4af71a){logger[_0xce4b('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x52a509,_0x4af71a);_0x3edc04(_0x4af71a);});});}