6401e1b3b83142f405b313506778bc66ed6d34d4
[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 _0x1619=['then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x250bbc,_0x3297f3){var _0x489e34=function(_0x67c2d3){while(--_0x67c2d3){_0x250bbc['push'](_0x250bbc['shift']());}};_0x489e34(++_0x3297f3);}(_0x1619,0x144));var _0x9161=function(_0x289719,_0x5e3d09){_0x289719=_0x289719-0x0;var _0x2df9ab=_0x1619[_0x289719];return _0x2df9ab;};'use strict';var _=require(_0x9161('0x0'));var util=require(_0x9161('0x1'));var moment=require(_0x9161('0x2'));var BPromise=require(_0x9161('0x3'));var rs=require(_0x9161('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9161('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9161('0x6'))(_0x9161('0x7'));var config=require(_0x9161('0x8'));var jayson=require(_0x9161('0x9'));var client=jayson[_0x9161('0xa')][_0x9161('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ce76b,_0x1478ec,_0xad0373){return new BPromise(function(_0x296432,_0xe2e137){return client['request'](_0x1ce76b,_0xad0373)[_0x9161('0xc')](function(_0x4f0cd3){logger[_0x9161('0xd')](_0x9161('0xe'),_0x1478ec,_0x9161('0xf'));logger[_0x9161('0x10')](_0x9161('0x11'),_0x1478ec,'request\x20sent',JSON[_0x9161('0x12')](_0x4f0cd3));if(_0x4f0cd3['error']){if(_0x4f0cd3[_0x9161('0x13')][_0x9161('0x14')]===0x1f4){logger[_0x9161('0x13')](_0x9161('0xe'),_0x1478ec,_0x4f0cd3['error'][_0x9161('0x15')]);return _0xe2e137(_0x4f0cd3[_0x9161('0x13')][_0x9161('0x15')]);}logger[_0x9161('0x13')](_0x9161('0xe'),_0x1478ec,_0x4f0cd3[_0x9161('0x13')][_0x9161('0x15')]);return _0x296432(_0x4f0cd3[_0x9161('0x13')][_0x9161('0x15')]);}else{logger[_0x9161('0xd')]('Cdr,\x20%s,\x20%s',_0x1478ec,_0x9161('0xf'));_0x296432(_0x4f0cd3[_0x9161('0x16')][_0x9161('0x15')]);}})[_0x9161('0x17')](function(_0x42ba1a){logger[_0x9161('0x13')](_0x9161('0xe'),_0x1478ec,_0x42ba1a);_0xe2e137(_0x42ba1a);});});}