Built motion from commit 9d0783e6.|2.6.13
[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 _0xbb22=['UserWhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','debug'];(function(_0x2d0047,_0x409031){var _0x45d698=function(_0x721038){while(--_0x721038){_0x2d0047['push'](_0x2d0047['shift']());}};_0x45d698(++_0x409031);}(_0xbb22,0x1d3));var _0x2bb2=function(_0x308fd7,_0x5cf599){_0x308fd7=_0x308fd7-0x0;var _0x5d5509=_0xbb22[_0x308fd7];return _0x5d5509;};'use strict';var _=require(_0x2bb2('0x0'));var util=require('util');var moment=require(_0x2bb2('0x1'));var BPromise=require('bluebird');var rs=require(_0x2bb2('0x2'));var fs=require('fs');var Redis=require(_0x2bb2('0x3'));var db=require(_0x2bb2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2bb2('0x5'))(_0x2bb2('0x6'));var config=require(_0x2bb2('0x7'));var jayson=require(_0x2bb2('0x8'));var client=jayson[_0x2bb2('0x9')][_0x2bb2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9bebf1,_0x290902,_0x577067){return new BPromise(function(_0x2a8829,_0xaa5746){return client[_0x2bb2('0xb')](_0x9bebf1,_0x577067)[_0x2bb2('0xc')](function(_0x441173){logger[_0x2bb2('0xd')](_0x2bb2('0xe'),_0x290902,'request\x20sent');logger[_0x2bb2('0xf')](_0x2bb2('0x10'),_0x290902,_0x2bb2('0x11'),JSON[_0x2bb2('0x12')](_0x441173));if(_0x441173['error']){if(_0x441173[_0x2bb2('0x13')]['code']===0x1f4){logger[_0x2bb2('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0x290902,_0x441173['error'][_0x2bb2('0x14')]);return _0xaa5746(_0x441173['error'][_0x2bb2('0x14')]);}logger[_0x2bb2('0x13')](_0x2bb2('0xe'),_0x290902,_0x441173[_0x2bb2('0x13')][_0x2bb2('0x14')]);return _0x2a8829(_0x441173['error'][_0x2bb2('0x14')]);}else{logger['info'](_0x2bb2('0xe'),_0x290902,'request\x20sent');_0x2a8829(_0x441173[_0x2bb2('0x15')][_0x2bb2('0x14')]);}})[_0x2bb2('0x16')](function(_0x564f04){logger[_0x2bb2('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0x290902,_0x564f04);_0xaa5746(_0x564f04);});});}