Built motion from commit bab6f49e.|2.6.17
[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 _0x950a=['UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info'];(function(_0xb9d7b7,_0x2e7714){var _0x23a450=function(_0x37adf8){while(--_0x37adf8){_0xb9d7b7['push'](_0xb9d7b7['shift']());}};_0x23a450(++_0x2e7714);}(_0x950a,0x1d6));var _0xa950=function(_0x5f2d34,_0x2b2253){_0x5f2d34=_0x5f2d34-0x0;var _0x1fad54=_0x950a[_0x5f2d34];return _0x1fad54;};'use strict';var _=require(_0xa950('0x0'));var util=require(_0xa950('0x1'));var moment=require(_0xa950('0x2'));var BPromise=require('bluebird');var rs=require(_0xa950('0x3'));var fs=require('fs');var Redis=require(_0xa950('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa950('0x5'));var logger=require(_0xa950('0x6'))(_0xa950('0x7'));var config=require('../../config/environment');var jayson=require(_0xa950('0x8'));var client=jayson[_0xa950('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe32420,_0x5b73c3,_0x4e8780){return new BPromise(function(_0x384fea,_0x3eaf3e){return client[_0xa950('0xa')](_0xe32420,_0x4e8780)[_0xa950('0xb')](function(_0x2e92ef){logger[_0xa950('0xc')](_0xa950('0xd'),_0x5b73c3,_0xa950('0xe'));logger['debug'](_0xa950('0xf'),_0x5b73c3,_0xa950('0xe'),JSON[_0xa950('0x10')](_0x2e92ef));if(_0x2e92ef[_0xa950('0x11')]){if(_0x2e92ef[_0xa950('0x11')]['code']===0x1f4){logger[_0xa950('0x11')](_0xa950('0xd'),_0x5b73c3,_0x2e92ef[_0xa950('0x11')][_0xa950('0x12')]);return _0x3eaf3e(_0x2e92ef[_0xa950('0x11')][_0xa950('0x12')]);}logger[_0xa950('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x5b73c3,_0x2e92ef[_0xa950('0x11')][_0xa950('0x12')]);return _0x384fea(_0x2e92ef['error'][_0xa950('0x12')]);}else{logger[_0xa950('0xc')](_0xa950('0xd'),_0x5b73c3,_0xa950('0xe'));_0x384fea(_0x2e92ef[_0xa950('0x13')][_0xa950('0x12')]);}})[_0xa950('0x14')](function(_0x6fd0cd){logger[_0xa950('0x11')](_0xa950('0xd'),_0x5b73c3,_0x6fd0cd);_0x3eaf3e(_0x6fd0cd);});});}