Built motion from commit (unavailable).|2.5.31
[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 _0x05d5=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Cdr,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','lodash','util'];(function(_0x2f302a,_0x57782d){var _0x1b3719=function(_0x5655d6){while(--_0x5655d6){_0x2f302a['push'](_0x2f302a['shift']());}};_0x1b3719(++_0x57782d);}(_0x05d5,0x1b6));var _0x505d=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x05d5[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0x505d('0x0'));var util=require(_0x505d('0x1'));var moment=require(_0x505d('0x2'));var BPromise=require(_0x505d('0x3'));var rs=require(_0x505d('0x4'));var fs=require('fs');var Redis=require(_0x505d('0x5'));var db=require(_0x505d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x505d('0x7'))(_0x505d('0x8'));var config=require(_0x505d('0x9'));var jayson=require(_0x505d('0xa'));var client=jayson[_0x505d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46f458,_0x535afe,_0x3a9826){return new BPromise(function(_0x290f3f,_0x3dbdf3){return client[_0x505d('0xc')](_0x46f458,_0x3a9826)[_0x505d('0xd')](function(_0x389418){logger[_0x505d('0xe')](_0x505d('0xf'),_0x535afe,'request\x20sent');logger[_0x505d('0x10')]('Cdr,\x20%s,\x20%s,\x20%s',_0x535afe,_0x505d('0x11'),JSON[_0x505d('0x12')](_0x389418));if(_0x389418['error']){if(_0x389418[_0x505d('0x13')]['code']===0x1f4){logger[_0x505d('0x13')](_0x505d('0xf'),_0x535afe,_0x389418[_0x505d('0x13')][_0x505d('0x14')]);return _0x3dbdf3(_0x389418['error'][_0x505d('0x14')]);}logger[_0x505d('0x13')](_0x505d('0xf'),_0x535afe,_0x389418[_0x505d('0x13')][_0x505d('0x14')]);return _0x290f3f(_0x389418[_0x505d('0x13')][_0x505d('0x14')]);}else{logger[_0x505d('0xe')]('Cdr,\x20%s,\x20%s',_0x535afe,'request\x20sent');_0x290f3f(_0x389418[_0x505d('0x15')]['message']);}})['catch'](function(_0x10f0a7){logger[_0x505d('0x13')]('Cdr,\x20%s,\x20%s',_0x535afe,_0x10f0a7);_0x3dbdf3(_0x10f0a7);});});}