281ec686697b0d4f6ea64d3d98f79d1f7309eb9c
[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 _0xacb8=['UserWhatsappQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1c3186,_0x24126e){var _0x5df9ed=function(_0x4c5da2){while(--_0x4c5da2){_0x1c3186['push'](_0x1c3186['shift']());}};_0x5df9ed(++_0x24126e);}(_0xacb8,0x169));var _0x8acb=function(_0x2dfb77,_0x9b4e41){_0x2dfb77=_0x2dfb77-0x0;var _0x12ad92=_0xacb8[_0x2dfb77];return _0x12ad92;};'use strict';var _=require(_0x8acb('0x0'));var util=require(_0x8acb('0x1'));var moment=require(_0x8acb('0x2'));var BPromise=require(_0x8acb('0x3'));var rs=require(_0x8acb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8acb('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8acb('0x6'));var config=require(_0x8acb('0x7'));var jayson=require(_0x8acb('0x8'));var client=jayson[_0x8acb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e9936,_0x54d511,_0x292e7d){return new BPromise(function(_0x456017,_0x5eedd1){return client[_0x8acb('0xa')](_0x4e9936,_0x292e7d)[_0x8acb('0xb')](function(_0x2a48c8){logger[_0x8acb('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0x54d511,'request\x20sent');logger[_0x8acb('0xd')](_0x8acb('0xe'),_0x54d511,'request\x20sent',JSON[_0x8acb('0xf')](_0x2a48c8));if(_0x2a48c8[_0x8acb('0x10')]){if(_0x2a48c8[_0x8acb('0x10')]['code']===0x1f4){logger['error'](_0x8acb('0x11'),_0x54d511,_0x2a48c8['error'][_0x8acb('0x12')]);return _0x5eedd1(_0x2a48c8['error'][_0x8acb('0x12')]);}logger[_0x8acb('0x10')](_0x8acb('0x11'),_0x54d511,_0x2a48c8[_0x8acb('0x10')][_0x8acb('0x12')]);return _0x456017(_0x2a48c8[_0x8acb('0x10')][_0x8acb('0x12')]);}else{logger[_0x8acb('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0x54d511,'request\x20sent');_0x456017(_0x2a48c8[_0x8acb('0x13')][_0x8acb('0x12')]);}})[_0x8acb('0x14')](function(_0x403155){logger[_0x8acb('0x10')](_0x8acb('0x11'),_0x54d511,_0x403155);_0x5eedd1(_0x403155);});});}