Built motion from commit 10af8726.|2.6.34
[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 _0x46d1=['../../mysqldb','rpc','../../config/environment','jayson/promise','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','ioredis'];(function(_0x567c12,_0x45a25f){var _0x5629e9=function(_0x539e0a){while(--_0x539e0a){_0x567c12['push'](_0x567c12['shift']());}};_0x5629e9(++_0x45a25f);}(_0x46d1,0x9c));var _0x146d=function(_0x4f9b38,_0x10c873){_0x4f9b38=_0x4f9b38-0x0;var _0x372cad=_0x46d1[_0x4f9b38];return _0x372cad;};'use strict';var _=require('lodash');var util=require(_0x146d('0x0'));var moment=require(_0x146d('0x1'));var BPromise=require(_0x146d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x146d('0x3'));var db=require(_0x146d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x146d('0x5'));var config=require(_0x146d('0x6'));var jayson=require(_0x146d('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2cace8,_0x3de16e,_0x45219f){return new BPromise(function(_0x1c9844,_0x2abeae){return client[_0x146d('0x8')](_0x2cace8,_0x45219f)[_0x146d('0x9')](function(_0xd1afe5){logger[_0x146d('0xa')](_0x146d('0xb'),_0x3de16e,_0x146d('0xc'));logger[_0x146d('0xd')](_0x146d('0xe'),_0x3de16e,'request\x20sent',JSON['stringify'](_0xd1afe5));if(_0xd1afe5[_0x146d('0xf')]){if(_0xd1afe5['error'][_0x146d('0x10')]===0x1f4){logger[_0x146d('0xf')](_0x146d('0xb'),_0x3de16e,_0xd1afe5['error'][_0x146d('0x11')]);return _0x2abeae(_0xd1afe5[_0x146d('0xf')][_0x146d('0x11')]);}logger['error'](_0x146d('0xb'),_0x3de16e,_0xd1afe5['error'][_0x146d('0x11')]);return _0x1c9844(_0xd1afe5[_0x146d('0xf')][_0x146d('0x11')]);}else{logger[_0x146d('0xa')](_0x146d('0xb'),_0x3de16e,_0x146d('0xc'));_0x1c9844(_0xd1afe5[_0x146d('0x12')][_0x146d('0x11')]);}})[_0x146d('0x13')](function(_0x190ec0){logger[_0x146d('0xf')](_0x146d('0xb'),_0x3de16e,_0x190ec0);_0x2abeae(_0x190ec0);});});}