c53989f686f73840e712ccc4cdaade46d6b1e632
[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 _0xf38a=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x494567,_0x1a98ce){var _0x500e3a=function(_0xd97c01){while(--_0xd97c01){_0x494567['push'](_0x494567['shift']());}};_0x500e3a(++_0x1a98ce);}(_0xf38a,0x1e3));var _0xaf38=function(_0x247fa1,_0x4ec37c){_0x247fa1=_0x247fa1-0x0;var _0x244f35=_0xf38a[_0x247fa1];return _0x244f35;};'use strict';var _=require(_0xaf38('0x0'));var util=require(_0xaf38('0x1'));var moment=require(_0xaf38('0x2'));var BPromise=require(_0xaf38('0x3'));var rs=require(_0xaf38('0x4'));var fs=require('fs');var Redis=require(_0xaf38('0x5'));var db=require(_0xaf38('0x6'))['db'];var utils=require(_0xaf38('0x7'));var logger=require(_0xaf38('0x8'))(_0xaf38('0x9'));var config=require(_0xaf38('0xa'));var jayson=require(_0xaf38('0xb'));var client=jayson[_0xaf38('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x346b15,_0x1fe0a0,_0x22a35c){return new BPromise(function(_0x1aab61,_0x3075fd){return client[_0xaf38('0xd')](_0x346b15,_0x22a35c)[_0xaf38('0xe')](function(_0x2c0908){logger[_0xaf38('0xf')](_0xaf38('0x10'),_0x1fe0a0,_0xaf38('0x11'));logger[_0xaf38('0x12')](_0xaf38('0x13'),_0x1fe0a0,_0xaf38('0x11'),JSON['stringify'](_0x2c0908));if(_0x2c0908[_0xaf38('0x14')]){if(_0x2c0908[_0xaf38('0x14')][_0xaf38('0x15')]===0x1f4){logger[_0xaf38('0x14')](_0xaf38('0x10'),_0x1fe0a0,_0x2c0908[_0xaf38('0x14')][_0xaf38('0x16')]);return _0x3075fd(_0x2c0908[_0xaf38('0x14')][_0xaf38('0x16')]);}logger[_0xaf38('0x14')]('Cdr,\x20%s,\x20%s',_0x1fe0a0,_0x2c0908[_0xaf38('0x14')][_0xaf38('0x16')]);return _0x1aab61(_0x2c0908[_0xaf38('0x14')]['message']);}else{logger[_0xaf38('0xf')](_0xaf38('0x10'),_0x1fe0a0,_0xaf38('0x11'));_0x1aab61(_0x2c0908['result'][_0xaf38('0x16')]);}})['catch'](function(_0x12a1d7){logger['error']('Cdr,\x20%s,\x20%s',_0x1fe0a0,_0x12a1d7);_0x3075fd(_0x12a1d7);});});}