Built motion from commit 3e059bc2.|2.5.32
[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 _0x4a80=['../../config/logger','jayson/promise','client','request','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x56a42f,_0x1fad3e){var _0x2f8977=function(_0x4128d0){while(--_0x4128d0){_0x56a42f['push'](_0x56a42f['shift']());}};_0x2f8977(++_0x1fad3e);}(_0x4a80,0x1ee));var _0x04a8=function(_0x58b3ce,_0x24e20b){_0x58b3ce=_0x58b3ce-0x0;var _0x1c8926=_0x4a80[_0x58b3ce];return _0x1c8926;};'use strict';var _=require(_0x04a8('0x0'));var util=require(_0x04a8('0x1'));var moment=require('moment');var BPromise=require(_0x04a8('0x2'));var rs=require(_0x04a8('0x3'));var fs=require('fs');var Redis=require(_0x04a8('0x4'));var db=require(_0x04a8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x04a8('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x04a8('0x7'));var client=jayson[_0x04a8('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x865aa6,_0x2a46f8,_0x2897a7){return new BPromise(function(_0x5355a1,_0x1affab){return client[_0x04a8('0x9')](_0x865aa6,_0x2897a7)['then'](function(_0x1b34fc){logger['info'](_0x04a8('0xa'),_0x2a46f8,_0x04a8('0xb'));logger[_0x04a8('0xc')](_0x04a8('0xd'),_0x2a46f8,_0x04a8('0xb'),JSON['stringify'](_0x1b34fc));if(_0x1b34fc[_0x04a8('0xe')]){if(_0x1b34fc[_0x04a8('0xe')][_0x04a8('0xf')]===0x1f4){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x2a46f8,_0x1b34fc[_0x04a8('0xe')][_0x04a8('0x10')]);return _0x1affab(_0x1b34fc[_0x04a8('0xe')]['message']);}logger[_0x04a8('0xe')](_0x04a8('0xa'),_0x2a46f8,_0x1b34fc[_0x04a8('0xe')][_0x04a8('0x10')]);return _0x5355a1(_0x1b34fc[_0x04a8('0xe')]['message']);}else{logger[_0x04a8('0x11')](_0x04a8('0xa'),_0x2a46f8,_0x04a8('0xb'));_0x5355a1(_0x1b34fc[_0x04a8('0x12')][_0x04a8('0x10')]);}})[_0x04a8('0x13')](function(_0x5d825d){logger[_0x04a8('0xe')](_0x04a8('0xa'),_0x2a46f8,_0x5d825d);_0x1affab(_0x5d825d);});});}