Built motion from commit (unavailable).|2.5.4
[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 _0x70e9=['error','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4939ef,_0x3533de){var _0x2fa2fa=function(_0x4d7884){while(--_0x4d7884){_0x4939ef['push'](_0x4939ef['shift']());}};_0x2fa2fa(++_0x3533de);}(_0x70e9,0x193));var _0x970e=function(_0x2eaf43,_0x4860cd){_0x2eaf43=_0x2eaf43-0x0;var _0x390140=_0x70e9[_0x2eaf43];return _0x390140;};'use strict';var _=require('lodash');var util=require(_0x970e('0x0'));var moment=require(_0x970e('0x1'));var BPromise=require('bluebird');var rs=require(_0x970e('0x2'));var fs=require('fs');var Redis=require(_0x970e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x970e('0x4'));var logger=require('../../config/logger')(_0x970e('0x5'));var config=require(_0x970e('0x6'));var jayson=require(_0x970e('0x7'));var client=jayson[_0x970e('0x8')][_0x970e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x303190,_0x1e5701,_0x508324){return new BPromise(function(_0x50cab9,_0x388bf7){return client[_0x970e('0xa')](_0x303190,_0x508324)['then'](function(_0x38c7a0){logger[_0x970e('0xb')](_0x970e('0xc'),_0x1e5701,'request\x20sent');logger[_0x970e('0xd')](_0x970e('0xe'),_0x1e5701,_0x970e('0xf'),JSON[_0x970e('0x10')](_0x38c7a0));if(_0x38c7a0[_0x970e('0x11')]){if(_0x38c7a0[_0x970e('0x11')]['code']===0x1f4){logger[_0x970e('0x11')](_0x970e('0xc'),_0x1e5701,_0x38c7a0[_0x970e('0x11')][_0x970e('0x12')]);return _0x388bf7(_0x38c7a0[_0x970e('0x11')][_0x970e('0x12')]);}logger[_0x970e('0x11')](_0x970e('0xc'),_0x1e5701,_0x38c7a0['error'][_0x970e('0x12')]);return _0x50cab9(_0x38c7a0[_0x970e('0x11')]['message']);}else{logger[_0x970e('0xb')](_0x970e('0xc'),_0x1e5701,_0x970e('0xf'));_0x50cab9(_0x38c7a0[_0x970e('0x13')]['message']);}})[_0x970e('0x14')](function(_0x2ec7f5){logger[_0x970e('0x11')](_0x970e('0xc'),_0x1e5701,_0x2ec7f5);_0x388bf7(_0x2ec7f5);});});}