Built motion from commit eddce310.|2.6.12
[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 _0x4120=['message','catch','util','moment','randomstring','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x23866e,_0x594bc7){var _0x2ce57f=function(_0x112c79){while(--_0x112c79){_0x23866e['push'](_0x23866e['shift']());}};_0x2ce57f(++_0x594bc7);}(_0x4120,0xad));var _0x0412=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x4120[_0x550d12];return _0x12103d;};'use strict';var _=require('lodash');var util=require(_0x0412('0x0'));var moment=require(_0x0412('0x1'));var BPromise=require('bluebird');var rs=require(_0x0412('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0412('0x3'))(_0x0412('0x4'));var config=require('../../config/environment');var jayson=require(_0x0412('0x5'));var client=jayson[_0x0412('0x6')][_0x0412('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4872a4,_0x81ad6d,_0x1cbf5d){return new BPromise(function(_0xc0721d,_0xe1ac12){return client[_0x0412('0x8')](_0x4872a4,_0x1cbf5d)[_0x0412('0x9')](function(_0x360500){logger[_0x0412('0xa')](_0x0412('0xb'),_0x81ad6d,'request\x20sent');logger['debug'](_0x0412('0xc'),_0x81ad6d,_0x0412('0xd'),JSON[_0x0412('0xe')](_0x360500));if(_0x360500[_0x0412('0xf')]){if(_0x360500[_0x0412('0xf')][_0x0412('0x10')]===0x1f4){logger['error'](_0x0412('0xb'),_0x81ad6d,_0x360500['error'][_0x0412('0x11')]);return _0xe1ac12(_0x360500[_0x0412('0xf')][_0x0412('0x11')]);}logger[_0x0412('0xf')]('UserWhatsappQueue,\x20%s,\x20%s',_0x81ad6d,_0x360500[_0x0412('0xf')][_0x0412('0x11')]);return _0xc0721d(_0x360500[_0x0412('0xf')]['message']);}else{logger[_0x0412('0xa')](_0x0412('0xb'),_0x81ad6d,_0x0412('0xd'));_0xc0721d(_0x360500['result'][_0x0412('0x11')]);}})[_0x0412('0x12')](function(_0x3172e2){logger[_0x0412('0xf')](_0x0412('0xb'),_0x81ad6d,_0x3172e2);_0xe1ac12(_0x3172e2);});});}