Built motion from commit da617fac.|2.6.6
[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 _0x41d2=['error','code','message','info','request\x20sent','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x164271,_0x55ecdc){var _0xfd6455=function(_0x2b0d25){while(--_0x2b0d25){_0x164271['push'](_0x164271['shift']());}};_0xfd6455(++_0x55ecdc);}(_0x41d2,0x18c));var _0x241d=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x41d2[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0x241d('0x0'));var util=require(_0x241d('0x1'));var moment=require(_0x241d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x241d('0x3'));var db=require(_0x241d('0x4'))['db'];var utils=require(_0x241d('0x5'));var logger=require(_0x241d('0x6'))(_0x241d('0x7'));var config=require(_0x241d('0x8'));var jayson=require(_0x241d('0x9'));var client=jayson[_0x241d('0xa')][_0x241d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39aadd,_0x3c1d54,_0x3447e){return new BPromise(function(_0x39ed5b,_0x60afc2){return client[_0x241d('0xc')](_0x39aadd,_0x3447e)[_0x241d('0xd')](function(_0x282534){logger['info'](_0x241d('0xe'),_0x3c1d54,'request\x20sent');logger[_0x241d('0xf')](_0x241d('0x10'),_0x3c1d54,'request\x20sent',JSON[_0x241d('0x11')](_0x282534));if(_0x282534[_0x241d('0x12')]){if(_0x282534[_0x241d('0x12')][_0x241d('0x13')]===0x1f4){logger[_0x241d('0x12')](_0x241d('0xe'),_0x3c1d54,_0x282534[_0x241d('0x12')][_0x241d('0x14')]);return _0x60afc2(_0x282534[_0x241d('0x12')][_0x241d('0x14')]);}logger['error'](_0x241d('0xe'),_0x3c1d54,_0x282534[_0x241d('0x12')]['message']);return _0x39ed5b(_0x282534[_0x241d('0x12')][_0x241d('0x14')]);}else{logger[_0x241d('0x15')]('Cdr,\x20%s,\x20%s',_0x3c1d54,_0x241d('0x16'));_0x39ed5b(_0x282534['result'][_0x241d('0x14')]);}})['catch'](function(_0x4a0e59){logger['error']('Cdr,\x20%s,\x20%s',_0x3c1d54,_0x4a0e59);_0x60afc2(_0x4a0e59);});});}