Built motion from commit (unavailable).|2.5.9
[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 _0x0f89=['info','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','SmsApplication,\x20%s,\x20%s','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then'];(function(_0x5f34af,_0x40b1e6){var _0x4b52a6=function(_0x417afc){while(--_0x417afc){_0x5f34af['push'](_0x5f34af['shift']());}};_0x4b52a6(++_0x40b1e6);}(_0x0f89,0x111));var _0x90f8=function(_0x26234f,_0xff06f1){_0x26234f=_0x26234f-0x0;var _0x2e65ed=_0x0f89[_0x26234f];return _0x2e65ed;};'use strict';var _=require(_0x90f8('0x0'));var util=require(_0x90f8('0x1'));var moment=require(_0x90f8('0x2'));var BPromise=require('bluebird');var rs=require(_0x90f8('0x3'));var fs=require('fs');var Redis=require(_0x90f8('0x4'));var db=require(_0x90f8('0x5'))['db'];var utils=require(_0x90f8('0x6'));var logger=require('../../config/logger')(_0x90f8('0x7'));var config=require(_0x90f8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x90f8('0x9')][_0x90f8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4457fb,_0x192b06,_0x240086){return new BPromise(function(_0x4424d1,_0x6dabde){return client[_0x90f8('0xb')](_0x4457fb,_0x240086)[_0x90f8('0xc')](function(_0x3cebe0){logger[_0x90f8('0xd')]('SmsApplication,\x20%s,\x20%s',_0x192b06,'request\x20sent');logger[_0x90f8('0xe')](_0x90f8('0xf'),_0x192b06,_0x90f8('0x10'),JSON[_0x90f8('0x11')](_0x3cebe0));if(_0x3cebe0[_0x90f8('0x12')]){if(_0x3cebe0[_0x90f8('0x12')]['code']===0x1f4){logger[_0x90f8('0x12')]('SmsApplication,\x20%s,\x20%s',_0x192b06,_0x3cebe0['error'][_0x90f8('0x13')]);return _0x6dabde(_0x3cebe0[_0x90f8('0x12')]['message']);}logger[_0x90f8('0x12')]('SmsApplication,\x20%s,\x20%s',_0x192b06,_0x3cebe0[_0x90f8('0x12')][_0x90f8('0x13')]);return _0x4424d1(_0x3cebe0[_0x90f8('0x12')][_0x90f8('0x13')]);}else{logger['info'](_0x90f8('0x14'),_0x192b06,_0x90f8('0x10'));_0x4424d1(_0x3cebe0[_0x90f8('0x15')][_0x90f8('0x13')]);}})['catch'](function(_0x2fa060){logger[_0x90f8('0x12')]('SmsApplication,\x20%s,\x20%s',_0x192b06,_0x2fa060);_0x6dabde(_0x2fa060);});});}