Built motion from commit (unavailable).|2.5.22
[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 _0xa2c8=['jayson/promise','client','http','info','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x23ac3f,_0x3e164a){var _0x4d0589=function(_0x6ad74f){while(--_0x6ad74f){_0x23ac3f['push'](_0x23ac3f['shift']());}};_0x4d0589(++_0x3e164a);}(_0xa2c8,0x99));var _0x8a2c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa2c8[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x8a2c('0x0'));var util=require(_0x8a2c('0x1'));var moment=require(_0x8a2c('0x2'));var BPromise=require(_0x8a2c('0x3'));var rs=require(_0x8a2c('0x4'));var fs=require('fs');var Redis=require(_0x8a2c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8a2c('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8a2c('0x7'));var client=jayson[_0x8a2c('0x8')][_0x8a2c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1031fb,_0x4e007c,_0xe1e335){return new BPromise(function(_0x1d2885,_0x43745f){return client['request'](_0x1031fb,_0xe1e335)['then'](function(_0x4c237a){logger[_0x8a2c('0xa')](_0x8a2c('0xb'),_0x4e007c,'request\x20sent');logger[_0x8a2c('0xc')](_0x8a2c('0xd'),_0x4e007c,_0x8a2c('0xe'),JSON[_0x8a2c('0xf')](_0x4c237a));if(_0x4c237a[_0x8a2c('0x10')]){if(_0x4c237a[_0x8a2c('0x10')]['code']===0x1f4){logger[_0x8a2c('0x10')](_0x8a2c('0xb'),_0x4e007c,_0x4c237a['error'][_0x8a2c('0x11')]);return _0x43745f(_0x4c237a[_0x8a2c('0x10')]['message']);}logger['error']('SmsApplication,\x20%s,\x20%s',_0x4e007c,_0x4c237a['error'][_0x8a2c('0x11')]);return _0x1d2885(_0x4c237a[_0x8a2c('0x10')][_0x8a2c('0x11')]);}else{logger['info']('SmsApplication,\x20%s,\x20%s',_0x4e007c,_0x8a2c('0xe'));_0x1d2885(_0x4c237a[_0x8a2c('0x12')][_0x8a2c('0x11')]);}})[_0x8a2c('0x13')](function(_0x4388b0){logger[_0x8a2c('0x10')](_0x8a2c('0xb'),_0x4e007c,_0x4388b0);_0x43745f(_0x4388b0);});});}