286d5bc8642fd56def7fc6c70421dbbe42ae4d45
[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 _0x9658=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis'];(function(_0x6d1330,_0xd87fc9){var _0x20776e=function(_0x2593b6){while(--_0x2593b6){_0x6d1330['push'](_0x6d1330['shift']());}};_0x20776e(++_0xd87fc9);}(_0x9658,0x6f));var _0x8965=function(_0x46cf00,_0x457a43){_0x46cf00=_0x46cf00-0x0;var _0x3974dc=_0x9658[_0x46cf00];return _0x3974dc;};'use strict';var _=require(_0x8965('0x0'));var util=require('util');var moment=require(_0x8965('0x1'));var BPromise=require(_0x8965('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8965('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8965('0x4'));var logger=require(_0x8965('0x5'))(_0x8965('0x6'));var config=require('../../config/environment');var jayson=require(_0x8965('0x7'));var client=jayson[_0x8965('0x8')][_0x8965('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x290f30,_0x271060,_0x27b334){return new BPromise(function(_0x1e7d61,_0xe14503){return client[_0x8965('0xa')](_0x290f30,_0x27b334)[_0x8965('0xb')](function(_0x214249){logger[_0x8965('0xc')](_0x8965('0xd'),_0x271060,_0x8965('0xe'));logger[_0x8965('0xf')](_0x8965('0x10'),_0x271060,_0x8965('0xe'),JSON[_0x8965('0x11')](_0x214249));if(_0x214249[_0x8965('0x12')]){if(_0x214249['error'][_0x8965('0x13')]===0x1f4){logger[_0x8965('0x12')](_0x8965('0xd'),_0x271060,_0x214249[_0x8965('0x12')][_0x8965('0x14')]);return _0xe14503(_0x214249[_0x8965('0x12')][_0x8965('0x14')]);}logger[_0x8965('0x12')]('SmsApplication,\x20%s,\x20%s',_0x271060,_0x214249[_0x8965('0x12')][_0x8965('0x14')]);return _0x1e7d61(_0x214249[_0x8965('0x12')][_0x8965('0x14')]);}else{logger[_0x8965('0xc')]('SmsApplication,\x20%s,\x20%s',_0x271060,_0x8965('0xe'));_0x1e7d61(_0x214249[_0x8965('0x15')][_0x8965('0x14')]);}})[_0x8965('0x16')](function(_0x5c7d55){logger[_0x8965('0x12')](_0x8965('0xd'),_0x271060,_0x5c7d55);_0xe14503(_0x5c7d55);});});}