0d3830530bbbdaca3f3217b63a85197e6f630b6c
[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 _0xc35f=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','then','info','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','SmsApplication,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x4053ab,_0x2b3c0a){var _0x4dd292=function(_0x1ad258){while(--_0x1ad258){_0x4053ab['push'](_0x4053ab['shift']());}};_0x4dd292(++_0x2b3c0a);}(_0xc35f,0x1ca));var _0xfc35=function(_0x4d67bf,_0x5ee7ed){_0x4d67bf=_0x4d67bf-0x0;var _0x4900f8=_0xc35f[_0x4d67bf];return _0x4900f8;};'use strict';var _=require(_0xfc35('0x0'));var util=require(_0xfc35('0x1'));var moment=require(_0xfc35('0x2'));var BPromise=require(_0xfc35('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc35('0x4'));var db=require(_0xfc35('0x5'))['db'];var utils=require(_0xfc35('0x6'));var logger=require('../../config/logger')(_0xfc35('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfc35('0x8')][_0xfc35('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c92db,_0x47d695,_0x4283cd){return new BPromise(function(_0x290dcc,_0x43deed){return client['request'](_0x4c92db,_0x4283cd)[_0xfc35('0xa')](function(_0x13d7b9){logger[_0xfc35('0xb')]('SmsApplication,\x20%s,\x20%s',_0x47d695,_0xfc35('0xc'));logger[_0xfc35('0xd')](_0xfc35('0xe'),_0x47d695,_0xfc35('0xc'),JSON['stringify'](_0x13d7b9));if(_0x13d7b9[_0xfc35('0xf')]){if(_0x13d7b9[_0xfc35('0xf')]['code']===0x1f4){logger[_0xfc35('0xf')](_0xfc35('0x10'),_0x47d695,_0x13d7b9[_0xfc35('0xf')]['message']);return _0x43deed(_0x13d7b9[_0xfc35('0xf')]['message']);}logger[_0xfc35('0xf')]('SmsApplication,\x20%s,\x20%s',_0x47d695,_0x13d7b9[_0xfc35('0xf')][_0xfc35('0x11')]);return _0x290dcc(_0x13d7b9['error']['message']);}else{logger[_0xfc35('0xb')](_0xfc35('0x10'),_0x47d695,_0xfc35('0xc'));_0x290dcc(_0x13d7b9[_0xfc35('0x12')][_0xfc35('0x11')]);}})[_0xfc35('0x13')](function(_0x58aae3){logger[_0xfc35('0xf')](_0xfc35('0x10'),_0x47d695,_0x58aae3);_0x43deed(_0x58aae3);});});}