783a71af7a04125f7983bc9e90d9f31a33a70bcc
[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 _0xfd50=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s'];(function(_0x4fe467,_0x4b5f24){var _0x236fff=function(_0x5be47c){while(--_0x5be47c){_0x4fe467['push'](_0x4fe467['shift']());}};_0x236fff(++_0x4b5f24);}(_0xfd50,0xbd));var _0x0fd5=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0xfd50[_0x39d544];return _0x5a5ff2;};'use strict';var _=require(_0x0fd5('0x0'));var util=require(_0x0fd5('0x1'));var moment=require(_0x0fd5('0x2'));var BPromise=require(_0x0fd5('0x3'));var rs=require(_0x0fd5('0x4'));var fs=require('fs');var Redis=require(_0x0fd5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0fd5('0x6'));var logger=require(_0x0fd5('0x7'))(_0x0fd5('0x8'));var config=require(_0x0fd5('0x9'));var jayson=require(_0x0fd5('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xa692c3,_0x368c81,_0x4571c0){return new BPromise(function(_0x44dda6,_0x4d730b){return client[_0x0fd5('0xb')](_0xa692c3,_0x4571c0)[_0x0fd5('0xc')](function(_0x39c61a){logger[_0x0fd5('0xd')](_0x0fd5('0xe'),_0x368c81,_0x0fd5('0xf'));logger[_0x0fd5('0x10')](_0x0fd5('0x11'),_0x368c81,_0x0fd5('0xf'),JSON['stringify'](_0x39c61a));if(_0x39c61a[_0x0fd5('0x12')]){if(_0x39c61a[_0x0fd5('0x12')][_0x0fd5('0x13')]===0x1f4){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x368c81,_0x39c61a[_0x0fd5('0x12')]['message']);return _0x4d730b(_0x39c61a[_0x0fd5('0x12')][_0x0fd5('0x14')]);}logger[_0x0fd5('0x12')](_0x0fd5('0xe'),_0x368c81,_0x39c61a[_0x0fd5('0x12')][_0x0fd5('0x14')]);return _0x44dda6(_0x39c61a[_0x0fd5('0x12')]['message']);}else{logger[_0x0fd5('0xd')](_0x0fd5('0xe'),_0x368c81,_0x0fd5('0xf'));_0x44dda6(_0x39c61a[_0x0fd5('0x15')][_0x0fd5('0x14')]);}})[_0x0fd5('0x16')](function(_0x1b169b){logger[_0x0fd5('0x12')](_0x0fd5('0xe'),_0x368c81,_0x1b169b);_0x4d730b(_0x1b169b);});});}