Built motion from commit a61a4a20.|2.5.46
[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 _0x8593=['UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0xc1d53c,_0x36ac68){var _0x5b5098=function(_0xc58175){while(--_0xc58175){_0xc1d53c['push'](_0xc1d53c['shift']());}};_0x5b5098(++_0x36ac68);}(_0x8593,0x1ab));var _0x3859=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x8593[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x3859('0x0'));var util=require('util');var moment=require(_0x3859('0x1'));var BPromise=require('bluebird');var rs=require(_0x3859('0x2'));var fs=require('fs');var Redis=require(_0x3859('0x3'));var db=require(_0x3859('0x4'))['db'];var utils=require(_0x3859('0x5'));var logger=require('../../config/logger')(_0x3859('0x6'));var config=require(_0x3859('0x7'));var jayson=require(_0x3859('0x8'));var client=jayson[_0x3859('0x9')][_0x3859('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d8a69,_0x5bf96e,_0x3f0614){return new BPromise(function(_0xc3a393,_0x1206c4){return client[_0x3859('0xb')](_0x3d8a69,_0x3f0614)['then'](function(_0x7bcc0f){logger[_0x3859('0xc')](_0x3859('0xd'),_0x5bf96e,_0x3859('0xe'));logger[_0x3859('0xf')](_0x3859('0x10'),_0x5bf96e,_0x3859('0xe'),JSON['stringify'](_0x7bcc0f));if(_0x7bcc0f['error']){if(_0x7bcc0f[_0x3859('0x11')]['code']===0x1f4){logger[_0x3859('0x11')](_0x3859('0xd'),_0x5bf96e,_0x7bcc0f[_0x3859('0x11')][_0x3859('0x12')]);return _0x1206c4(_0x7bcc0f[_0x3859('0x11')][_0x3859('0x12')]);}logger[_0x3859('0x11')](_0x3859('0xd'),_0x5bf96e,_0x7bcc0f[_0x3859('0x11')]['message']);return _0xc3a393(_0x7bcc0f[_0x3859('0x11')][_0x3859('0x12')]);}else{logger[_0x3859('0xc')](_0x3859('0xd'),_0x5bf96e,_0x3859('0xe'));_0xc3a393(_0x7bcc0f['result'][_0x3859('0x12')]);}})[_0x3859('0x13')](function(_0x29e77a){logger['error'](_0x3859('0xd'),_0x5bf96e,_0x29e77a);_0x1206c4(_0x29e77a);});});}