Built motion from commit da617fac.|2.6.6
[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 _0xdc21=['moment','bluebird','../../mysqldb','../../config/logger','jayson/promise','http','request','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util'];(function(_0x39285d,_0x4e7c32){var _0x5b809b=function(_0x1c0b21){while(--_0x1c0b21){_0x39285d['push'](_0x39285d['shift']());}};_0x5b809b(++_0x4e7c32);}(_0xdc21,0xd7));var _0x1dc2=function(_0x171a17,_0x3b079d){_0x171a17=_0x171a17-0x0;var _0x1d4d5e=_0xdc21[_0x171a17];return _0x1d4d5e;};'use strict';var _=require('lodash');var util=require(_0x1dc2('0x0'));var moment=require(_0x1dc2('0x1'));var BPromise=require(_0x1dc2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1dc2('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1dc2('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1dc2('0x5'));var client=jayson['client'][_0x1dc2('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x10b8ef,_0x4afbb4,_0x24d2eb){return new BPromise(function(_0x51f59e,_0x573b12){return client[_0x1dc2('0x7')](_0x10b8ef,_0x24d2eb)['then'](function(_0xe37163){logger[_0x1dc2('0x8')](_0x1dc2('0x9'),_0x4afbb4,_0x1dc2('0xa'));logger[_0x1dc2('0xb')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x4afbb4,_0x1dc2('0xa'),JSON[_0x1dc2('0xc')](_0xe37163));if(_0xe37163[_0x1dc2('0xd')]){if(_0xe37163[_0x1dc2('0xd')][_0x1dc2('0xe')]===0x1f4){logger['error'](_0x1dc2('0x9'),_0x4afbb4,_0xe37163[_0x1dc2('0xd')]['message']);return _0x573b12(_0xe37163['error']['message']);}logger[_0x1dc2('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x4afbb4,_0xe37163[_0x1dc2('0xd')][_0x1dc2('0xf')]);return _0x51f59e(_0xe37163[_0x1dc2('0xd')][_0x1dc2('0xf')]);}else{logger[_0x1dc2('0x8')](_0x1dc2('0x9'),_0x4afbb4,'request\x20sent');_0x51f59e(_0xe37163[_0x1dc2('0x10')][_0x1dc2('0xf')]);}})[_0x1dc2('0x11')](function(_0x1979b8){logger[_0x1dc2('0xd')](_0x1dc2('0x9'),_0x4afbb4,_0x1979b8);_0x573b12(_0x1979b8);});});}