14f62c9bcb3a32daa3eec68e85295ace68d38e30
[motion2.git] / server / api / userWhatsappQueue / userWhatsappQueue.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 _0x90cd=['http','then','info','UserWhatsappQueue,\x20%s,\x20%s','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x24c1aa,_0x5a5e2b){var _0xc35381=function(_0x137ec8){while(--_0x137ec8){_0x24c1aa['push'](_0x24c1aa['shift']());}};_0xc35381(++_0x5a5e2b);}(_0x90cd,0xca));var _0xd90c=function(_0x621b92,_0x50c8ff){_0x621b92=_0x621b92-0x0;var _0xadfec9=_0x90cd[_0x621b92];return _0xadfec9;};'use strict';var _=require(_0xd90c('0x0'));var util=require(_0xd90c('0x1'));var moment=require(_0xd90c('0x2'));var BPromise=require(_0xd90c('0x3'));var rs=require(_0xd90c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd90c('0x5'))['db'];var utils=require(_0xd90c('0x6'));var logger=require('../../config/logger')(_0xd90c('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd90c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e9103,_0x30b541,_0x380332){return new BPromise(function(_0x57a0be,_0x3551b9){return client['request'](_0x5e9103,_0x380332)[_0xd90c('0x9')](function(_0x1cb006){logger[_0xd90c('0xa')](_0xd90c('0xb'),_0x30b541,'request\x20sent');logger[_0xd90c('0xc')](_0xd90c('0xd'),_0x30b541,_0xd90c('0xe'),JSON[_0xd90c('0xf')](_0x1cb006));if(_0x1cb006[_0xd90c('0x10')]){if(_0x1cb006[_0xd90c('0x10')][_0xd90c('0x11')]===0x1f4){logger['error'](_0xd90c('0xb'),_0x30b541,_0x1cb006[_0xd90c('0x10')][_0xd90c('0x12')]);return _0x3551b9(_0x1cb006[_0xd90c('0x10')][_0xd90c('0x12')]);}logger[_0xd90c('0x10')](_0xd90c('0xb'),_0x30b541,_0x1cb006[_0xd90c('0x10')][_0xd90c('0x12')]);return _0x57a0be(_0x1cb006[_0xd90c('0x10')][_0xd90c('0x12')]);}else{logger[_0xd90c('0xa')]('UserWhatsappQueue,\x20%s,\x20%s',_0x30b541,_0xd90c('0xe'));_0x57a0be(_0x1cb006[_0xd90c('0x13')][_0xd90c('0x12')]);}})[_0xd90c('0x14')](function(_0x5c74fc){logger[_0xd90c('0x10')](_0xd90c('0xb'),_0x30b541,_0x5c74fc);_0x3551b9(_0x5c74fc);});});}