141e5ed6edcd5030e02884e3d54abac1a4eb5ac3
[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 _0x337f=['moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x49987f,_0x532062){var _0x3e1766=function(_0x11e938){while(--_0x11e938){_0x49987f['push'](_0x49987f['shift']());}};_0x3e1766(++_0x532062);}(_0x337f,0x11c));var _0xf337=function(_0x14e22f,_0x2b05d6){_0x14e22f=_0x14e22f-0x0;var _0x2b6e0b=_0x337f[_0x14e22f];return _0x2b6e0b;};'use strict';var _=require(_0xf337('0x0'));var util=require(_0xf337('0x1'));var moment=require(_0xf337('0x2'));var BPromise=require('bluebird');var rs=require(_0xf337('0x3'));var fs=require('fs');var Redis=require(_0xf337('0x4'));var db=require(_0xf337('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf337('0x6'))(_0xf337('0x7'));var config=require('../../config/environment');var jayson=require(_0xf337('0x8'));var client=jayson['client'][_0xf337('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ae4d6,_0x2be604,_0x56bd39){return new BPromise(function(_0x4b80a2,_0x1f0a95){return client[_0xf337('0xa')](_0x5ae4d6,_0x56bd39)[_0xf337('0xb')](function(_0x2a4619){logger[_0xf337('0xc')](_0xf337('0xd'),_0x2be604,_0xf337('0xe'));logger[_0xf337('0xf')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x2be604,_0xf337('0xe'),JSON[_0xf337('0x10')](_0x2a4619));if(_0x2a4619[_0xf337('0x11')]){if(_0x2a4619[_0xf337('0x11')][_0xf337('0x12')]===0x1f4){logger[_0xf337('0x11')](_0xf337('0xd'),_0x2be604,_0x2a4619[_0xf337('0x11')][_0xf337('0x13')]);return _0x1f0a95(_0x2a4619[_0xf337('0x11')][_0xf337('0x13')]);}logger[_0xf337('0x11')]('SmsApplication,\x20%s,\x20%s',_0x2be604,_0x2a4619[_0xf337('0x11')][_0xf337('0x13')]);return _0x4b80a2(_0x2a4619[_0xf337('0x11')]['message']);}else{logger[_0xf337('0xc')](_0xf337('0xd'),_0x2be604,'request\x20sent');_0x4b80a2(_0x2a4619[_0xf337('0x14')][_0xf337('0x13')]);}})[_0xf337('0x15')](function(_0x4a7e4c){logger[_0xf337('0x11')]('SmsApplication,\x20%s,\x20%s',_0x2be604,_0x4a7e4c);_0x1f0a95(_0x4a7e4c);});});}