Built motion from commit bab6f49e.|2.6.17
[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 _0x07ed=['../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','code','error','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x342691,_0x5c3abb){var _0x5acdd9=function(_0x47deba){while(--_0x47deba){_0x342691['push'](_0x342691['shift']());}};_0x5acdd9(++_0x5c3abb);}(_0x07ed,0xf5));var _0xd07e=function(_0x11447e,_0x33dab2){_0x11447e=_0x11447e-0x0;var _0x45a214=_0x07ed[_0x11447e];return _0x45a214;};'use strict';var _=require('lodash');var util=require(_0xd07e('0x0'));var moment=require(_0xd07e('0x1'));var BPromise=require(_0xd07e('0x2'));var rs=require(_0xd07e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd07e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd07e('0x5'))(_0xd07e('0x6'));var config=require(_0xd07e('0x7'));var jayson=require(_0xd07e('0x8'));var client=jayson[_0xd07e('0x9')][_0xd07e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x713b1b,_0x25a15c,_0x1f2604){return new BPromise(function(_0x35b647,_0xbdc7b2){return client[_0xd07e('0xb')](_0x713b1b,_0x1f2604)[_0xd07e('0xc')](function(_0x395b63){logger[_0xd07e('0xd')](_0xd07e('0xe'),_0x25a15c,_0xd07e('0xf'));logger['debug'](_0xd07e('0x10'),_0x25a15c,'request\x20sent',JSON['stringify'](_0x395b63));if(_0x395b63['error']){if(_0x395b63['error'][_0xd07e('0x11')]===0x1f4){logger[_0xd07e('0x12')](_0xd07e('0xe'),_0x25a15c,_0x395b63[_0xd07e('0x12')][_0xd07e('0x13')]);return _0xbdc7b2(_0x395b63[_0xd07e('0x12')]['message']);}logger[_0xd07e('0x12')]('Cdr,\x20%s,\x20%s',_0x25a15c,_0x395b63['error'][_0xd07e('0x13')]);return _0x35b647(_0x395b63['error'][_0xd07e('0x13')]);}else{logger[_0xd07e('0xd')](_0xd07e('0xe'),_0x25a15c,_0xd07e('0xf'));_0x35b647(_0x395b63['result']['message']);}})[_0xd07e('0x14')](function(_0x29571b){logger[_0xd07e('0x12')]('Cdr,\x20%s,\x20%s',_0x25a15c,_0x29571b);_0xbdc7b2(_0x29571b);});});}