Built motion from commit 8c034dcd.|2.6.31
[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 _0xd649=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','Cdr,\x20%s,\x20%s','message','catch','lodash','util','bluebird'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0xd649,0x19f));var _0x9d64=function(_0x285233,_0x58e017){_0x285233=_0x285233-0x0;var _0x2e9a77=_0xd649[_0x285233];return _0x2e9a77;};'use strict';var _=require(_0x9d64('0x0'));var util=require(_0x9d64('0x1'));var moment=require('moment');var BPromise=require(_0x9d64('0x2'));var rs=require(_0x9d64('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9d64('0x4'))['db'];var utils=require(_0x9d64('0x5'));var logger=require(_0x9d64('0x6'))(_0x9d64('0x7'));var config=require(_0x9d64('0x8'));var jayson=require(_0x9d64('0x9'));var client=jayson[_0x9d64('0xa')][_0x9d64('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a7823,_0x101922,_0x7d616e){return new BPromise(function(_0x42fdac,_0xf1b4b){return client[_0x9d64('0xc')](_0x2a7823,_0x7d616e)[_0x9d64('0xd')](function(_0x4b7938){logger[_0x9d64('0xe')]('Cdr,\x20%s,\x20%s',_0x101922,_0x9d64('0xf'));logger[_0x9d64('0x10')]('Cdr,\x20%s,\x20%s,\x20%s',_0x101922,'request\x20sent',JSON['stringify'](_0x4b7938));if(_0x4b7938['error']){if(_0x4b7938[_0x9d64('0x11')][_0x9d64('0x12')]===0x1f4){logger['error']('Cdr,\x20%s,\x20%s',_0x101922,_0x4b7938[_0x9d64('0x11')]['message']);return _0xf1b4b(_0x4b7938[_0x9d64('0x11')]['message']);}logger[_0x9d64('0x11')](_0x9d64('0x13'),_0x101922,_0x4b7938['error'][_0x9d64('0x14')]);return _0x42fdac(_0x4b7938[_0x9d64('0x11')][_0x9d64('0x14')]);}else{logger[_0x9d64('0xe')]('Cdr,\x20%s,\x20%s',_0x101922,_0x9d64('0xf'));_0x42fdac(_0x4b7938['result'][_0x9d64('0x14')]);}})[_0x9d64('0x15')](function(_0x5e6257){logger[_0x9d64('0x11')]('Cdr,\x20%s,\x20%s',_0x101922,_0x5e6257);_0xf1b4b(_0x5e6257);});});}