Built motion from commit b7e79837.|2.6.29
[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 _0x127b=['UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x42fb9a,_0x906eed){var _0x137a58=function(_0x5a6ab2){while(--_0x5a6ab2){_0x42fb9a['push'](_0x42fb9a['shift']());}};_0x137a58(++_0x906eed);}(_0x127b,0x190));var _0xb127=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x127b[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xb127('0x0'));var util=require(_0xb127('0x1'));var moment=require(_0xb127('0x2'));var BPromise=require('bluebird');var rs=require(_0xb127('0x3'));var fs=require('fs');var Redis=require(_0xb127('0x4'));var db=require(_0xb127('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb127('0x6'))('rpc');var config=require(_0xb127('0x7'));var jayson=require(_0xb127('0x8'));var client=jayson[_0xb127('0x9')][_0xb127('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2fbad0,_0x2f2e70,_0x53a871){return new BPromise(function(_0x137512,_0x4504f5){return client[_0xb127('0xb')](_0x2fbad0,_0x53a871)[_0xb127('0xc')](function(_0xf2a30a){logger[_0xb127('0xd')](_0xb127('0xe'),_0x2f2e70,_0xb127('0xf'));logger['debug'](_0xb127('0x10'),_0x2f2e70,'request\x20sent',JSON[_0xb127('0x11')](_0xf2a30a));if(_0xf2a30a[_0xb127('0x12')]){if(_0xf2a30a['error'][_0xb127('0x13')]===0x1f4){logger[_0xb127('0x12')](_0xb127('0xe'),_0x2f2e70,_0xf2a30a[_0xb127('0x12')][_0xb127('0x14')]);return _0x4504f5(_0xf2a30a[_0xb127('0x12')]['message']);}logger[_0xb127('0x12')](_0xb127('0xe'),_0x2f2e70,_0xf2a30a[_0xb127('0x12')][_0xb127('0x14')]);return _0x137512(_0xf2a30a[_0xb127('0x12')][_0xb127('0x14')]);}else{logger['info'](_0xb127('0xe'),_0x2f2e70,_0xb127('0xf'));_0x137512(_0xf2a30a[_0xb127('0x15')][_0xb127('0x14')]);}})[_0xb127('0x16')](function(_0x291986){logger[_0xb127('0x12')]('UserWhatsappQueue,\x20%s,\x20%s',_0x2f2e70,_0x291986);_0x4504f5(_0x291986);});});}