6b73c5d9fafe826a6a05f9f290354c6d1049edac
[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 _0xea89=['util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x2bbf32,_0x4e63f4){var _0x2b9814=function(_0x5d1311){while(--_0x5d1311){_0x2bbf32['push'](_0x2bbf32['shift']());}};_0x2b9814(++_0x4e63f4);}(_0xea89,0x1e2));var _0x9ea8=function(_0x371d05,_0x598ae4){_0x371d05=_0x371d05-0x0;var _0x2f5e21=_0xea89[_0x371d05];return _0x2f5e21;};'use strict';var _=require(_0x9ea8('0x0'));var util=require(_0x9ea8('0x1'));var moment=require(_0x9ea8('0x2'));var BPromise=require(_0x9ea8('0x3'));var rs=require(_0x9ea8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9ea8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9ea8('0x6'))('rpc');var config=require(_0x9ea8('0x7'));var jayson=require(_0x9ea8('0x8'));var client=jayson[_0x9ea8('0x9')][_0x9ea8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f2210,_0x2ad47f,_0x265c85){return new BPromise(function(_0x4889de,_0xad3e18){return client[_0x9ea8('0xb')](_0x1f2210,_0x265c85)['then'](function(_0x436faf){logger[_0x9ea8('0xc')](_0x9ea8('0xd'),_0x2ad47f,'request\x20sent');logger[_0x9ea8('0xe')](_0x9ea8('0xf'),_0x2ad47f,_0x9ea8('0x10'),JSON[_0x9ea8('0x11')](_0x436faf));if(_0x436faf[_0x9ea8('0x12')]){if(_0x436faf[_0x9ea8('0x12')][_0x9ea8('0x13')]===0x1f4){logger['error'](_0x9ea8('0xd'),_0x2ad47f,_0x436faf[_0x9ea8('0x12')][_0x9ea8('0x14')]);return _0xad3e18(_0x436faf['error'][_0x9ea8('0x14')]);}logger[_0x9ea8('0x12')](_0x9ea8('0xd'),_0x2ad47f,_0x436faf[_0x9ea8('0x12')][_0x9ea8('0x14')]);return _0x4889de(_0x436faf[_0x9ea8('0x12')][_0x9ea8('0x14')]);}else{logger['info'](_0x9ea8('0xd'),_0x2ad47f,_0x9ea8('0x10'));_0x4889de(_0x436faf[_0x9ea8('0x15')]['message']);}})[_0x9ea8('0x16')](function(_0x558869){logger[_0x9ea8('0x12')](_0x9ea8('0xd'),_0x2ad47f,_0x558869);_0xad3e18(_0x558869);});});}