21b9beeeafb1295b3dbbf49b0e396b99c5441458
[motion2.git] / server / api / smsApplication / smsApplication.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 _0x98a7=['http','request','info','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client'];(function(_0x2906e6,_0x5ccd59){var _0x12517a=function(_0x36d576){while(--_0x36d576){_0x2906e6['push'](_0x2906e6['shift']());}};_0x12517a(++_0x5ccd59);}(_0x98a7,0x9e));var _0x798a=function(_0xce587,_0x4d0609){_0xce587=_0xce587-0x0;var _0x5baf43=_0x98a7[_0xce587];return _0x5baf43;};'use strict';var _=require(_0x798a('0x0'));var util=require(_0x798a('0x1'));var moment=require(_0x798a('0x2'));var BPromise=require(_0x798a('0x3'));var rs=require(_0x798a('0x4'));var fs=require('fs');var Redis=require(_0x798a('0x5'));var db=require(_0x798a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x798a('0x7'))(_0x798a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x798a('0x9')][_0x798a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9645e3,_0x3f17e2,_0x2a5393){return new BPromise(function(_0x8e1e29,_0x3be3d4){return client[_0x798a('0xb')](_0x9645e3,_0x2a5393)['then'](function(_0x1d2225){logger[_0x798a('0xc')](_0x798a('0xd'),_0x3f17e2,_0x798a('0xe'));logger['debug'](_0x798a('0xf'),_0x3f17e2,_0x798a('0xe'),JSON[_0x798a('0x10')](_0x1d2225));if(_0x1d2225[_0x798a('0x11')]){if(_0x1d2225[_0x798a('0x11')][_0x798a('0x12')]===0x1f4){logger['error'](_0x798a('0xd'),_0x3f17e2,_0x1d2225[_0x798a('0x11')][_0x798a('0x13')]);return _0x3be3d4(_0x1d2225[_0x798a('0x11')]['message']);}logger[_0x798a('0x11')](_0x798a('0xd'),_0x3f17e2,_0x1d2225['error'][_0x798a('0x13')]);return _0x8e1e29(_0x1d2225['error'][_0x798a('0x13')]);}else{logger[_0x798a('0xc')](_0x798a('0xd'),_0x3f17e2,_0x798a('0xe'));_0x8e1e29(_0x1d2225['result'][_0x798a('0x13')]);}})[_0x798a('0x14')](function(_0x536617){logger[_0x798a('0x11')](_0x798a('0xd'),_0x3f17e2,_0x536617);_0x3be3d4(_0x536617);});});}