Built motion from commit 87cd5f02.|2.5.48
[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 _0x3fc1=['message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2c30f4,_0x1b88db){var _0x4a688e=function(_0x51745c){while(--_0x51745c){_0x2c30f4['push'](_0x2c30f4['shift']());}};_0x4a688e(++_0x1b88db);}(_0x3fc1,0x1a1));var _0x13fc=function(_0x35df06,_0x2ba84e){_0x35df06=_0x35df06-0x0;var _0x317a77=_0x3fc1[_0x35df06];return _0x317a77;};'use strict';var _=require(_0x13fc('0x0'));var util=require(_0x13fc('0x1'));var moment=require(_0x13fc('0x2'));var BPromise=require(_0x13fc('0x3'));var rs=require(_0x13fc('0x4'));var fs=require('fs');var Redis=require(_0x13fc('0x5'));var db=require(_0x13fc('0x6'))['db'];var utils=require(_0x13fc('0x7'));var logger=require(_0x13fc('0x8'))('rpc');var config=require(_0x13fc('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x13fc('0xa')][_0x13fc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xdb7724,_0x40adfb,_0x2db846){return new BPromise(function(_0xa8be93,_0x258a51){return client[_0x13fc('0xc')](_0xdb7724,_0x2db846)[_0x13fc('0xd')](function(_0x524cae){logger['info'](_0x13fc('0xe'),_0x40adfb,_0x13fc('0xf'));logger[_0x13fc('0x10')](_0x13fc('0x11'),_0x40adfb,_0x13fc('0xf'),JSON[_0x13fc('0x12')](_0x524cae));if(_0x524cae[_0x13fc('0x13')]){if(_0x524cae[_0x13fc('0x13')]['code']===0x1f4){logger[_0x13fc('0x13')]('Cdr,\x20%s,\x20%s',_0x40adfb,_0x524cae[_0x13fc('0x13')][_0x13fc('0x14')]);return _0x258a51(_0x524cae[_0x13fc('0x13')][_0x13fc('0x14')]);}logger[_0x13fc('0x13')](_0x13fc('0xe'),_0x40adfb,_0x524cae[_0x13fc('0x13')]['message']);return _0xa8be93(_0x524cae[_0x13fc('0x13')]['message']);}else{logger[_0x13fc('0x15')]('Cdr,\x20%s,\x20%s',_0x40adfb,_0x13fc('0xf'));_0xa8be93(_0x524cae['result'][_0x13fc('0x14')]);}})[_0x13fc('0x16')](function(_0x4977e0){logger[_0x13fc('0x13')](_0x13fc('0xe'),_0x40adfb,_0x4977e0);_0x258a51(_0x4977e0);});});}