Built motion from commit 896e83a8.|2.6.30
[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 _0xcf3e=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5eee53,_0x21813a){var _0x186db6=function(_0x2795da){while(--_0x2795da){_0x5eee53['push'](_0x5eee53['shift']());}};_0x186db6(++_0x21813a);}(_0xcf3e,0x1a5));var _0xecf3=function(_0x9d2f05,_0x488ff0){_0x9d2f05=_0x9d2f05-0x0;var _0x1ba001=_0xcf3e[_0x9d2f05];return _0x1ba001;};'use strict';var _=require(_0xecf3('0x0'));var util=require(_0xecf3('0x1'));var moment=require(_0xecf3('0x2'));var BPromise=require(_0xecf3('0x3'));var rs=require(_0xecf3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xecf3('0x5'))['db'];var utils=require(_0xecf3('0x6'));var logger=require(_0xecf3('0x7'))(_0xecf3('0x8'));var config=require(_0xecf3('0x9'));var jayson=require(_0xecf3('0xa'));var client=jayson[_0xecf3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1012c1,_0x56cd2c,_0x35ddd6){return new BPromise(function(_0x21e61e,_0x3bfefd){return client['request'](_0x1012c1,_0x35ddd6)['then'](function(_0x21b6af){logger['info'](_0xecf3('0xc'),_0x56cd2c,_0xecf3('0xd'));logger[_0xecf3('0xe')](_0xecf3('0xf'),_0x56cd2c,_0xecf3('0xd'),JSON[_0xecf3('0x10')](_0x21b6af));if(_0x21b6af[_0xecf3('0x11')]){if(_0x21b6af[_0xecf3('0x11')][_0xecf3('0x12')]===0x1f4){logger[_0xecf3('0x11')](_0xecf3('0xc'),_0x56cd2c,_0x21b6af['error'][_0xecf3('0x13')]);return _0x3bfefd(_0x21b6af[_0xecf3('0x11')][_0xecf3('0x13')]);}logger['error'](_0xecf3('0xc'),_0x56cd2c,_0x21b6af[_0xecf3('0x11')][_0xecf3('0x13')]);return _0x21e61e(_0x21b6af[_0xecf3('0x11')][_0xecf3('0x13')]);}else{logger['info'](_0xecf3('0xc'),_0x56cd2c,_0xecf3('0xd'));_0x21e61e(_0x21b6af[_0xecf3('0x14')]['message']);}})[_0xecf3('0x15')](function(_0x3b3f3e){logger[_0xecf3('0x11')](_0xecf3('0xc'),_0x56cd2c,_0x3b3f3e);_0x3bfefd(_0x3b3f3e);});});}