Built motion from commit (unavailable).|2.5.10
[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 _0x5668=['then','info','request\x20sent','debug','error','code','Cdr,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x49a14d,_0xba785f){var _0x7ed203=function(_0x11bed3){while(--_0x11bed3){_0x49a14d['push'](_0x49a14d['shift']());}};_0x7ed203(++_0xba785f);}(_0x5668,0x14e));var _0x8566=function(_0xda7a60,_0x2e6f0c){_0xda7a60=_0xda7a60-0x0;var _0x5b1ae5=_0x5668[_0xda7a60];return _0x5b1ae5;};'use strict';var _=require(_0x8566('0x0'));var util=require(_0x8566('0x1'));var moment=require('moment');var BPromise=require(_0x8566('0x2'));var rs=require(_0x8566('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8566('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8566('0x5'))(_0x8566('0x6'));var config=require('../../config/environment');var jayson=require(_0x8566('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5513c7,_0x35767a,_0x5cbc8f){return new BPromise(function(_0x192fb2,_0x285332){return client['request'](_0x5513c7,_0x5cbc8f)[_0x8566('0x8')](function(_0x19e3fe){logger[_0x8566('0x9')]('Cdr,\x20%s,\x20%s',_0x35767a,_0x8566('0xa'));logger[_0x8566('0xb')]('Cdr,\x20%s,\x20%s,\x20%s',_0x35767a,_0x8566('0xa'),JSON['stringify'](_0x19e3fe));if(_0x19e3fe[_0x8566('0xc')]){if(_0x19e3fe[_0x8566('0xc')][_0x8566('0xd')]===0x1f4){logger['error'](_0x8566('0xe'),_0x35767a,_0x19e3fe[_0x8566('0xc')]['message']);return _0x285332(_0x19e3fe[_0x8566('0xc')]['message']);}logger[_0x8566('0xc')](_0x8566('0xe'),_0x35767a,_0x19e3fe[_0x8566('0xc')][_0x8566('0xf')]);return _0x192fb2(_0x19e3fe[_0x8566('0xc')][_0x8566('0xf')]);}else{logger['info'](_0x8566('0xe'),_0x35767a,_0x8566('0xa'));_0x192fb2(_0x19e3fe[_0x8566('0x10')][_0x8566('0xf')]);}})[_0x8566('0x11')](function(_0x41dc96){logger['error'](_0x8566('0xe'),_0x35767a,_0x41dc96);_0x285332(_0x41dc96);});});}