Built motion from commit 9d7072cc.|2.5.39
[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 _0x8a9a=['rpc','../../config/environment','jayson/promise','client','request','then','info','SmsApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3c4b69,_0x8e55c7){var _0x47abd4=function(_0x1a9d46){while(--_0x1a9d46){_0x3c4b69['push'](_0x3c4b69['shift']());}};_0x47abd4(++_0x8e55c7);}(_0x8a9a,0x17f));var _0xa8a9=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x8a9a[_0x5608a3];return _0x1ed50a;};'use strict';var _=require('lodash');var util=require(_0xa8a9('0x0'));var moment=require(_0xa8a9('0x1'));var BPromise=require(_0xa8a9('0x2'));var rs=require(_0xa8a9('0x3'));var fs=require('fs');var Redis=require(_0xa8a9('0x4'));var db=require(_0xa8a9('0x5'))['db'];var utils=require(_0xa8a9('0x6'));var logger=require(_0xa8a9('0x7'))(_0xa8a9('0x8'));var config=require(_0xa8a9('0x9'));var jayson=require(_0xa8a9('0xa'));var client=jayson[_0xa8a9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24a2bc,_0x4a091d,_0x1b4873){return new BPromise(function(_0x129e9f,_0x1477b0){return client[_0xa8a9('0xc')](_0x24a2bc,_0x1b4873)[_0xa8a9('0xd')](function(_0x4ebe24){logger[_0xa8a9('0xe')](_0xa8a9('0xf'),_0x4a091d,'request\x20sent');logger[_0xa8a9('0x10')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x4a091d,_0xa8a9('0x11'),JSON[_0xa8a9('0x12')](_0x4ebe24));if(_0x4ebe24['error']){if(_0x4ebe24[_0xa8a9('0x13')][_0xa8a9('0x14')]===0x1f4){logger[_0xa8a9('0x13')](_0xa8a9('0xf'),_0x4a091d,_0x4ebe24[_0xa8a9('0x13')][_0xa8a9('0x15')]);return _0x1477b0(_0x4ebe24['error'][_0xa8a9('0x15')]);}logger[_0xa8a9('0x13')](_0xa8a9('0xf'),_0x4a091d,_0x4ebe24['error']['message']);return _0x129e9f(_0x4ebe24[_0xa8a9('0x13')][_0xa8a9('0x15')]);}else{logger[_0xa8a9('0xe')]('SmsApplication,\x20%s,\x20%s',_0x4a091d,_0xa8a9('0x11'));_0x129e9f(_0x4ebe24[_0xa8a9('0x16')]['message']);}})['catch'](function(_0x1039c9){logger[_0xa8a9('0x13')](_0xa8a9('0xf'),_0x4a091d,_0x1039c9);_0x1477b0(_0x1039c9);});});}