c49ca4468d58e6cf70ed731a0b900b981679492b
[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 _0xa633=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','Cdr,\x20%s,\x20%s','message','result'];(function(_0x1c18b3,_0x29bffd){var _0x300d14=function(_0x2da0b1){while(--_0x2da0b1){_0x1c18b3['push'](_0x1c18b3['shift']());}};_0x300d14(++_0x29bffd);}(_0xa633,0x1aa));var _0x3a63=function(_0x16937f,_0x221626){_0x16937f=_0x16937f-0x0;var _0xe64b18=_0xa633[_0x16937f];return _0xe64b18;};'use strict';var _=require(_0x3a63('0x0'));var util=require(_0x3a63('0x1'));var moment=require(_0x3a63('0x2'));var BPromise=require(_0x3a63('0x3'));var rs=require(_0x3a63('0x4'));var fs=require('fs');var Redis=require(_0x3a63('0x5'));var db=require(_0x3a63('0x6'))['db'];var utils=require(_0x3a63('0x7'));var logger=require(_0x3a63('0x8'))('rpc');var config=require(_0x3a63('0x9'));var jayson=require(_0x3a63('0xa'));var client=jayson[_0x3a63('0xb')][_0x3a63('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x574e2b,_0x44578b,_0x27946c){return new BPromise(function(_0x3b6450,_0x34b449){return client['request'](_0x574e2b,_0x27946c)[_0x3a63('0xd')](function(_0x1e5b59){logger[_0x3a63('0xe')]('Cdr,\x20%s,\x20%s',_0x44578b,_0x3a63('0xf'));logger[_0x3a63('0x10')](_0x3a63('0x11'),_0x44578b,_0x3a63('0xf'),JSON[_0x3a63('0x12')](_0x1e5b59));if(_0x1e5b59[_0x3a63('0x13')]){if(_0x1e5b59[_0x3a63('0x13')][_0x3a63('0x14')]===0x1f4){logger[_0x3a63('0x13')](_0x3a63('0x15'),_0x44578b,_0x1e5b59[_0x3a63('0x13')][_0x3a63('0x16')]);return _0x34b449(_0x1e5b59['error'][_0x3a63('0x16')]);}logger['error'](_0x3a63('0x15'),_0x44578b,_0x1e5b59[_0x3a63('0x13')][_0x3a63('0x16')]);return _0x3b6450(_0x1e5b59[_0x3a63('0x13')][_0x3a63('0x16')]);}else{logger[_0x3a63('0xe')](_0x3a63('0x15'),_0x44578b,'request\x20sent');_0x3b6450(_0x1e5b59[_0x3a63('0x17')][_0x3a63('0x16')]);}})[_0x3a63('0x18')](function(_0x4cac37){logger[_0x3a63('0x13')](_0x3a63('0x15'),_0x44578b,_0x4cac37);_0x34b449(_0x4cac37);});});}