00001 // OSB library ********************************************* -*- C++ -*- 00006 /* 00007 AUTHOR(S): Venkatesan (vn) 00008 00009 RCS information 00010 $Name: OSB_060808 $ 00011 $Revision: 1.8 $ 00012 00013 License 00014 OSB rating and billing library for communication networks 00015 Copyright (C) 2004, 2005, 2006 OSB systems 00016 00017 This file may be distributed and/or modify under the terms of the 00018 GNU General Public License (GPL) as published by the Free Software 00019 Foundation which is provided in the file LICENSE.GPL included in the 00020 packaging of this file. 00021 00022 The file is distributed in the hope that it will be useful, but WITHOUT 00023 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00024 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00025 for more details. 00026 00027 Holders of a OSB Commercial License may use this file under the terms 00028 and conditions of this commercial license. 00029 */ 00030 #ifndef _ASRPROCESSOR_H_ 00031 #define _ASRPROCESSOR_H_ 00032 00033 // ********************************************************************* 00034 // included header files 00035 // + standard includes 00036 00037 // + local headers 00038 #include "cdrpostprocessor.h" 00039 #include "network.h" 00040 00041 // ********************************************************************* 00042 // class declarations 00043 namespace OSB_DB { 00044 class AsrGw; 00045 }; 00046 00047 // ********************************************************************* 00048 // namespace extensions 00049 namespace OSB_LIB { 00050 00051 // ********************************************************************* 00052 // class definitions 00061 class Asr { 00063 friend class AsrProcessor; 00064 friend class OSB_DB::AsrGw; 00065 public: 00067 Asr(); 00069 ~Asr(); 00078 void save(OSB_DB::Session& session); 00079 00081 00082 Id2<NetworkElement> elementId() const 00083 { 00084 return elementId_; 00085 } 00086 00087 const std::string& inTrunkGroup() const 00088 { 00089 return inTrunkGroup_; 00090 } 00091 00092 const long inTrunkNo() const 00093 { 00094 return inTrunkNo_; 00095 } 00096 00097 const std::string& outTrunkGroup() const 00098 { 00099 return outTrunkGroup_; 00100 } 00101 00102 const long outTrunkNo() const 00103 { 00104 return outTrunkNo_; 00105 } 00106 00107 const DateTime& fromPeriod() const 00108 { 00109 return fromPeriod_; 00110 } 00111 00112 const DateTime& toPeriod() const 00113 { 00114 return toPeriod_; 00115 } 00116 00117 const long totalCalls() const 00118 { 00119 return totalCalls_; 00120 } 00121 00122 const long successCalls() const 00123 { 00124 return successCalls_; 00125 } 00127 private: 00129 00130 Id2<NetworkElement> elementId_; 00131 std::string inTrunkGroup_; 00132 long inTrunkNo_; 00133 std::string outTrunkGroup_; 00134 long outTrunkNo_; 00135 DateTime fromPeriod_; 00136 DateTime toPeriod_; 00137 long totalCalls_; 00138 long successCalls_; 00139 00140 }; 00141 00148 class AsrProcessor: public CdrPostProcessor { 00149 public: 00155 AsrProcessor(long asrPeriod); 00157 ~AsrProcessor(); 00161 void startTransaction(); 00168 CdrPostProcessor::ProcessStatus processCdr(Cdr& cdr); 00174 void stopTransaction(OSB_DB::Session& session); 00175 private: 00177 long asrPeriod_; 00179 std::vector<Asr> asrs_; 00180 }; 00181 } // namespace OSB_LIB 00182 #endif // #ifndef _ASRPROCESSOR_H_