Built motion from commit (unavailable).|2.5.26
[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 _0xa608=['message','info','result','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Cdr,\x20%s,\x20%s','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x2dede6,_0x6b5325){var _0x12e7b2=function(_0x2af420){while(--_0x2af420){_0x2dede6['push'](_0x2dede6['shift']());}};_0x12e7b2(++_0x6b5325);}(_0xa608,0xab));var _0x8a60=function(_0x26ea26,_0x467c14){_0x26ea26=_0x26ea26-0x0;var _0xd77fac=_0xa608[_0x26ea26];return _0xd77fac;};'use strict';var _=require(_0x8a60('0x0'));var util=require(_0x8a60('0x1'));var moment=require('moment');var BPromise=require(_0x8a60('0x2'));var rs=require(_0x8a60('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8a60('0x4'));var logger=require(_0x8a60('0x5'))(_0x8a60('0x6'));var config=require(_0x8a60('0x7'));var jayson=require(_0x8a60('0x8'));var client=jayson[_0x8a60('0x9')][_0x8a60('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28c60a,_0x308bc5,_0x3463cb){return new BPromise(function(_0x42b7ca,_0x15d02c){return client['request'](_0x28c60a,_0x3463cb)[_0x8a60('0xb')](function(_0x260430){logger['info'](_0x8a60('0xc'),_0x308bc5,'request\x20sent');logger['debug'](_0x8a60('0xd'),_0x308bc5,_0x8a60('0xe'),JSON[_0x8a60('0xf')](_0x260430));if(_0x260430[_0x8a60('0x10')]){if(_0x260430[_0x8a60('0x10')][_0x8a60('0x11')]===0x1f4){logger[_0x8a60('0x10')]('Cdr,\x20%s,\x20%s',_0x308bc5,_0x260430[_0x8a60('0x10')][_0x8a60('0x12')]);return _0x15d02c(_0x260430['error']['message']);}logger[_0x8a60('0x10')]('Cdr,\x20%s,\x20%s',_0x308bc5,_0x260430[_0x8a60('0x10')][_0x8a60('0x12')]);return _0x42b7ca(_0x260430[_0x8a60('0x10')][_0x8a60('0x12')]);}else{logger[_0x8a60('0x13')](_0x8a60('0xc'),_0x308bc5,'request\x20sent');_0x42b7ca(_0x260430[_0x8a60('0x14')][_0x8a60('0x12')]);}})['catch'](function(_0x2ea146){logger[_0x8a60('0x10')](_0x8a60('0xc'),_0x308bc5,_0x2ea146);_0x15d02c(_0x2ea146);});});}