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 _0x8934=['client','http','request','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x27e811,_0x20137c){var _0x1627fa=function(_0x4498ca){while(--_0x4498ca){_0x27e811['push'](_0x27e811['shift']());}};_0x1627fa(++_0x20137c);}(_0x8934,0xf4));var _0x4893=function(_0x1118e6,_0x440a86){_0x1118e6=_0x1118e6-0x0;var _0x5687e1=_0x8934[_0x1118e6];return _0x5687e1;};'use strict';var _=require(_0x4893('0x0'));var util=require('util');var moment=require(_0x4893('0x1'));var BPromise=require(_0x4893('0x2'));var rs=require(_0x4893('0x3'));var fs=require('fs');var Redis=require(_0x4893('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4893('0x5'));var logger=require(_0x4893('0x6'))(_0x4893('0x7'));var config=require('../../config/environment');var jayson=require(_0x4893('0x8'));var client=jayson[_0x4893('0x9')][_0x4893('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5bed35,_0x35a5bd,_0x5ad6b8){return new BPromise(function(_0x21a69a,_0x376d42){return client[_0x4893('0xb')](_0x5bed35,_0x5ad6b8)[_0x4893('0xc')](function(_0xb62aee){logger['info'](_0x4893('0xd'),_0x35a5bd,_0x4893('0xe'));logger[_0x4893('0xf')](_0x4893('0x10'),_0x35a5bd,'request\x20sent',JSON[_0x4893('0x11')](_0xb62aee));if(_0xb62aee[_0x4893('0x12')]){if(_0xb62aee[_0x4893('0x12')][_0x4893('0x13')]===0x1f4){logger[_0x4893('0x12')](_0x4893('0xd'),_0x35a5bd,_0xb62aee[_0x4893('0x12')][_0x4893('0x14')]);return _0x376d42(_0xb62aee[_0x4893('0x12')]['message']);}logger[_0x4893('0x12')]('Cdr,\x20%s,\x20%s',_0x35a5bd,_0xb62aee[_0x4893('0x12')][_0x4893('0x14')]);return _0x21a69a(_0xb62aee[_0x4893('0x12')]['message']);}else{logger['info'](_0x4893('0xd'),_0x35a5bd,_0x4893('0xe'));_0x21a69a(_0xb62aee[_0x4893('0x15')][_0x4893('0x14')]);}})[_0x4893('0x16')](function(_0x472163){logger[_0x4893('0x12')](_0x4893('0xd'),_0x35a5bd,_0x472163);_0x376d42(_0x472163);});});}