ceda77fbd83b7f4e9396c160f52b2fc3bcc8ff72
[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 _0xb4e6=['request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','SmsApplication,\x20%s,\x20%s'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xb4e6,0xd8));var _0x6b4e=function(_0x512c83,_0x42a67a){_0x512c83=_0x512c83-0x0;var _0x1f7f25=_0xb4e6[_0x512c83];return _0x1f7f25;};'use strict';var _=require(_0x6b4e('0x0'));var util=require(_0x6b4e('0x1'));var moment=require(_0x6b4e('0x2'));var BPromise=require(_0x6b4e('0x3'));var rs=require(_0x6b4e('0x4'));var fs=require('fs');var Redis=require(_0x6b4e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6b4e('0x6'));var logger=require('../../config/logger')(_0x6b4e('0x7'));var config=require(_0x6b4e('0x8'));var jayson=require(_0x6b4e('0x9'));var client=jayson[_0x6b4e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4091d6,_0x189e5b,_0x471c1e){return new BPromise(function(_0x187c7d,_0x2abbbb){return client[_0x6b4e('0xb')](_0x4091d6,_0x471c1e)[_0x6b4e('0xc')](function(_0x23c442){logger[_0x6b4e('0xd')](_0x6b4e('0xe'),_0x189e5b,_0x6b4e('0xf'));logger[_0x6b4e('0x10')](_0x6b4e('0x11'),_0x189e5b,_0x6b4e('0xf'),JSON[_0x6b4e('0x12')](_0x23c442));if(_0x23c442[_0x6b4e('0x13')]){if(_0x23c442[_0x6b4e('0x13')]['code']===0x1f4){logger['error'](_0x6b4e('0xe'),_0x189e5b,_0x23c442[_0x6b4e('0x13')][_0x6b4e('0x14')]);return _0x2abbbb(_0x23c442[_0x6b4e('0x13')]['message']);}logger['error']('SmsApplication,\x20%s,\x20%s',_0x189e5b,_0x23c442['error'][_0x6b4e('0x14')]);return _0x187c7d(_0x23c442[_0x6b4e('0x13')][_0x6b4e('0x14')]);}else{logger[_0x6b4e('0xd')](_0x6b4e('0xe'),_0x189e5b,_0x6b4e('0xf'));_0x187c7d(_0x23c442['result'][_0x6b4e('0x14')]);}})['catch'](function(_0x3a7508){logger[_0x6b4e('0x13')](_0x6b4e('0xe'),_0x189e5b,_0x3a7508);_0x2abbbb(_0x3a7508);});});}