Built motion from commit bab6f49e.|2.6.17
[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 _0x6da9=['../../config/environment','jayson/promise','client','info','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3c89e3,_0x2fce73){var _0x5990b1=function(_0xc6ecf2){while(--_0xc6ecf2){_0x3c89e3['push'](_0x3c89e3['shift']());}};_0x5990b1(++_0x2fce73);}(_0x6da9,0x161));var _0x96da=function(_0x2b0e71,_0x3a3a07){_0x2b0e71=_0x2b0e71-0x0;var _0x57058e=_0x6da9[_0x2b0e71];return _0x57058e;};'use strict';var _=require(_0x96da('0x0'));var util=require(_0x96da('0x1'));var moment=require(_0x96da('0x2'));var BPromise=require(_0x96da('0x3'));var rs=require(_0x96da('0x4'));var fs=require('fs');var Redis=require(_0x96da('0x5'));var db=require(_0x96da('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x96da('0x7'));var jayson=require(_0x96da('0x8'));var client=jayson[_0x96da('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bc4b0,_0x5d7737,_0x161249){return new BPromise(function(_0x45ee2f,_0x3b0883){return client['request'](_0x1bc4b0,_0x161249)['then'](function(_0x4ed0c1){logger[_0x96da('0xa')](_0x96da('0xb'),_0x5d7737,_0x96da('0xc'));logger['debug'](_0x96da('0xd'),_0x5d7737,_0x96da('0xc'),JSON['stringify'](_0x4ed0c1));if(_0x4ed0c1[_0x96da('0xe')]){if(_0x4ed0c1[_0x96da('0xe')][_0x96da('0xf')]===0x1f4){logger[_0x96da('0xe')](_0x96da('0xb'),_0x5d7737,_0x4ed0c1[_0x96da('0xe')][_0x96da('0x10')]);return _0x3b0883(_0x4ed0c1[_0x96da('0xe')][_0x96da('0x10')]);}logger['error'](_0x96da('0xb'),_0x5d7737,_0x4ed0c1[_0x96da('0xe')]['message']);return _0x45ee2f(_0x4ed0c1['error'][_0x96da('0x10')]);}else{logger[_0x96da('0xa')]('SmsApplication,\x20%s,\x20%s',_0x5d7737,_0x96da('0xc'));_0x45ee2f(_0x4ed0c1['result'][_0x96da('0x10')]);}})[_0x96da('0x11')](function(_0x2d6d15){logger[_0x96da('0xe')](_0x96da('0xb'),_0x5d7737,_0x2d6d15);_0x3b0883(_0x2d6d15);});});}