Built motion from commit (unavailable).|2.4.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 _0x7840=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment'];(function(_0x96ca25,_0x1422bb){var _0x4b0adc=function(_0x515fe8){while(--_0x515fe8){_0x96ca25['push'](_0x96ca25['shift']());}};_0x4b0adc(++_0x1422bb);}(_0x7840,0xef));var _0x0784=function(_0x2565a4,_0x2ce941){_0x2565a4=_0x2565a4-0x0;var _0x8f97c2=_0x7840[_0x2565a4];return _0x8f97c2;};'use strict';var _=require(_0x0784('0x0'));var util=require(_0x0784('0x1'));var moment=require(_0x0784('0x2'));var BPromise=require(_0x0784('0x3'));var rs=require(_0x0784('0x4'));var fs=require('fs');var Redis=require(_0x0784('0x5'));var db=require(_0x0784('0x6'))['db'];var utils=require(_0x0784('0x7'));var logger=require(_0x0784('0x8'))(_0x0784('0x9'));var config=require(_0x0784('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x0784('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bcd49,_0x164801,_0x33920f){return new BPromise(function(_0x648abc,_0x32cde7){return client['request'](_0x1bcd49,_0x33920f)['then'](function(_0x43b5a9){logger[_0x0784('0xc')](_0x0784('0xd'),_0x164801,_0x0784('0xe'));logger[_0x0784('0xf')](_0x0784('0x10'),_0x164801,_0x0784('0xe'),JSON[_0x0784('0x11')](_0x43b5a9));if(_0x43b5a9['error']){if(_0x43b5a9[_0x0784('0x12')][_0x0784('0x13')]===0x1f4){logger['error'](_0x0784('0xd'),_0x164801,_0x43b5a9[_0x0784('0x12')][_0x0784('0x14')]);return _0x32cde7(_0x43b5a9['error'][_0x0784('0x14')]);}logger[_0x0784('0x12')](_0x0784('0xd'),_0x164801,_0x43b5a9[_0x0784('0x12')][_0x0784('0x14')]);return _0x648abc(_0x43b5a9['error'][_0x0784('0x14')]);}else{logger[_0x0784('0xc')]('Cdr,\x20%s,\x20%s',_0x164801,_0x0784('0xe'));_0x648abc(_0x43b5a9[_0x0784('0x15')]['message']);}})['catch'](function(_0x49995a){logger[_0x0784('0x12')](_0x0784('0xd'),_0x164801,_0x49995a);_0x32cde7(_0x49995a);});});}