e16bc94e49632affaca07dbb5438f9fb07c2095d
[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 _0x7722=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','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'];(function(_0x37b7a2,_0x163a9b){var _0x4cc76a=function(_0x51fd0d){while(--_0x51fd0d){_0x37b7a2['push'](_0x37b7a2['shift']());}};_0x4cc76a(++_0x163a9b);}(_0x7722,0x14e));var _0x2772=function(_0x5e2299,_0x3bf63d){_0x5e2299=_0x5e2299-0x0;var _0x3ff816=_0x7722[_0x5e2299];return _0x3ff816;};'use strict';var _=require(_0x2772('0x0'));var util=require(_0x2772('0x1'));var moment=require(_0x2772('0x2'));var BPromise=require(_0x2772('0x3'));var rs=require(_0x2772('0x4'));var fs=require('fs');var Redis=require(_0x2772('0x5'));var db=require(_0x2772('0x6'))['db'];var utils=require(_0x2772('0x7'));var logger=require(_0x2772('0x8'))('rpc');var config=require(_0x2772('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2772('0xa')][_0x2772('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e6c6e,_0xabc5bb,_0x21b452){return new BPromise(function(_0x53f017,_0x408df9){return client[_0x2772('0xc')](_0x3e6c6e,_0x21b452)[_0x2772('0xd')](function(_0x131220){logger[_0x2772('0xe')](_0x2772('0xf'),_0xabc5bb,_0x2772('0x10'));logger[_0x2772('0x11')](_0x2772('0x12'),_0xabc5bb,_0x2772('0x10'),JSON['stringify'](_0x131220));if(_0x131220[_0x2772('0x13')]){if(_0x131220[_0x2772('0x13')][_0x2772('0x14')]===0x1f4){logger['error'](_0x2772('0xf'),_0xabc5bb,_0x131220[_0x2772('0x13')][_0x2772('0x15')]);return _0x408df9(_0x131220[_0x2772('0x13')][_0x2772('0x15')]);}logger['error'](_0x2772('0xf'),_0xabc5bb,_0x131220[_0x2772('0x13')][_0x2772('0x15')]);return _0x53f017(_0x131220[_0x2772('0x13')]['message']);}else{logger[_0x2772('0xe')]('SmsApplication,\x20%s,\x20%s',_0xabc5bb,_0x2772('0x10'));_0x53f017(_0x131220[_0x2772('0x16')][_0x2772('0x15')]);}})[_0x2772('0x17')](function(_0x3c5f5a){logger[_0x2772('0x13')](_0x2772('0xf'),_0xabc5bb,_0x3c5f5a);_0x408df9(_0x3c5f5a);});});}