Built motion from commit 3c2ce842.|2.6.31
[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 _0x87bc=['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','../../mysqldb','../../config/logger','client'];(function(_0xab9f3d,_0xb336fa){var _0x5283bf=function(_0x505e6c){while(--_0x505e6c){_0xab9f3d['push'](_0xab9f3d['shift']());}};_0x5283bf(++_0xb336fa);}(_0x87bc,0x189));var _0xc87b=function(_0x28a37a,_0x5a41f1){_0x28a37a=_0x28a37a-0x0;var _0xdc47a5=_0x87bc[_0x28a37a];return _0xdc47a5;};'use strict';var _=require(_0xc87b('0x0'));var util=require(_0xc87b('0x1'));var moment=require('moment');var BPromise=require(_0xc87b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc87b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc87b('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc87b('0x5')][_0xc87b('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x402aac,_0x5d1813,_0x50b19b){return new BPromise(function(_0x4ed0c5,_0x1999f8){return client[_0xc87b('0x7')](_0x402aac,_0x50b19b)[_0xc87b('0x8')](function(_0x19b571){logger[_0xc87b('0x9')](_0xc87b('0xa'),_0x5d1813,_0xc87b('0xb'));logger[_0xc87b('0xc')](_0xc87b('0xd'),_0x5d1813,'request\x20sent',JSON['stringify'](_0x19b571));if(_0x19b571[_0xc87b('0xe')]){if(_0x19b571['error'][_0xc87b('0xf')]===0x1f4){logger[_0xc87b('0xe')](_0xc87b('0xa'),_0x5d1813,_0x19b571[_0xc87b('0xe')]['message']);return _0x1999f8(_0x19b571[_0xc87b('0xe')]['message']);}logger[_0xc87b('0xe')](_0xc87b('0xa'),_0x5d1813,_0x19b571['error'][_0xc87b('0x10')]);return _0x4ed0c5(_0x19b571[_0xc87b('0xe')]['message']);}else{logger[_0xc87b('0x9')](_0xc87b('0xa'),_0x5d1813,_0xc87b('0xb'));_0x4ed0c5(_0x19b571[_0xc87b('0x11')][_0xc87b('0x10')]);}})[_0xc87b('0x12')](function(_0x4009ef){logger[_0xc87b('0xe')]('SmsApplication,\x20%s,\x20%s',_0x5d1813,_0x4009ef);_0x1999f8(_0x4009ef);});});}