Built motion from commit 85328c08.|2.5.50
[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 _0xe056=['code','message','info','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','http','request','then','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x17e498,_0x48989c){var _0x4cd515=function(_0x5a84c8){while(--_0x5a84c8){_0x17e498['push'](_0x17e498['shift']());}};_0x4cd515(++_0x48989c);}(_0xe056,0xdb));var _0x6e05=function(_0x57e00e,_0x36e79a){_0x57e00e=_0x57e00e-0x0;var _0x415e60=_0xe056[_0x57e00e];return _0x415e60;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6e05('0x0'));var BPromise=require(_0x6e05('0x1'));var rs=require(_0x6e05('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6e05('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6e05('0x4'))(_0x6e05('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6e05('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x390bb6,_0x1c78eb,_0x5dacb2){return new BPromise(function(_0x1a54b7,_0x177b2c){return client[_0x6e05('0x7')](_0x390bb6,_0x5dacb2)[_0x6e05('0x8')](function(_0x13af56){logger['info'](_0x6e05('0x9'),_0x1c78eb,_0x6e05('0xa'));logger[_0x6e05('0xb')](_0x6e05('0xc'),_0x1c78eb,_0x6e05('0xa'),JSON[_0x6e05('0xd')](_0x13af56));if(_0x13af56['error']){if(_0x13af56[_0x6e05('0xe')][_0x6e05('0xf')]===0x1f4){logger[_0x6e05('0xe')]('SmsApplication,\x20%s,\x20%s',_0x1c78eb,_0x13af56[_0x6e05('0xe')][_0x6e05('0x10')]);return _0x177b2c(_0x13af56[_0x6e05('0xe')][_0x6e05('0x10')]);}logger[_0x6e05('0xe')]('SmsApplication,\x20%s,\x20%s',_0x1c78eb,_0x13af56[_0x6e05('0xe')][_0x6e05('0x10')]);return _0x1a54b7(_0x13af56['error']['message']);}else{logger[_0x6e05('0x11')](_0x6e05('0x9'),_0x1c78eb,_0x6e05('0xa'));_0x1a54b7(_0x13af56['result'][_0x6e05('0x10')]);}})['catch'](function(_0x3c3ef0){logger[_0x6e05('0xe')]('SmsApplication,\x20%s,\x20%s',_0x1c78eb,_0x3c3ef0);_0x177b2c(_0x3c3ef0);});});}