e38fb39a493c131549725c63b867ecac7a98c1f1
[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 _0x7a75=['code','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','UserSmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4a30b7,_0x3dabc8){var _0xe48f3c=function(_0x391568){while(--_0x391568){_0x4a30b7['push'](_0x4a30b7['shift']());}};_0xe48f3c(++_0x3dabc8);}(_0x7a75,0x148));var _0x57a7=function(_0x2fe5d7,_0x152ed7){_0x2fe5d7=_0x2fe5d7-0x0;var _0x30e502=_0x7a75[_0x2fe5d7];return _0x30e502;};'use strict';var _=require(_0x57a7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x57a7('0x1'));var rs=require(_0x57a7('0x2'));var fs=require('fs');var Redis=require(_0x57a7('0x3'));var db=require(_0x57a7('0x4'))['db'];var utils=require(_0x57a7('0x5'));var logger=require(_0x57a7('0x6'))(_0x57a7('0x7'));var config=require('../../config/environment');var jayson=require(_0x57a7('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x185b0d,_0x157adc,_0x113dd7){return new BPromise(function(_0x20ea03,_0x46a381){return client[_0x57a7('0x9')](_0x185b0d,_0x113dd7)['then'](function(_0xb03201){logger['info'](_0x57a7('0xa'),_0x157adc,_0x57a7('0xb'));logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x157adc,'request\x20sent',JSON[_0x57a7('0xc')](_0xb03201));if(_0xb03201['error']){if(_0xb03201[_0x57a7('0xd')][_0x57a7('0xe')]===0x1f4){logger[_0x57a7('0xd')](_0x57a7('0xa'),_0x157adc,_0xb03201[_0x57a7('0xd')][_0x57a7('0xf')]);return _0x46a381(_0xb03201[_0x57a7('0xd')][_0x57a7('0xf')]);}logger['error'](_0x57a7('0xa'),_0x157adc,_0xb03201[_0x57a7('0xd')]['message']);return _0x20ea03(_0xb03201[_0x57a7('0xd')]['message']);}else{logger[_0x57a7('0x10')](_0x57a7('0xa'),_0x157adc,_0x57a7('0xb'));_0x20ea03(_0xb03201[_0x57a7('0x11')][_0x57a7('0xf')]);}})[_0x57a7('0x12')](function(_0x26660a){logger[_0x57a7('0xd')](_0x57a7('0xa'),_0x157adc,_0x26660a);_0x46a381(_0x26660a);});});}