164966effef8a137ca5975511c0fa0a129e28ac1
[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 _0xf06b=['catch','util','bluebird','../../config/logger','../../config/environment','jayson/promise','http','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3219cf,_0x140739){var _0x10f4a6=function(_0x4efe99){while(--_0x4efe99){_0x3219cf['push'](_0x3219cf['shift']());}};_0x10f4a6(++_0x140739);}(_0xf06b,0xab));var _0xbf06=function(_0x5960ac,_0x481c64){_0x5960ac=_0x5960ac-0x0;var _0x456f4b=_0xf06b[_0x5960ac];return _0x456f4b;};'use strict';var _=require('lodash');var util=require(_0xbf06('0x0'));var moment=require('moment');var BPromise=require(_0xbf06('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf06('0x2'))('rpc');var config=require(_0xbf06('0x3'));var jayson=require(_0xbf06('0x4'));var client=jayson['client'][_0xbf06('0x5')]({'port':0x232a});function respondWithRpcPromise(_0xb09880,_0x153478,_0x3829f2){return new BPromise(function(_0x195291,_0x4cbde6){return client['request'](_0xb09880,_0x3829f2)['then'](function(_0x48d7af){logger[_0xbf06('0x6')](_0xbf06('0x7'),_0x153478,_0xbf06('0x8'));logger[_0xbf06('0x9')](_0xbf06('0xa'),_0x153478,'request\x20sent',JSON[_0xbf06('0xb')](_0x48d7af));if(_0x48d7af[_0xbf06('0xc')]){if(_0x48d7af[_0xbf06('0xc')][_0xbf06('0xd')]===0x1f4){logger[_0xbf06('0xc')](_0xbf06('0x7'),_0x153478,_0x48d7af['error'][_0xbf06('0xe')]);return _0x4cbde6(_0x48d7af['error'][_0xbf06('0xe')]);}logger['error'](_0xbf06('0x7'),_0x153478,_0x48d7af['error']['message']);return _0x195291(_0x48d7af[_0xbf06('0xc')][_0xbf06('0xe')]);}else{logger[_0xbf06('0x6')](_0xbf06('0x7'),_0x153478,_0xbf06('0x8'));_0x195291(_0x48d7af[_0xbf06('0xf')][_0xbf06('0xe')]);}})[_0xbf06('0x10')](function(_0x41e847){logger['error'](_0xbf06('0x7'),_0x153478,_0x41e847);_0x4cbde6(_0x41e847);});});}