49e8cf29da0bc23c06950e7018b0c3a05612aa26
[motion2.git] / server / api / cdr / cdr.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 _0xc019=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s'];(function(_0x5eb491,_0x432628){var _0x295f37=function(_0x233726){while(--_0x233726){_0x5eb491['push'](_0x5eb491['shift']());}};_0x295f37(++_0x432628);}(_0xc019,0xc3));var _0x9c01=function(_0x5627ff,_0x1cf377){_0x5627ff=_0x5627ff-0x0;var _0x23c1d1=_0xc019[_0x5627ff];return _0x23c1d1;};'use strict';var _=require(_0x9c01('0x0'));var util=require(_0x9c01('0x1'));var moment=require('moment');var BPromise=require(_0x9c01('0x2'));var rs=require(_0x9c01('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9c01('0x4'))(_0x9c01('0x5'));var config=require(_0x9c01('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9c01('0x7')][_0x9c01('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x194dd2,_0x459634,_0x1eeeaa){return new BPromise(function(_0x305331,_0xeab3c0){return client[_0x9c01('0x9')](_0x194dd2,_0x1eeeaa)[_0x9c01('0xa')](function(_0x2e898e){logger[_0x9c01('0xb')](_0x9c01('0xc'),_0x459634,_0x9c01('0xd'));logger['debug'](_0x9c01('0xe'),_0x459634,_0x9c01('0xd'),JSON[_0x9c01('0xf')](_0x2e898e));if(_0x2e898e[_0x9c01('0x10')]){if(_0x2e898e[_0x9c01('0x10')][_0x9c01('0x11')]===0x1f4){logger[_0x9c01('0x10')](_0x9c01('0xc'),_0x459634,_0x2e898e['error'][_0x9c01('0x12')]);return _0xeab3c0(_0x2e898e[_0x9c01('0x10')]['message']);}logger[_0x9c01('0x10')]('Cdr,\x20%s,\x20%s',_0x459634,_0x2e898e[_0x9c01('0x10')][_0x9c01('0x12')]);return _0x305331(_0x2e898e[_0x9c01('0x10')][_0x9c01('0x12')]);}else{logger[_0x9c01('0xb')](_0x9c01('0xc'),_0x459634,'request\x20sent');_0x305331(_0x2e898e[_0x9c01('0x13')]['message']);}})[_0x9c01('0x14')](function(_0x43b65c){logger[_0x9c01('0x10')]('Cdr,\x20%s,\x20%s',_0x459634,_0x43b65c);_0xeab3c0(_0x43b65c);});});}