Built motion from commit 5ae82ce5.|2.6.7
[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 _0x113e=['../../config/logger','rpc','jayson/promise','client','http','request','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1d3499,_0x25fd91){var _0x3871f4=function(_0x4528b1){while(--_0x4528b1){_0x1d3499['push'](_0x1d3499['shift']());}};_0x3871f4(++_0x25fd91);}(_0x113e,0x1c4));var _0xe113=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x113e[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xe113('0x0'));var util=require(_0xe113('0x1'));var moment=require(_0xe113('0x2'));var BPromise=require(_0xe113('0x3'));var rs=require(_0xe113('0x4'));var fs=require('fs');var Redis=require(_0xe113('0x5'));var db=require(_0xe113('0x6'))['db'];var utils=require(_0xe113('0x7'));var logger=require(_0xe113('0x8'))(_0xe113('0x9'));var config=require('../../config/environment');var jayson=require(_0xe113('0xa'));var client=jayson[_0xe113('0xb')][_0xe113('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4b2248,_0x590bf3,_0x432a99){return new BPromise(function(_0x480197,_0x595620){return client[_0xe113('0xd')](_0x4b2248,_0x432a99)['then'](function(_0x51d3ac){logger['info'](_0xe113('0xe'),_0x590bf3,_0xe113('0xf'));logger[_0xe113('0x10')](_0xe113('0x11'),_0x590bf3,_0xe113('0xf'),JSON[_0xe113('0x12')](_0x51d3ac));if(_0x51d3ac[_0xe113('0x13')]){if(_0x51d3ac[_0xe113('0x13')]['code']===0x1f4){logger[_0xe113('0x13')](_0xe113('0xe'),_0x590bf3,_0x51d3ac['error']['message']);return _0x595620(_0x51d3ac[_0xe113('0x13')]['message']);}logger[_0xe113('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0x590bf3,_0x51d3ac[_0xe113('0x13')][_0xe113('0x14')]);return _0x480197(_0x51d3ac[_0xe113('0x13')][_0xe113('0x14')]);}else{logger[_0xe113('0x15')]('UserWhatsappQueue,\x20%s,\x20%s',_0x590bf3,_0xe113('0xf'));_0x480197(_0x51d3ac[_0xe113('0x16')]['message']);}})['catch'](function(_0x2c13e5){logger[_0xe113('0x13')](_0xe113('0xe'),_0x590bf3,_0x2c13e5);_0x595620(_0x2c13e5);});});}