2ba23cf6ec543ec0bb1d4981e7b5f7dc7ae8a5d5
[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 _0x4808=['stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4808,0x160));var _0x8480=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x4808[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0x8480('0x0'));var util=require(_0x8480('0x1'));var moment=require(_0x8480('0x2'));var BPromise=require('bluebird');var rs=require(_0x8480('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8480('0x4'))['db'];var utils=require(_0x8480('0x5'));var logger=require(_0x8480('0x6'))('rpc');var config=require(_0x8480('0x7'));var jayson=require(_0x8480('0x8'));var client=jayson['client'][_0x8480('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5060aa,_0x364f22,_0x4b9f45){return new BPromise(function(_0x3480e7,_0x2b1ffb){return client[_0x8480('0xa')](_0x5060aa,_0x4b9f45)[_0x8480('0xb')](function(_0x337d1e){logger['info'](_0x8480('0xc'),_0x364f22,_0x8480('0xd'));logger[_0x8480('0xe')](_0x8480('0xf'),_0x364f22,_0x8480('0xd'),JSON[_0x8480('0x10')](_0x337d1e));if(_0x337d1e[_0x8480('0x11')]){if(_0x337d1e[_0x8480('0x11')][_0x8480('0x12')]===0x1f4){logger[_0x8480('0x11')](_0x8480('0xc'),_0x364f22,_0x337d1e[_0x8480('0x11')][_0x8480('0x13')]);return _0x2b1ffb(_0x337d1e[_0x8480('0x11')][_0x8480('0x13')]);}logger[_0x8480('0x11')](_0x8480('0xc'),_0x364f22,_0x337d1e[_0x8480('0x11')][_0x8480('0x13')]);return _0x3480e7(_0x337d1e['error'][_0x8480('0x13')]);}else{logger[_0x8480('0x14')](_0x8480('0xc'),_0x364f22,'request\x20sent');_0x3480e7(_0x337d1e[_0x8480('0x15')][_0x8480('0x13')]);}})[_0x8480('0x16')](function(_0x35dd6a){logger[_0x8480('0x11')](_0x8480('0xc'),_0x364f22,_0x35dd6a);_0x2b1ffb(_0x35dd6a);});});}