Built motion from commit 10af8726.|2.6.34
[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 _0xa656=['info','debug','stringify','error','Cdr,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','request','then'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa656,0x14a));var _0x6a65=function(_0x3b0b07,_0xc927c6){_0x3b0b07=_0x3b0b07-0x0;var _0x198e38=_0xa656[_0x3b0b07];return _0x198e38;};'use strict';var _=require(_0x6a65('0x0'));var util=require(_0x6a65('0x1'));var moment=require(_0x6a65('0x2'));var BPromise=require(_0x6a65('0x3'));var rs=require(_0x6a65('0x4'));var fs=require('fs');var Redis=require(_0x6a65('0x5'));var db=require(_0x6a65('0x6'))['db'];var utils=require(_0x6a65('0x7'));var logger=require(_0x6a65('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6a65('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x202609,_0x2a290d,_0x3747c1){return new BPromise(function(_0x3c6441,_0x3f20ce){return client[_0x6a65('0xa')](_0x202609,_0x3747c1)[_0x6a65('0xb')](function(_0x49f058){logger[_0x6a65('0xc')]('Cdr,\x20%s,\x20%s',_0x2a290d,'request\x20sent');logger[_0x6a65('0xd')]('Cdr,\x20%s,\x20%s,\x20%s',_0x2a290d,'request\x20sent',JSON[_0x6a65('0xe')](_0x49f058));if(_0x49f058[_0x6a65('0xf')]){if(_0x49f058['error']['code']===0x1f4){logger[_0x6a65('0xf')](_0x6a65('0x10'),_0x2a290d,_0x49f058[_0x6a65('0xf')][_0x6a65('0x11')]);return _0x3f20ce(_0x49f058[_0x6a65('0xf')][_0x6a65('0x11')]);}logger['error'](_0x6a65('0x10'),_0x2a290d,_0x49f058['error'][_0x6a65('0x11')]);return _0x3c6441(_0x49f058['error'][_0x6a65('0x11')]);}else{logger[_0x6a65('0xc')](_0x6a65('0x10'),_0x2a290d,'request\x20sent');_0x3c6441(_0x49f058[_0x6a65('0x12')]['message']);}})['catch'](function(_0x3ac32f){logger['error']('Cdr,\x20%s,\x20%s',_0x2a290d,_0x3ac32f);_0x3f20ce(_0x3ac32f);});});}