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 _0xf430=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','moment','bluebird','randomstring','ioredis'];(function(_0x5d860a,_0xe2505b){var _0x2bd13a=function(_0x471d8c){while(--_0x471d8c){_0x5d860a['push'](_0x5d860a['shift']());}};_0x2bd13a(++_0xe2505b);}(_0xf430,0x1f4));var _0x0f43=function(_0x5528c3,_0x35a416){_0x5528c3=_0x5528c3-0x0;var _0x47ec1b=_0xf430[_0x5528c3];return _0x47ec1b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0f43('0x0'));var BPromise=require(_0x0f43('0x1'));var rs=require(_0x0f43('0x2'));var fs=require('fs');var Redis=require(_0x0f43('0x3'));var db=require(_0x0f43('0x4'))['db'];var utils=require(_0x0f43('0x5'));var logger=require(_0x0f43('0x6'))(_0x0f43('0x7'));var config=require(_0x0f43('0x8'));var jayson=require(_0x0f43('0x9'));var client=jayson[_0x0f43('0xa')][_0x0f43('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f9a0a,_0x48fd76,_0x260758){return new BPromise(function(_0x49ed4a,_0x1023be){return client[_0x0f43('0xc')](_0x3f9a0a,_0x260758)[_0x0f43('0xd')](function(_0x490f4b){logger['info'](_0x0f43('0xe'),_0x48fd76,_0x0f43('0xf'));logger[_0x0f43('0x10')](_0x0f43('0x11'),_0x48fd76,_0x0f43('0xf'),JSON[_0x0f43('0x12')](_0x490f4b));if(_0x490f4b[_0x0f43('0x13')]){if(_0x490f4b[_0x0f43('0x13')][_0x0f43('0x14')]===0x1f4){logger[_0x0f43('0x13')](_0x0f43('0xe'),_0x48fd76,_0x490f4b[_0x0f43('0x13')][_0x0f43('0x15')]);return _0x1023be(_0x490f4b[_0x0f43('0x13')][_0x0f43('0x15')]);}logger['error'](_0x0f43('0xe'),_0x48fd76,_0x490f4b[_0x0f43('0x13')][_0x0f43('0x15')]);return _0x49ed4a(_0x490f4b[_0x0f43('0x13')][_0x0f43('0x15')]);}else{logger[_0x0f43('0x16')](_0x0f43('0xe'),_0x48fd76,'request\x20sent');_0x49ed4a(_0x490f4b['result']['message']);}})[_0x0f43('0x17')](function(_0x49e440){logger[_0x0f43('0x13')](_0x0f43('0xe'),_0x48fd76,_0x49e440);_0x1023be(_0x49e440);});});}