Built motion from commit 3e059bc2.|2.5.32
[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 _0x22f7=['http','request','then','info','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/environment','jayson/promise'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x22f7,0x175));var _0x722f=function(_0x224003,_0x401970){_0x224003=_0x224003-0x0;var _0x134a3c=_0x22f7[_0x224003];return _0x134a3c;};'use strict';var _=require(_0x722f('0x0'));var util=require(_0x722f('0x1'));var moment=require('moment');var BPromise=require(_0x722f('0x2'));var rs=require(_0x722f('0x3'));var fs=require('fs');var Redis=require(_0x722f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x722f('0x5'));var jayson=require(_0x722f('0x6'));var client=jayson['client'][_0x722f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x63a7a9,_0x4f9641,_0x3b618f){return new BPromise(function(_0x1a308f,_0x57adc1){return client[_0x722f('0x8')](_0x63a7a9,_0x3b618f)[_0x722f('0x9')](function(_0x5a1741){logger[_0x722f('0xa')](_0x722f('0xb'),_0x4f9641,'request\x20sent');logger[_0x722f('0xc')](_0x722f('0xd'),_0x4f9641,_0x722f('0xe'),JSON['stringify'](_0x5a1741));if(_0x5a1741[_0x722f('0xf')]){if(_0x5a1741[_0x722f('0xf')][_0x722f('0x10')]===0x1f4){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x4f9641,_0x5a1741['error'][_0x722f('0x11')]);return _0x57adc1(_0x5a1741['error']['message']);}logger[_0x722f('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x4f9641,_0x5a1741[_0x722f('0xf')]['message']);return _0x1a308f(_0x5a1741['error'][_0x722f('0x11')]);}else{logger[_0x722f('0xa')](_0x722f('0xb'),_0x4f9641,_0x722f('0xe'));_0x1a308f(_0x5a1741[_0x722f('0x12')][_0x722f('0x11')]);}})['catch'](function(_0x527e16){logger[_0x722f('0xf')](_0x722f('0xb'),_0x4f9641,_0x527e16);_0x57adc1(_0x527e16);});});}