6b0016c61239ac55434d9d4000f6490d50e4d591
[motion2.git] / server / api / userSmsQueue / userSmsQueue.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 _0xf182=['UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x3cc4c8,_0x114636){var _0xdc0123=function(_0x1c3078){while(--_0x1c3078){_0x3cc4c8['push'](_0x3cc4c8['shift']());}};_0xdc0123(++_0x114636);}(_0xf182,0x11c));var _0x2f18=function(_0x5344b9,_0x55d463){_0x5344b9=_0x5344b9-0x0;var _0x152ae8=_0xf182[_0x5344b9];return _0x152ae8;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x2f18('0x0'));var rs=require(_0x2f18('0x1'));var fs=require('fs');var Redis=require(_0x2f18('0x2'));var db=require(_0x2f18('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2f18('0x4'))('rpc');var config=require(_0x2f18('0x5'));var jayson=require(_0x2f18('0x6'));var client=jayson[_0x2f18('0x7')][_0x2f18('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2a239e,_0x319c85,_0x550f7b){return new BPromise(function(_0x1d87ae,_0x169bec){return client[_0x2f18('0x9')](_0x2a239e,_0x550f7b)['then'](function(_0x318245){logger['info'](_0x2f18('0xa'),_0x319c85,_0x2f18('0xb'));logger[_0x2f18('0xc')](_0x2f18('0xd'),_0x319c85,_0x2f18('0xb'),JSON[_0x2f18('0xe')](_0x318245));if(_0x318245['error']){if(_0x318245[_0x2f18('0xf')][_0x2f18('0x10')]===0x1f4){logger[_0x2f18('0xf')](_0x2f18('0xa'),_0x319c85,_0x318245['error'][_0x2f18('0x11')]);return _0x169bec(_0x318245[_0x2f18('0xf')][_0x2f18('0x11')]);}logger[_0x2f18('0xf')](_0x2f18('0xa'),_0x319c85,_0x318245[_0x2f18('0xf')][_0x2f18('0x11')]);return _0x1d87ae(_0x318245[_0x2f18('0xf')][_0x2f18('0x11')]);}else{logger[_0x2f18('0x12')](_0x2f18('0xa'),_0x319c85,_0x2f18('0xb'));_0x1d87ae(_0x318245[_0x2f18('0x13')]['message']);}})[_0x2f18('0x14')](function(_0x7f6c87){logger['error'](_0x2f18('0xa'),_0x319c85,_0x7f6c87);_0x169bec(_0x7f6c87);});});}