040f8aaef959918ae71e840bc304877952484095
[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 _0xb7fd=['request','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Cdr,\x20%s,\x20%s','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xb7fd,0x1d7));var _0xdb7f=function(_0x4e5897,_0x22c8db){_0x4e5897=_0x4e5897-0x0;var _0x1921ec=_0xb7fd[_0x4e5897];return _0x1921ec;};'use strict';var _=require(_0xdb7f('0x0'));var util=require(_0xdb7f('0x1'));var moment=require(_0xdb7f('0x2'));var BPromise=require('bluebird');var rs=require(_0xdb7f('0x3'));var fs=require('fs');var Redis=require(_0xdb7f('0x4'));var db=require(_0xdb7f('0x5'))['db'];var utils=require(_0xdb7f('0x6'));var logger=require(_0xdb7f('0x7'))(_0xdb7f('0x8'));var config=require(_0xdb7f('0x9'));var jayson=require(_0xdb7f('0xa'));var client=jayson[_0xdb7f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x81fcc3,_0x40830b,_0x4dd8f8){return new BPromise(function(_0x5cb569,_0x25c464){return client[_0xdb7f('0xc')](_0x81fcc3,_0x4dd8f8)['then'](function(_0xe2c41){logger[_0xdb7f('0xd')]('Cdr,\x20%s,\x20%s',_0x40830b,_0xdb7f('0xe'));logger[_0xdb7f('0xf')](_0xdb7f('0x10'),_0x40830b,_0xdb7f('0xe'),JSON[_0xdb7f('0x11')](_0xe2c41));if(_0xe2c41[_0xdb7f('0x12')]){if(_0xe2c41[_0xdb7f('0x12')][_0xdb7f('0x13')]===0x1f4){logger[_0xdb7f('0x12')]('Cdr,\x20%s,\x20%s',_0x40830b,_0xe2c41[_0xdb7f('0x12')][_0xdb7f('0x14')]);return _0x25c464(_0xe2c41[_0xdb7f('0x12')][_0xdb7f('0x14')]);}logger[_0xdb7f('0x12')](_0xdb7f('0x15'),_0x40830b,_0xe2c41[_0xdb7f('0x12')][_0xdb7f('0x14')]);return _0x5cb569(_0xe2c41[_0xdb7f('0x12')][_0xdb7f('0x14')]);}else{logger[_0xdb7f('0xd')](_0xdb7f('0x15'),_0x40830b,'request\x20sent');_0x5cb569(_0xe2c41['result'][_0xdb7f('0x14')]);}})[_0xdb7f('0x16')](function(_0x466db5){logger['error'](_0xdb7f('0x15'),_0x40830b,_0x466db5);_0x25c464(_0x466db5);});});}