Built motion from commit 67e5df37.|2.0.66
[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 _0xec09=['debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xec09,0x178));var _0x9ec0=function(_0x4ed303,_0x48ae86){_0x4ed303=_0x4ed303-0x0;var _0x1eedcf=_0xec09[_0x4ed303];return _0x1eedcf;};'use strict';var _=require('lodash');var util=require(_0x9ec0('0x0'));var moment=require(_0x9ec0('0x1'));var BPromise=require(_0x9ec0('0x2'));var rs=require(_0x9ec0('0x3'));var fs=require('fs');var db=require(_0x9ec0('0x4'))['db'];var utils=require(_0x9ec0('0x5'));var logger=require(_0x9ec0('0x6'))(_0x9ec0('0x7'));var config=require(_0x9ec0('0x8'));var jayson=require(_0x9ec0('0x9'));var client=jayson['client'][_0x9ec0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57c13d,_0x159d66,_0x101aa3){return new BPromise(function(_0x35391a,_0x205f87){return client[_0x9ec0('0xb')](_0x57c13d,_0x101aa3)[_0x9ec0('0xc')](function(_0x6836b4){logger['info'](_0x9ec0('0xd'),_0x159d66,_0x9ec0('0xe'));logger[_0x9ec0('0xf')](_0x9ec0('0x10'),_0x159d66,_0x9ec0('0xe'),JSON[_0x9ec0('0x11')](_0x6836b4));if(_0x6836b4[_0x9ec0('0x12')]){if(_0x6836b4[_0x9ec0('0x12')][_0x9ec0('0x13')]===0x1f4){logger[_0x9ec0('0x12')](_0x9ec0('0xd'),_0x159d66,_0x6836b4['error'][_0x9ec0('0x14')]);return _0x205f87(_0x6836b4[_0x9ec0('0x12')]['message']);}logger[_0x9ec0('0x12')](_0x9ec0('0xd'),_0x159d66,_0x6836b4[_0x9ec0('0x12')][_0x9ec0('0x14')]);return _0x35391a(_0x6836b4[_0x9ec0('0x12')][_0x9ec0('0x14')]);}else{logger[_0x9ec0('0x15')](_0x9ec0('0xd'),_0x159d66,_0x9ec0('0xe'));_0x35391a(_0x6836b4['result'][_0x9ec0('0x14')]);}})[_0x9ec0('0x16')](function(_0x2e668d){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x159d66,_0x2e668d);_0x205f87(_0x2e668d);});});}