Built motion from commit 25580385.|2.6.2
[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 _0xcf4f=['then','info','UserSmsQueue,\x20%s,\x20%s','debug','stringify','error','code','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','request'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xcf4f,0x87));var _0xfcf4=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0xcf4f[_0x68ee8b];return _0x5148f7;};'use strict';var _=require(_0xfcf4('0x0'));var util=require(_0xfcf4('0x1'));var moment=require('moment');var BPromise=require(_0xfcf4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfcf4('0x3'));var db=require(_0xfcf4('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xfcf4('0x5'));var jayson=require(_0xfcf4('0x6'));var client=jayson['client'][_0xfcf4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xb2e045,_0x536e53,_0x1ec7f3){return new BPromise(function(_0x1707cb,_0xbc3992){return client[_0xfcf4('0x8')](_0xb2e045,_0x1ec7f3)[_0xfcf4('0x9')](function(_0x1fa6c0){logger[_0xfcf4('0xa')](_0xfcf4('0xb'),_0x536e53,'request\x20sent');logger[_0xfcf4('0xc')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x536e53,'request\x20sent',JSON[_0xfcf4('0xd')](_0x1fa6c0));if(_0x1fa6c0['error']){if(_0x1fa6c0[_0xfcf4('0xe')][_0xfcf4('0xf')]===0x1f4){logger[_0xfcf4('0xe')](_0xfcf4('0xb'),_0x536e53,_0x1fa6c0[_0xfcf4('0xe')][_0xfcf4('0x10')]);return _0xbc3992(_0x1fa6c0[_0xfcf4('0xe')][_0xfcf4('0x10')]);}logger[_0xfcf4('0xe')](_0xfcf4('0xb'),_0x536e53,_0x1fa6c0[_0xfcf4('0xe')][_0xfcf4('0x10')]);return _0x1707cb(_0x1fa6c0[_0xfcf4('0xe')][_0xfcf4('0x10')]);}else{logger[_0xfcf4('0xa')](_0xfcf4('0xb'),_0x536e53,'request\x20sent');_0x1707cb(_0x1fa6c0[_0xfcf4('0x11')][_0xfcf4('0x10')]);}})['catch'](function(_0xfbe675){logger[_0xfcf4('0xe')](_0xfcf4('0xb'),_0x536e53,_0xfbe675);_0xbc3992(_0xfbe675);});});}