Built motion from commit cafec4f3.|2.6.31
[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 _0xf10a=['result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x372163,_0x85869b){var _0x11cd8a=function(_0x4f0ec1){while(--_0x4f0ec1){_0x372163['push'](_0x372163['shift']());}};_0x11cd8a(++_0x85869b);}(_0xf10a,0x85));var _0xaf10=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0xf10a[_0x266618];return _0x54dbf5;};'use strict';var _=require(_0xaf10('0x0'));var util=require('util');var moment=require(_0xaf10('0x1'));var BPromise=require(_0xaf10('0x2'));var rs=require(_0xaf10('0x3'));var fs=require('fs');var Redis=require(_0xaf10('0x4'));var db=require(_0xaf10('0x5'))['db'];var utils=require(_0xaf10('0x6'));var logger=require(_0xaf10('0x7'))(_0xaf10('0x8'));var config=require(_0xaf10('0x9'));var jayson=require(_0xaf10('0xa'));var client=jayson['client'][_0xaf10('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40eefa,_0x2d091e,_0xb82f0c){return new BPromise(function(_0x4cb0a4,_0x1e4049){return client[_0xaf10('0xc')](_0x40eefa,_0xb82f0c)['then'](function(_0x4e97b1){logger[_0xaf10('0xd')](_0xaf10('0xe'),_0x2d091e,_0xaf10('0xf'));logger[_0xaf10('0x10')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x2d091e,'request\x20sent',JSON[_0xaf10('0x11')](_0x4e97b1));if(_0x4e97b1['error']){if(_0x4e97b1[_0xaf10('0x12')][_0xaf10('0x13')]===0x1f4){logger[_0xaf10('0x12')](_0xaf10('0xe'),_0x2d091e,_0x4e97b1[_0xaf10('0x12')][_0xaf10('0x14')]);return _0x1e4049(_0x4e97b1[_0xaf10('0x12')][_0xaf10('0x14')]);}logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x2d091e,_0x4e97b1[_0xaf10('0x12')]['message']);return _0x4cb0a4(_0x4e97b1['error'][_0xaf10('0x14')]);}else{logger[_0xaf10('0xd')](_0xaf10('0xe'),_0x2d091e,_0xaf10('0xf'));_0x4cb0a4(_0x4e97b1[_0xaf10('0x15')][_0xaf10('0x14')]);}})['catch'](function(_0x1ef8f4){logger['error'](_0xaf10('0xe'),_0x2d091e,_0x1ef8f4);_0x1e4049(_0x1ef8f4);});});}