e04c8eafb30eb2c318c1573af8d2176e250b3f04
[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 _0x18aa=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x22e930,_0x32e4c7){var _0x7afabf=function(_0x2c5873){while(--_0x2c5873){_0x22e930['push'](_0x22e930['shift']());}};_0x7afabf(++_0x32e4c7);}(_0x18aa,0x168));var _0xa18a=function(_0xa4632d,_0x156c90){_0xa4632d=_0xa4632d-0x0;var _0x32208b=_0x18aa[_0xa4632d];return _0x32208b;};'use strict';var _=require(_0xa18a('0x0'));var util=require('util');var moment=require(_0xa18a('0x1'));var BPromise=require(_0xa18a('0x2'));var rs=require(_0xa18a('0x3'));var fs=require('fs');var Redis=require(_0xa18a('0x4'));var db=require(_0xa18a('0x5'))['db'];var utils=require(_0xa18a('0x6'));var logger=require(_0xa18a('0x7'))(_0xa18a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xa18a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9587d,_0x57e15c,_0x64202){return new BPromise(function(_0x1a18ea,_0x120eb0){return client['request'](_0x9587d,_0x64202)[_0xa18a('0xa')](function(_0x37fc63){logger[_0xa18a('0xb')](_0xa18a('0xc'),_0x57e15c,_0xa18a('0xd'));logger['debug'](_0xa18a('0xe'),_0x57e15c,_0xa18a('0xd'),JSON[_0xa18a('0xf')](_0x37fc63));if(_0x37fc63[_0xa18a('0x10')]){if(_0x37fc63[_0xa18a('0x10')][_0xa18a('0x11')]===0x1f4){logger['error'](_0xa18a('0xc'),_0x57e15c,_0x37fc63[_0xa18a('0x10')][_0xa18a('0x12')]);return _0x120eb0(_0x37fc63[_0xa18a('0x10')]['message']);}logger[_0xa18a('0x10')](_0xa18a('0xc'),_0x57e15c,_0x37fc63[_0xa18a('0x10')][_0xa18a('0x12')]);return _0x1a18ea(_0x37fc63[_0xa18a('0x10')][_0xa18a('0x12')]);}else{logger['info'](_0xa18a('0xc'),_0x57e15c,_0xa18a('0xd'));_0x1a18ea(_0x37fc63[_0xa18a('0x13')][_0xa18a('0x12')]);}})[_0xa18a('0x14')](function(_0x5973b1){logger[_0xa18a('0x10')]('UserWhatsappQueue,\x20%s,\x20%s',_0x57e15c,_0x5973b1);_0x120eb0(_0x5973b1);});});}