Built motion from commit 1fa89557.|2.6.10
[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 _0xf3c1=['UserSmsQueue,\x20%s,\x20%s,\x20%s','error','message','lodash','util','randomstring','../../config/utils','../../config/logger','client','http','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2381ce,_0x6df0f1){var _0x7f0dac=function(_0x2f5133){while(--_0x2f5133){_0x2381ce['push'](_0x2381ce['shift']());}};_0x7f0dac(++_0x6df0f1);}(_0xf3c1,0x12f));var _0x1f3c=function(_0x4276fb,_0x51bab2){_0x4276fb=_0x4276fb-0x0;var _0x6469dc=_0xf3c1[_0x4276fb];return _0x6469dc;};'use strict';var _=require(_0x1f3c('0x0'));var util=require(_0x1f3c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1f3c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1f3c('0x3'));var logger=require(_0x1f3c('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1f3c('0x5')][_0x1f3c('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x57538c,_0x754e0f,_0x9668f9){return new BPromise(function(_0x5795db,_0x20285a){return client['request'](_0x57538c,_0x9668f9)[_0x1f3c('0x7')](function(_0x1b2804){logger[_0x1f3c('0x8')](_0x1f3c('0x9'),_0x754e0f,_0x1f3c('0xa'));logger[_0x1f3c('0xb')](_0x1f3c('0xc'),_0x754e0f,_0x1f3c('0xa'),JSON['stringify'](_0x1b2804));if(_0x1b2804[_0x1f3c('0xd')]){if(_0x1b2804[_0x1f3c('0xd')]['code']===0x1f4){logger[_0x1f3c('0xd')](_0x1f3c('0x9'),_0x754e0f,_0x1b2804[_0x1f3c('0xd')][_0x1f3c('0xe')]);return _0x20285a(_0x1b2804['error'][_0x1f3c('0xe')]);}logger[_0x1f3c('0xd')](_0x1f3c('0x9'),_0x754e0f,_0x1b2804[_0x1f3c('0xd')][_0x1f3c('0xe')]);return _0x5795db(_0x1b2804[_0x1f3c('0xd')][_0x1f3c('0xe')]);}else{logger['info'](_0x1f3c('0x9'),_0x754e0f,_0x1f3c('0xa'));_0x5795db(_0x1b2804['result'][_0x1f3c('0xe')]);}})['catch'](function(_0x7b7972){logger[_0x1f3c('0xd')](_0x1f3c('0x9'),_0x754e0f,_0x7b7972);_0x20285a(_0x7b7972);});});}