Built motion from commit (unavailable).|2.5.4
[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 _0x8f8f=['code','Cdr,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','request\x20sent','debug','stringify','error'];(function(_0x857c02,_0x3cc0b3){var _0x5bbbab=function(_0x4c7733){while(--_0x4c7733){_0x857c02['push'](_0x857c02['shift']());}};_0x5bbbab(++_0x3cc0b3);}(_0x8f8f,0x1d3));var _0xf8f8=function(_0x35fdbc,_0x1166c0){_0x35fdbc=_0x35fdbc-0x0;var _0x135cd4=_0x8f8f[_0x35fdbc];return _0x135cd4;};'use strict';var _=require(_0xf8f8('0x0'));var util=require(_0xf8f8('0x1'));var moment=require(_0xf8f8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf8f8('0x3'));var db=require(_0xf8f8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf8f8('0x5'))(_0xf8f8('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf8f8('0x7')][_0xf8f8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x47ffa2,_0x265bd1,_0x5941d6){return new BPromise(function(_0x3f5f89,_0xa1471b){return client[_0xf8f8('0x9')](_0x47ffa2,_0x5941d6)[_0xf8f8('0xa')](function(_0xa7de3d){logger[_0xf8f8('0xb')]('Cdr,\x20%s,\x20%s',_0x265bd1,_0xf8f8('0xc'));logger[_0xf8f8('0xd')]('Cdr,\x20%s,\x20%s,\x20%s',_0x265bd1,'request\x20sent',JSON[_0xf8f8('0xe')](_0xa7de3d));if(_0xa7de3d[_0xf8f8('0xf')]){if(_0xa7de3d[_0xf8f8('0xf')][_0xf8f8('0x10')]===0x1f4){logger['error'](_0xf8f8('0x11'),_0x265bd1,_0xa7de3d['error'][_0xf8f8('0x12')]);return _0xa1471b(_0xa7de3d[_0xf8f8('0xf')][_0xf8f8('0x12')]);}logger[_0xf8f8('0xf')](_0xf8f8('0x11'),_0x265bd1,_0xa7de3d['error'][_0xf8f8('0x12')]);return _0x3f5f89(_0xa7de3d[_0xf8f8('0xf')][_0xf8f8('0x12')]);}else{logger[_0xf8f8('0xb')](_0xf8f8('0x11'),_0x265bd1,_0xf8f8('0xc'));_0x3f5f89(_0xa7de3d[_0xf8f8('0x13')]['message']);}})[_0xf8f8('0x14')](function(_0x10ebc9){logger['error'](_0xf8f8('0x11'),_0x265bd1,_0x10ebc9);_0xa1471b(_0x10ebc9);});});}