Built motion from commit 6db1674d.|2.6.23
[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 _0xfc47=['../../mysqldb','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x23dae2,_0x2d4d43){var _0x5794eb=function(_0x338d2e){while(--_0x338d2e){_0x23dae2['push'](_0x23dae2['shift']());}};_0x5794eb(++_0x2d4d43);}(_0xfc47,0xa7));var _0x7fc4=function(_0x13f729,_0x2689d0){_0x13f729=_0x13f729-0x0;var _0x5d1288=_0xfc47[_0x13f729];return _0x5d1288;};'use strict';var _=require(_0x7fc4('0x0'));var util=require(_0x7fc4('0x1'));var moment=require('moment');var BPromise=require(_0x7fc4('0x2'));var rs=require(_0x7fc4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7fc4('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7fc4('0x5')][_0x7fc4('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1ad02d,_0xd63e06,_0x20e830){return new BPromise(function(_0x1fb436,_0x271a49){return client[_0x7fc4('0x7')](_0x1ad02d,_0x20e830)[_0x7fc4('0x8')](function(_0x2a99e2){logger[_0x7fc4('0x9')](_0x7fc4('0xa'),_0xd63e06,_0x7fc4('0xb'));logger['debug'](_0x7fc4('0xc'),_0xd63e06,_0x7fc4('0xb'),JSON[_0x7fc4('0xd')](_0x2a99e2));if(_0x2a99e2['error']){if(_0x2a99e2[_0x7fc4('0xe')][_0x7fc4('0xf')]===0x1f4){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0xd63e06,_0x2a99e2['error'][_0x7fc4('0x10')]);return _0x271a49(_0x2a99e2['error'][_0x7fc4('0x10')]);}logger[_0x7fc4('0xe')](_0x7fc4('0xa'),_0xd63e06,_0x2a99e2[_0x7fc4('0xe')][_0x7fc4('0x10')]);return _0x1fb436(_0x2a99e2['error'][_0x7fc4('0x10')]);}else{logger[_0x7fc4('0x9')](_0x7fc4('0xa'),_0xd63e06,_0x7fc4('0xb'));_0x1fb436(_0x2a99e2[_0x7fc4('0x11')]['message']);}})[_0x7fc4('0x12')](function(_0x5da008){logger[_0x7fc4('0xe')](_0x7fc4('0xa'),_0xd63e06,_0x5da008);_0x271a49(_0x5da008);});});}