Built motion from commit 355702c8.|2.5.41
[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 _0xbb99=['error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s'];(function(_0x5a5ad8,_0x34911c){var _0x5512e5=function(_0x18cbe6){while(--_0x18cbe6){_0x5a5ad8['push'](_0x5a5ad8['shift']());}};_0x5512e5(++_0x34911c);}(_0xbb99,0x1a5));var _0x9bb9=function(_0x4eec9b,_0x4aea09){_0x4eec9b=_0x4eec9b-0x0;var _0x2e3849=_0xbb99[_0x4eec9b];return _0x2e3849;};'use strict';var _=require(_0x9bb9('0x0'));var util=require(_0x9bb9('0x1'));var moment=require(_0x9bb9('0x2'));var BPromise=require('bluebird');var rs=require(_0x9bb9('0x3'));var fs=require('fs');var Redis=require(_0x9bb9('0x4'));var db=require(_0x9bb9('0x5'))['db'];var utils=require(_0x9bb9('0x6'));var logger=require(_0x9bb9('0x7'))(_0x9bb9('0x8'));var config=require(_0x9bb9('0x9'));var jayson=require(_0x9bb9('0xa'));var client=jayson[_0x9bb9('0xb')][_0x9bb9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x422957,_0x4b6e02,_0x344e1e){return new BPromise(function(_0x4801a1,_0x23f159){return client['request'](_0x422957,_0x344e1e)[_0x9bb9('0xd')](function(_0x1175d8){logger[_0x9bb9('0xe')](_0x9bb9('0xf'),_0x4b6e02,_0x9bb9('0x10'));logger[_0x9bb9('0x11')](_0x9bb9('0x12'),_0x4b6e02,_0x9bb9('0x10'),JSON['stringify'](_0x1175d8));if(_0x1175d8['error']){if(_0x1175d8[_0x9bb9('0x13')]['code']===0x1f4){logger['error'](_0x9bb9('0xf'),_0x4b6e02,_0x1175d8[_0x9bb9('0x13')][_0x9bb9('0x14')]);return _0x23f159(_0x1175d8['error'][_0x9bb9('0x14')]);}logger[_0x9bb9('0x13')](_0x9bb9('0xf'),_0x4b6e02,_0x1175d8[_0x9bb9('0x13')][_0x9bb9('0x14')]);return _0x4801a1(_0x1175d8['error'][_0x9bb9('0x14')]);}else{logger[_0x9bb9('0xe')](_0x9bb9('0xf'),_0x4b6e02,'request\x20sent');_0x4801a1(_0x1175d8['result']['message']);}})[_0x9bb9('0x15')](function(_0x1b785d){logger['error'](_0x9bb9('0xf'),_0x4b6e02,_0x1b785d);_0x23f159(_0x1b785d);});});}