5cf9db94f5bd565ecd5a2a180704aafe15ca5745
[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 _0x15f0=['code','message','UserSmsQueue,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x268887,_0x572fcd){var _0x5be468=function(_0x40e289){while(--_0x40e289){_0x268887['push'](_0x268887['shift']());}};_0x5be468(++_0x572fcd);}(_0x15f0,0x1a3));var _0x015f=function(_0x5a7512,_0x6097b3){_0x5a7512=_0x5a7512-0x0;var _0x54261c=_0x15f0[_0x5a7512];return _0x54261c;};'use strict';var _=require('lodash');var util=require(_0x015f('0x0'));var moment=require(_0x015f('0x1'));var BPromise=require(_0x015f('0x2'));var rs=require(_0x015f('0x3'));var fs=require('fs');var Redis=require(_0x015f('0x4'));var db=require(_0x015f('0x5'))['db'];var utils=require(_0x015f('0x6'));var logger=require(_0x015f('0x7'))(_0x015f('0x8'));var config=require(_0x015f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x015f('0xa')][_0x015f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c9d07,_0x4a1866,_0x20723f){return new BPromise(function(_0x448ca9,_0x386b08){return client['request'](_0x3c9d07,_0x20723f)[_0x015f('0xc')](function(_0x472792){logger[_0x015f('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x4a1866,'request\x20sent');logger[_0x015f('0xe')](_0x015f('0xf'),_0x4a1866,_0x015f('0x10'),JSON['stringify'](_0x472792));if(_0x472792['error']){if(_0x472792[_0x015f('0x11')][_0x015f('0x12')]===0x1f4){logger[_0x015f('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x4a1866,_0x472792[_0x015f('0x11')][_0x015f('0x13')]);return _0x386b08(_0x472792[_0x015f('0x11')][_0x015f('0x13')]);}logger[_0x015f('0x11')](_0x015f('0x14'),_0x4a1866,_0x472792[_0x015f('0x11')][_0x015f('0x13')]);return _0x448ca9(_0x472792[_0x015f('0x11')][_0x015f('0x13')]);}else{logger[_0x015f('0xd')](_0x015f('0x14'),_0x4a1866,_0x015f('0x10'));_0x448ca9(_0x472792[_0x015f('0x15')][_0x015f('0x13')]);}})[_0x015f('0x16')](function(_0x5f5bed){logger[_0x015f('0x11')](_0x015f('0x14'),_0x4a1866,_0x5f5bed);_0x386b08(_0x5f5bed);});});}