Built motion from commit 43538d75.|2.5.35
[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 _0x5b48=['../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','code','error','Cdr,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x5b48,0xf4));var _0x85b4=function(_0x34a1b2,_0x3b2ee5){_0x34a1b2=_0x34a1b2-0x0;var _0x52c608=_0x5b48[_0x34a1b2];return _0x52c608;};'use strict';var _=require(_0x85b4('0x0'));var util=require(_0x85b4('0x1'));var moment=require(_0x85b4('0x2'));var BPromise=require(_0x85b4('0x3'));var rs=require(_0x85b4('0x4'));var fs=require('fs');var Redis=require(_0x85b4('0x5'));var db=require(_0x85b4('0x6'))['db'];var utils=require(_0x85b4('0x7'));var logger=require(_0x85b4('0x8'))('rpc');var config=require(_0x85b4('0x9'));var jayson=require(_0x85b4('0xa'));var client=jayson[_0x85b4('0xb')][_0x85b4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x502af3,_0xc2b43a,_0x1de407){return new BPromise(function(_0x2860b5,_0x4781ec){return client[_0x85b4('0xd')](_0x502af3,_0x1de407)['then'](function(_0x139aff){logger[_0x85b4('0xe')]('Cdr,\x20%s,\x20%s',_0xc2b43a,_0x85b4('0xf'));logger[_0x85b4('0x10')]('Cdr,\x20%s,\x20%s,\x20%s',_0xc2b43a,_0x85b4('0xf'),JSON[_0x85b4('0x11')](_0x139aff));if(_0x139aff['error']){if(_0x139aff['error'][_0x85b4('0x12')]===0x1f4){logger['error']('Cdr,\x20%s,\x20%s',_0xc2b43a,_0x139aff[_0x85b4('0x13')]['message']);return _0x4781ec(_0x139aff[_0x85b4('0x13')]['message']);}logger[_0x85b4('0x13')](_0x85b4('0x14'),_0xc2b43a,_0x139aff[_0x85b4('0x13')][_0x85b4('0x15')]);return _0x2860b5(_0x139aff[_0x85b4('0x13')]['message']);}else{logger[_0x85b4('0xe')](_0x85b4('0x14'),_0xc2b43a,_0x85b4('0xf'));_0x2860b5(_0x139aff[_0x85b4('0x16')][_0x85b4('0x15')]);}})['catch'](function(_0x5c2377){logger['error'](_0x85b4('0x14'),_0xc2b43a,_0x5c2377);_0x4781ec(_0x5c2377);});});}