5d223ac9474cf70b059e001e956539b617d027d6
[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 _0xb76e=['stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s'];(function(_0x574c60,_0x653c40){var _0x57bb5e=function(_0x20ad7e){while(--_0x20ad7e){_0x574c60['push'](_0x574c60['shift']());}};_0x57bb5e(++_0x653c40);}(_0xb76e,0x154));var _0xeb76=function(_0x3a658b,_0x49a728){_0x3a658b=_0x3a658b-0x0;var _0x528ad0=_0xb76e[_0x3a658b];return _0x528ad0;};'use strict';var _=require('lodash');var util=require(_0xeb76('0x0'));var moment=require(_0xeb76('0x1'));var BPromise=require(_0xeb76('0x2'));var rs=require(_0xeb76('0x3'));var fs=require('fs');var Redis=require(_0xeb76('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xeb76('0x5'));var logger=require(_0xeb76('0x6'))(_0xeb76('0x7'));var config=require('../../config/environment');var jayson=require(_0xeb76('0x8'));var client=jayson['client'][_0xeb76('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x298d45,_0x4b4b0e,_0x160864){return new BPromise(function(_0x133d1d,_0x3af2cf){return client[_0xeb76('0xa')](_0x298d45,_0x160864)[_0xeb76('0xb')](function(_0x806ece){logger[_0xeb76('0xc')](_0xeb76('0xd'),_0x4b4b0e,_0xeb76('0xe'));logger[_0xeb76('0xf')](_0xeb76('0x10'),_0x4b4b0e,'request\x20sent',JSON[_0xeb76('0x11')](_0x806ece));if(_0x806ece['error']){if(_0x806ece['error']['code']===0x1f4){logger[_0xeb76('0x12')](_0xeb76('0xd'),_0x4b4b0e,_0x806ece[_0xeb76('0x12')][_0xeb76('0x13')]);return _0x3af2cf(_0x806ece[_0xeb76('0x12')][_0xeb76('0x13')]);}logger[_0xeb76('0x12')](_0xeb76('0xd'),_0x4b4b0e,_0x806ece[_0xeb76('0x12')][_0xeb76('0x13')]);return _0x133d1d(_0x806ece['error'][_0xeb76('0x13')]);}else{logger[_0xeb76('0xc')](_0xeb76('0xd'),_0x4b4b0e,_0xeb76('0xe'));_0x133d1d(_0x806ece['result'][_0xeb76('0x13')]);}})[_0xeb76('0x14')](function(_0x3512a8){logger[_0xeb76('0x12')](_0xeb76('0xd'),_0x4b4b0e,_0x3512a8);_0x3af2cf(_0x3512a8);});});}