c2f6185731542f5f6549e3177b73aa3fdd51cd6f
[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 _0x4e62=['rpc','jayson/promise','client','http','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x4e62,0x11f));var _0x24e6=function(_0x251173,_0x2c2abb){_0x251173=_0x251173-0x0;var _0x4a6016=_0x4e62[_0x251173];return _0x4a6016;};'use strict';var _=require(_0x24e6('0x0'));var util=require(_0x24e6('0x1'));var moment=require(_0x24e6('0x2'));var BPromise=require(_0x24e6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x24e6('0x4'))['db'];var utils=require(_0x24e6('0x5'));var logger=require(_0x24e6('0x6'))(_0x24e6('0x7'));var config=require('../../config/environment');var jayson=require(_0x24e6('0x8'));var client=jayson[_0x24e6('0x9')][_0x24e6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1316d3,_0x475df5,_0x32d545){return new BPromise(function(_0x5c8edb,_0x2b7239){return client['request'](_0x1316d3,_0x32d545)[_0x24e6('0xb')](function(_0x12850e){logger[_0x24e6('0xc')](_0x24e6('0xd'),_0x475df5,_0x24e6('0xe'));logger['debug'](_0x24e6('0xf'),_0x475df5,_0x24e6('0xe'),JSON[_0x24e6('0x10')](_0x12850e));if(_0x12850e[_0x24e6('0x11')]){if(_0x12850e[_0x24e6('0x11')][_0x24e6('0x12')]===0x1f4){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x475df5,_0x12850e[_0x24e6('0x11')][_0x24e6('0x13')]);return _0x2b7239(_0x12850e[_0x24e6('0x11')][_0x24e6('0x13')]);}logger[_0x24e6('0x11')](_0x24e6('0xd'),_0x475df5,_0x12850e[_0x24e6('0x11')]['message']);return _0x5c8edb(_0x12850e[_0x24e6('0x11')]['message']);}else{logger[_0x24e6('0xc')](_0x24e6('0xd'),_0x475df5,_0x24e6('0xe'));_0x5c8edb(_0x12850e[_0x24e6('0x14')][_0x24e6('0x13')]);}})['catch'](function(_0x33adfc){logger[_0x24e6('0x11')](_0x24e6('0xd'),_0x475df5,_0x33adfc);_0x2b7239(_0x33adfc);});});}