e1a50502181b4b51ed9bedc416aa07db3e2a4fd8
[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 _0x6dc0=['rpc','../../config/environment','client','info','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x46ad9a,_0x6e901a){var _0x2d3f54=function(_0x3285fd){while(--_0x3285fd){_0x46ad9a['push'](_0x46ad9a['shift']());}};_0x2d3f54(++_0x6e901a);}(_0x6dc0,0xb6));var _0x06dc=function(_0x2dcec9,_0x295456){_0x2dcec9=_0x2dcec9-0x0;var _0x15ce19=_0x6dc0[_0x2dcec9];return _0x15ce19;};'use strict';var _=require(_0x06dc('0x0'));var util=require(_0x06dc('0x1'));var moment=require(_0x06dc('0x2'));var BPromise=require('bluebird');var rs=require(_0x06dc('0x3'));var fs=require('fs');var Redis=require(_0x06dc('0x4'));var db=require(_0x06dc('0x5'))['db'];var utils=require(_0x06dc('0x6'));var logger=require('../../config/logger')(_0x06dc('0x7'));var config=require(_0x06dc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x06dc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x419534,_0x3212ca,_0x14c15b){return new BPromise(function(_0x10e23b,_0x140eef){return client['request'](_0x419534,_0x14c15b)['then'](function(_0x480f30){logger[_0x06dc('0xa')](_0x06dc('0xb'),_0x3212ca,'request\x20sent');logger[_0x06dc('0xc')](_0x06dc('0xd'),_0x3212ca,_0x06dc('0xe'),JSON[_0x06dc('0xf')](_0x480f30));if(_0x480f30['error']){if(_0x480f30[_0x06dc('0x10')][_0x06dc('0x11')]===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0x3212ca,_0x480f30['error']['message']);return _0x140eef(_0x480f30[_0x06dc('0x10')]['message']);}logger['error']('SmsApplication,\x20%s,\x20%s',_0x3212ca,_0x480f30[_0x06dc('0x10')][_0x06dc('0x12')]);return _0x10e23b(_0x480f30[_0x06dc('0x10')]['message']);}else{logger[_0x06dc('0xa')](_0x06dc('0xb'),_0x3212ca,_0x06dc('0xe'));_0x10e23b(_0x480f30[_0x06dc('0x13')]['message']);}})[_0x06dc('0x14')](function(_0x30c1c5){logger[_0x06dc('0x10')](_0x06dc('0xb'),_0x3212ca,_0x30c1c5);_0x140eef(_0x30c1c5);});});}