6dba3865c3f0c20a0da05b54922ddee52a4be4e5
[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 _0xb3c4=['request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','UserWhatsappQueue,\x20%s,\x20%s'];(function(_0x5bbdeb,_0x5b6172){var _0x969b83=function(_0x551865){while(--_0x551865){_0x5bbdeb['push'](_0x5bbdeb['shift']());}};_0x969b83(++_0x5b6172);}(_0xb3c4,0x1ab));var _0x4b3c=function(_0x294f4d,_0x35032d){_0x294f4d=_0x294f4d-0x0;var _0x3519ce=_0xb3c4[_0x294f4d];return _0x3519ce;};'use strict';var _=require(_0x4b3c('0x0'));var util=require('util');var moment=require(_0x4b3c('0x1'));var BPromise=require(_0x4b3c('0x2'));var rs=require(_0x4b3c('0x3'));var fs=require('fs');var Redis=require(_0x4b3c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4b3c('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4b3c('0x6'));var jayson=require(_0x4b3c('0x7'));var client=jayson[_0x4b3c('0x8')][_0x4b3c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d0cce,_0x10c3d3,_0x6a6c93){return new BPromise(function(_0x3b6760,_0x39a42e){return client['request'](_0x2d0cce,_0x6a6c93)[_0x4b3c('0xa')](function(_0xd821e9){logger[_0x4b3c('0xb')](_0x4b3c('0xc'),_0x10c3d3,_0x4b3c('0xd'));logger[_0x4b3c('0xe')](_0x4b3c('0xf'),_0x10c3d3,_0x4b3c('0xd'),JSON[_0x4b3c('0x10')](_0xd821e9));if(_0xd821e9[_0x4b3c('0x11')]){if(_0xd821e9[_0x4b3c('0x11')][_0x4b3c('0x12')]===0x1f4){logger[_0x4b3c('0x11')](_0x4b3c('0xc'),_0x10c3d3,_0xd821e9[_0x4b3c('0x11')][_0x4b3c('0x13')]);return _0x39a42e(_0xd821e9[_0x4b3c('0x11')][_0x4b3c('0x13')]);}logger[_0x4b3c('0x11')](_0x4b3c('0xc'),_0x10c3d3,_0xd821e9[_0x4b3c('0x11')]['message']);return _0x3b6760(_0xd821e9[_0x4b3c('0x11')][_0x4b3c('0x13')]);}else{logger[_0x4b3c('0xb')](_0x4b3c('0xc'),_0x10c3d3,'request\x20sent');_0x3b6760(_0xd821e9[_0x4b3c('0x14')]['message']);}})[_0x4b3c('0x15')](function(_0x6e0716){logger[_0x4b3c('0x11')](_0x4b3c('0xc'),_0x10c3d3,_0x6e0716);_0x39a42e(_0x6e0716);});});}