Built motion from commit 9d1906d1.|2.5.40
[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 _0xb3d0=['../../config/utils','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','moment','bluebird','ioredis','../../mysqldb'];(function(_0x15440c,_0x2a904f){var _0x370a29=function(_0xe9aa26){while(--_0xe9aa26){_0x15440c['push'](_0x15440c['shift']());}};_0x370a29(++_0x2a904f);}(_0xb3d0,0x1b1));var _0x0b3d=function(_0x125692,_0x54070a){_0x125692=_0x125692-0x0;var _0x3c6420=_0xb3d0[_0x125692];return _0x3c6420;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0b3d('0x0'));var BPromise=require(_0x0b3d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0b3d('0x2'));var db=require(_0x0b3d('0x3'))['db'];var utils=require(_0x0b3d('0x4'));var logger=require('../../config/logger')(_0x0b3d('0x5'));var config=require('../../config/environment');var jayson=require(_0x0b3d('0x6'));var client=jayson[_0x0b3d('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x546019,_0x1cbc47,_0x23849e){return new BPromise(function(_0x3efc14,_0x2d1c71){return client[_0x0b3d('0x8')](_0x546019,_0x23849e)[_0x0b3d('0x9')](function(_0x301200){logger[_0x0b3d('0xa')]('UserSmsQueue,\x20%s,\x20%s',_0x1cbc47,_0x0b3d('0xb'));logger[_0x0b3d('0xc')](_0x0b3d('0xd'),_0x1cbc47,'request\x20sent',JSON[_0x0b3d('0xe')](_0x301200));if(_0x301200[_0x0b3d('0xf')]){if(_0x301200[_0x0b3d('0xf')][_0x0b3d('0x10')]===0x1f4){logger['error'](_0x0b3d('0x11'),_0x1cbc47,_0x301200[_0x0b3d('0xf')][_0x0b3d('0x12')]);return _0x2d1c71(_0x301200[_0x0b3d('0xf')][_0x0b3d('0x12')]);}logger['error'](_0x0b3d('0x11'),_0x1cbc47,_0x301200[_0x0b3d('0xf')]['message']);return _0x3efc14(_0x301200[_0x0b3d('0xf')][_0x0b3d('0x12')]);}else{logger[_0x0b3d('0xa')](_0x0b3d('0x11'),_0x1cbc47,_0x0b3d('0xb'));_0x3efc14(_0x301200['result'][_0x0b3d('0x12')]);}})['catch'](function(_0x219973){logger[_0x0b3d('0xf')](_0x0b3d('0x11'),_0x1cbc47,_0x219973);_0x2d1c71(_0x219973);});});}