7f83d2d589ffb7ef6b9e1b1d0797a5ae9fb9dab8
[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 _0x6017=['rpc','client','http','request','then','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','lodash','util','moment','randomstring','ioredis','../../config/utils'];(function(_0x21a668,_0x5ac227){var _0x4744ec=function(_0x4b523b){while(--_0x4b523b){_0x21a668['push'](_0x21a668['shift']());}};_0x4744ec(++_0x5ac227);}(_0x6017,0xae));var _0x7601=function(_0x445145,_0x8dc635){_0x445145=_0x445145-0x0;var _0x1e0ec6=_0x6017[_0x445145];return _0x1e0ec6;};'use strict';var _=require(_0x7601('0x0'));var util=require(_0x7601('0x1'));var moment=require(_0x7601('0x2'));var BPromise=require('bluebird');var rs=require(_0x7601('0x3'));var fs=require('fs');var Redis=require(_0x7601('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7601('0x5'));var logger=require('../../config/logger')(_0x7601('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7601('0x7')][_0x7601('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xcb5ed9,_0x34a36d,_0x2bc643){return new BPromise(function(_0xe6e524,_0x4ff3e4){return client[_0x7601('0x9')](_0xcb5ed9,_0x2bc643)[_0x7601('0xa')](function(_0xd3a338){logger['info'](_0x7601('0xb'),_0x34a36d,_0x7601('0xc'));logger[_0x7601('0xd')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x34a36d,_0x7601('0xc'),JSON[_0x7601('0xe')](_0xd3a338));if(_0xd3a338[_0x7601('0xf')]){if(_0xd3a338[_0x7601('0xf')][_0x7601('0x10')]===0x1f4){logger[_0x7601('0xf')](_0x7601('0xb'),_0x34a36d,_0xd3a338[_0x7601('0xf')][_0x7601('0x11')]);return _0x4ff3e4(_0xd3a338[_0x7601('0xf')]['message']);}logger[_0x7601('0xf')]('SmsApplication,\x20%s,\x20%s',_0x34a36d,_0xd3a338[_0x7601('0xf')][_0x7601('0x11')]);return _0xe6e524(_0xd3a338[_0x7601('0xf')][_0x7601('0x11')]);}else{logger[_0x7601('0x12')](_0x7601('0xb'),_0x34a36d,_0x7601('0xc'));_0xe6e524(_0xd3a338[_0x7601('0x13')][_0x7601('0x11')]);}})['catch'](function(_0xa0e556){logger[_0x7601('0xf')]('SmsApplication,\x20%s,\x20%s',_0x34a36d,_0xa0e556);_0x4ff3e4(_0xa0e556);});});}