Built motion from commit (unavailable).|2.5.27
[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 _0x5421=['message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','code','error','Cdr,\x20%s,\x20%s'];(function(_0x5a3fe8,_0x25d2cf){var _0x24f3ca=function(_0x561b17){while(--_0x561b17){_0x5a3fe8['push'](_0x5a3fe8['shift']());}};_0x24f3ca(++_0x25d2cf);}(_0x5421,0x118));var _0x1542=function(_0x139e6a,_0x443ab7){_0x139e6a=_0x139e6a-0x0;var _0x19c2ba=_0x5421[_0x139e6a];return _0x19c2ba;};'use strict';var _=require(_0x1542('0x0'));var util=require(_0x1542('0x1'));var moment=require(_0x1542('0x2'));var BPromise=require('bluebird');var rs=require(_0x1542('0x3'));var fs=require('fs');var Redis=require(_0x1542('0x4'));var db=require(_0x1542('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1542('0x6'))(_0x1542('0x7'));var config=require(_0x1542('0x8'));var jayson=require(_0x1542('0x9'));var client=jayson[_0x1542('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36f8c3,_0x4a3b9d,_0x34e076){return new BPromise(function(_0x5989db,_0x56db53){return client[_0x1542('0xb')](_0x36f8c3,_0x34e076)[_0x1542('0xc')](function(_0x1db471){logger['info']('Cdr,\x20%s,\x20%s',_0x4a3b9d,_0x1542('0xd'));logger['debug'](_0x1542('0xe'),_0x4a3b9d,_0x1542('0xd'),JSON[_0x1542('0xf')](_0x1db471));if(_0x1db471['error']){if(_0x1db471['error'][_0x1542('0x10')]===0x1f4){logger[_0x1542('0x11')](_0x1542('0x12'),_0x4a3b9d,_0x1db471['error']['message']);return _0x56db53(_0x1db471[_0x1542('0x11')][_0x1542('0x13')]);}logger['error'](_0x1542('0x12'),_0x4a3b9d,_0x1db471[_0x1542('0x11')][_0x1542('0x13')]);return _0x5989db(_0x1db471[_0x1542('0x11')][_0x1542('0x13')]);}else{logger[_0x1542('0x14')](_0x1542('0x12'),_0x4a3b9d,'request\x20sent');_0x5989db(_0x1db471[_0x1542('0x15')][_0x1542('0x13')]);}})[_0x1542('0x16')](function(_0x4550ab){logger['error']('Cdr,\x20%s,\x20%s',_0x4a3b9d,_0x4550ab);_0x56db53(_0x4550ab);});});}