Built motion from commit 97153652.|2.6.26
[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 _0x3e94=['rpc','jayson/promise','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x517e42,_0x53cf21){var _0x429dbd=function(_0x1e9be2){while(--_0x1e9be2){_0x517e42['push'](_0x517e42['shift']());}};_0x429dbd(++_0x53cf21);}(_0x3e94,0x67));var _0x43e9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3e94[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x43e9('0x0'));var util=require(_0x43e9('0x1'));var moment=require('moment');var BPromise=require(_0x43e9('0x2'));var rs=require(_0x43e9('0x3'));var fs=require('fs');var Redis=require(_0x43e9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x43e9('0x5'));var logger=require(_0x43e9('0x6'))(_0x43e9('0x7'));var config=require('../../config/environment');var jayson=require(_0x43e9('0x8'));var client=jayson['client'][_0x43e9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b35f1,_0x1183a0,_0x2989fe){return new BPromise(function(_0x287aaf,_0x510ee7){return client[_0x43e9('0xa')](_0x4b35f1,_0x2989fe)[_0x43e9('0xb')](function(_0x43d6e8){logger[_0x43e9('0xc')](_0x43e9('0xd'),_0x1183a0,_0x43e9('0xe'));logger[_0x43e9('0xf')](_0x43e9('0x10'),_0x1183a0,_0x43e9('0xe'),JSON['stringify'](_0x43d6e8));if(_0x43d6e8[_0x43e9('0x11')]){if(_0x43d6e8[_0x43e9('0x11')][_0x43e9('0x12')]===0x1f4){logger['error'](_0x43e9('0xd'),_0x1183a0,_0x43d6e8[_0x43e9('0x11')][_0x43e9('0x13')]);return _0x510ee7(_0x43d6e8[_0x43e9('0x11')][_0x43e9('0x13')]);}logger['error']('SmsApplication,\x20%s,\x20%s',_0x1183a0,_0x43d6e8[_0x43e9('0x11')]['message']);return _0x287aaf(_0x43d6e8[_0x43e9('0x11')][_0x43e9('0x13')]);}else{logger[_0x43e9('0xc')](_0x43e9('0xd'),_0x1183a0,_0x43e9('0xe'));_0x287aaf(_0x43d6e8[_0x43e9('0x14')][_0x43e9('0x13')]);}})[_0x43e9('0x15')](function(_0x3f7164){logger[_0x43e9('0x11')](_0x43e9('0xd'),_0x1183a0,_0x3f7164);_0x510ee7(_0x3f7164);});});}