Built motion from commit 85328c08.|2.5.50
[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 _0x2169=['code','UserWhatsappQueue,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error'];(function(_0x4739ed,_0x1bfd80){var _0x50d46e=function(_0x2b32d2){while(--_0x2b32d2){_0x4739ed['push'](_0x4739ed['shift']());}};_0x50d46e(++_0x1bfd80);}(_0x2169,0x164));var _0x9216=function(_0x6a734c,_0x1b2d9f){_0x6a734c=_0x6a734c-0x0;var _0x494d0d=_0x2169[_0x6a734c];return _0x494d0d;};'use strict';var _=require(_0x9216('0x0'));var util=require(_0x9216('0x1'));var moment=require(_0x9216('0x2'));var BPromise=require(_0x9216('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9216('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9216('0x5'));var logger=require(_0x9216('0x6'))(_0x9216('0x7'));var config=require(_0x9216('0x8'));var jayson=require(_0x9216('0x9'));var client=jayson[_0x9216('0xa')][_0x9216('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f914a,_0x4747a2,_0x124f39){return new BPromise(function(_0x3e73d0,_0x1fb101){return client[_0x9216('0xc')](_0x4f914a,_0x124f39)[_0x9216('0xd')](function(_0x172269){logger[_0x9216('0xe')]('UserWhatsappQueue,\x20%s,\x20%s',_0x4747a2,_0x9216('0xf'));logger['debug']('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x4747a2,_0x9216('0xf'),JSON[_0x9216('0x10')](_0x172269));if(_0x172269[_0x9216('0x11')]){if(_0x172269[_0x9216('0x11')][_0x9216('0x12')]===0x1f4){logger[_0x9216('0x11')](_0x9216('0x13'),_0x4747a2,_0x172269[_0x9216('0x11')][_0x9216('0x14')]);return _0x1fb101(_0x172269['error'][_0x9216('0x14')]);}logger[_0x9216('0x11')](_0x9216('0x13'),_0x4747a2,_0x172269[_0x9216('0x11')][_0x9216('0x14')]);return _0x3e73d0(_0x172269[_0x9216('0x11')][_0x9216('0x14')]);}else{logger['info'](_0x9216('0x13'),_0x4747a2,'request\x20sent');_0x3e73d0(_0x172269[_0x9216('0x15')][_0x9216('0x14')]);}})['catch'](function(_0x13a76b){logger[_0x9216('0x11')](_0x9216('0x13'),_0x4747a2,_0x13a76b);_0x1fb101(_0x13a76b);});});}