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 _0xf9a2=['../../config/utils','../../config/logger','jayson/promise','client','http','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x59add1,_0x541f05){var _0x371082=function(_0x191e54){while(--_0x191e54){_0x59add1['push'](_0x59add1['shift']());}};_0x371082(++_0x541f05);}(_0xf9a2,0xff));var _0x2f9a=function(_0xf28385,_0x1d4d55){_0xf28385=_0xf28385-0x0;var _0x2f33cc=_0xf9a2[_0xf28385];return _0x2f33cc;};'use strict';var _=require('lodash');var util=require(_0x2f9a('0x0'));var moment=require('moment');var BPromise=require(_0x2f9a('0x1'));var rs=require(_0x2f9a('0x2'));var fs=require('fs');var Redis=require(_0x2f9a('0x3'));var db=require(_0x2f9a('0x4'))['db'];var utils=require(_0x2f9a('0x5'));var logger=require(_0x2f9a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2f9a('0x7'));var client=jayson[_0x2f9a('0x8')][_0x2f9a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37a280,_0x4a4dc8,_0x4bfb9b){return new BPromise(function(_0x394fc4,_0x285907){return client['request'](_0x37a280,_0x4bfb9b)[_0x2f9a('0xa')](function(_0x3e9906){logger[_0x2f9a('0xb')](_0x2f9a('0xc'),_0x4a4dc8,_0x2f9a('0xd'));logger[_0x2f9a('0xe')](_0x2f9a('0xf'),_0x4a4dc8,_0x2f9a('0xd'),JSON['stringify'](_0x3e9906));if(_0x3e9906[_0x2f9a('0x10')]){if(_0x3e9906['error']['code']===0x1f4){logger['error']('Cdr,\x20%s,\x20%s',_0x4a4dc8,_0x3e9906[_0x2f9a('0x10')][_0x2f9a('0x11')]);return _0x285907(_0x3e9906[_0x2f9a('0x10')][_0x2f9a('0x11')]);}logger[_0x2f9a('0x10')](_0x2f9a('0xc'),_0x4a4dc8,_0x3e9906['error'][_0x2f9a('0x11')]);return _0x394fc4(_0x3e9906[_0x2f9a('0x10')]['message']);}else{logger[_0x2f9a('0xb')](_0x2f9a('0xc'),_0x4a4dc8,'request\x20sent');_0x394fc4(_0x3e9906[_0x2f9a('0x12')][_0x2f9a('0x11')]);}})[_0x2f9a('0x13')](function(_0x3f4781){logger['error'](_0x2f9a('0xc'),_0x4a4dc8,_0x3f4781);_0x285907(_0x3f4781);});});}