Built motion from commit d13fb11b.|2.6.34
[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 _0x9384=['rpc','../../config/environment','jayson/promise','http','request','then','info','UserChatQueue,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2c1841,_0x505204){var _0x28d148=function(_0x5be79f){while(--_0x5be79f){_0x2c1841['push'](_0x2c1841['shift']());}};_0x28d148(++_0x505204);}(_0x9384,0x100));var _0x4938=function(_0x59befa,_0x4af99b){_0x59befa=_0x59befa-0x0;var _0x1dd63d=_0x9384[_0x59befa];return _0x1dd63d;};'use strict';var _=require(_0x4938('0x0'));var util=require(_0x4938('0x1'));var moment=require(_0x4938('0x2'));var BPromise=require(_0x4938('0x3'));var rs=require(_0x4938('0x4'));var fs=require('fs');var Redis=require(_0x4938('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4938('0x6'));var logger=require(_0x4938('0x7'))(_0x4938('0x8'));var config=require(_0x4938('0x9'));var jayson=require(_0x4938('0xa'));var client=jayson['client'][_0x4938('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49673e,_0x464125,_0x4ca35a){return new BPromise(function(_0x5af48f,_0xf644d7){return client[_0x4938('0xc')](_0x49673e,_0x4ca35a)[_0x4938('0xd')](function(_0x1fcabd){logger[_0x4938('0xe')](_0x4938('0xf'),_0x464125,'request\x20sent');logger[_0x4938('0x10')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x464125,'request\x20sent',JSON[_0x4938('0x11')](_0x1fcabd));if(_0x1fcabd['error']){if(_0x1fcabd[_0x4938('0x12')][_0x4938('0x13')]===0x1f4){logger[_0x4938('0x12')](_0x4938('0xf'),_0x464125,_0x1fcabd['error'][_0x4938('0x14')]);return _0xf644d7(_0x1fcabd[_0x4938('0x12')][_0x4938('0x14')]);}logger[_0x4938('0x12')](_0x4938('0xf'),_0x464125,_0x1fcabd['error'][_0x4938('0x14')]);return _0x5af48f(_0x1fcabd[_0x4938('0x12')]['message']);}else{logger[_0x4938('0xe')](_0x4938('0xf'),_0x464125,_0x4938('0x15'));_0x5af48f(_0x1fcabd['result'][_0x4938('0x14')]);}})['catch'](function(_0x24e9c5){logger[_0x4938('0x12')](_0x4938('0xf'),_0x464125,_0x24e9c5);_0xf644d7(_0x24e9c5);});});}