1ae3cc4b3ccfe810b4c2fb02ff024e6ff829a523
[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 _0xf6b7=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x162780,_0x47f2e2){var _0x1ea2dc=function(_0x123898){while(--_0x123898){_0x162780['push'](_0x162780['shift']());}};_0x1ea2dc(++_0x47f2e2);}(_0xf6b7,0x1f4));var _0x7f6b=function(_0x2bd1ec,_0x3fe65f){_0x2bd1ec=_0x2bd1ec-0x0;var _0x2f7577=_0xf6b7[_0x2bd1ec];return _0x2f7577;};'use strict';var _=require(_0x7f6b('0x0'));var util=require(_0x7f6b('0x1'));var moment=require(_0x7f6b('0x2'));var BPromise=require(_0x7f6b('0x3'));var rs=require(_0x7f6b('0x4'));var fs=require('fs');var Redis=require(_0x7f6b('0x5'));var db=require(_0x7f6b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7f6b('0x7'))('rpc');var config=require(_0x7f6b('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x23ce3,_0x2506e9,_0x2cf46f){return new BPromise(function(_0x4e6215,_0xd862c){return client[_0x7f6b('0x9')](_0x23ce3,_0x2cf46f)[_0x7f6b('0xa')](function(_0x3a8804){logger[_0x7f6b('0xb')](_0x7f6b('0xc'),_0x2506e9,_0x7f6b('0xd'));logger['debug'](_0x7f6b('0xe'),_0x2506e9,_0x7f6b('0xd'),JSON['stringify'](_0x3a8804));if(_0x3a8804[_0x7f6b('0xf')]){if(_0x3a8804[_0x7f6b('0xf')][_0x7f6b('0x10')]===0x1f4){logger[_0x7f6b('0xf')](_0x7f6b('0xc'),_0x2506e9,_0x3a8804[_0x7f6b('0xf')][_0x7f6b('0x11')]);return _0xd862c(_0x3a8804['error'][_0x7f6b('0x11')]);}logger[_0x7f6b('0xf')](_0x7f6b('0xc'),_0x2506e9,_0x3a8804['error']['message']);return _0x4e6215(_0x3a8804[_0x7f6b('0xf')][_0x7f6b('0x11')]);}else{logger[_0x7f6b('0xb')](_0x7f6b('0xc'),_0x2506e9,_0x7f6b('0xd'));_0x4e6215(_0x3a8804[_0x7f6b('0x12')]['message']);}})[_0x7f6b('0x13')](function(_0x241119){logger[_0x7f6b('0xf')](_0x7f6b('0xc'),_0x2506e9,_0x241119);_0xd862c(_0x241119);});});}