76ad19e839e6028839ecc6c7070df720c54a08a3
[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 _0x95f4=['../../config/environment','jayson/promise','http','request','info','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','result','lodash','util','moment','ioredis','../../mysqldb','rpc'];(function(_0x562faa,_0x23adc7){var _0xc70f59=function(_0x2d7dec){while(--_0x2d7dec){_0x562faa['push'](_0x562faa['shift']());}};_0xc70f59(++_0x23adc7);}(_0x95f4,0xf1));var _0x495f=function(_0x48726d,_0x4106fb){_0x48726d=_0x48726d-0x0;var _0x4a60f6=_0x95f4[_0x48726d];return _0x4a60f6;};'use strict';var _=require(_0x495f('0x0'));var util=require(_0x495f('0x1'));var moment=require(_0x495f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x495f('0x3'));var db=require(_0x495f('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x495f('0x5'));var config=require(_0x495f('0x6'));var jayson=require(_0x495f('0x7'));var client=jayson['client'][_0x495f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x435e2a,_0x304274,_0x4c17af){return new BPromise(function(_0x2103a4,_0x4610a7){return client[_0x495f('0x9')](_0x435e2a,_0x4c17af)['then'](function(_0x55dc23){logger[_0x495f('0xa')]('SmsApplication,\x20%s,\x20%s',_0x304274,_0x495f('0xb'));logger['debug'](_0x495f('0xc'),_0x304274,_0x495f('0xb'),JSON[_0x495f('0xd')](_0x55dc23));if(_0x55dc23[_0x495f('0xe')]){if(_0x55dc23['error'][_0x495f('0xf')]===0x1f4){logger[_0x495f('0xe')](_0x495f('0x10'),_0x304274,_0x55dc23[_0x495f('0xe')][_0x495f('0x11')]);return _0x4610a7(_0x55dc23['error'][_0x495f('0x11')]);}logger[_0x495f('0xe')](_0x495f('0x10'),_0x304274,_0x55dc23[_0x495f('0xe')][_0x495f('0x11')]);return _0x2103a4(_0x55dc23[_0x495f('0xe')][_0x495f('0x11')]);}else{logger['info'](_0x495f('0x10'),_0x304274,_0x495f('0xb'));_0x2103a4(_0x55dc23[_0x495f('0x12')][_0x495f('0x11')]);}})['catch'](function(_0x20f97c){logger[_0x495f('0xe')]('SmsApplication,\x20%s,\x20%s',_0x304274,_0x20f97c);_0x4610a7(_0x20f97c);});});}