[Freeswitch-branches] [commit] r10061 - in freeswitch/branches/jkr888/CDRLogger/trunk: . .settings src src/main src/main/java src/main/java/com src/main/java/com/jkr src/main/java/com/jkr/freeswitch src/main/java/com/jkr/freeswitch/cdr src/main/java/com/jkr/freeswitch/cdr/logger src/main/java/com/jkr/freeswitch/cdr/model src/main/java/webapp src/main/resources src/main/webapp src/main/webapp/WEB-INF src/test src/test/java src/test/resources

Freeswitch SVN jkr888 at freeswitch.org
Fri Oct 17 20:30:23 EDT 2008


Author: jkr888
Date: Fri Oct 17 20:30:23 2008
New Revision: 10061

Added:
   freeswitch/branches/jkr888/CDRLogger/trunk/.classpath
   freeswitch/branches/jkr888/CDRLogger/trunk/.project
   freeswitch/branches/jkr888/CDRLogger/trunk/.settings/
   freeswitch/branches/jkr888/CDRLogger/trunk/.settings/org.eclipse.jdt.core.prefs
   freeswitch/branches/jkr888/CDRLogger/trunk/.settings/org.maven.ide.eclipse.prefs
   freeswitch/branches/jkr888/CDRLogger/trunk/pom.xml
   freeswitch/branches/jkr888/CDRLogger/trunk/sample.xml
   freeswitch/branches/jkr888/CDRLogger/trunk/src/
   freeswitch/branches/jkr888/CDRLogger/trunk/src/main/
   freeswitch/branches/jkr888/CDRLogger/trunk/src/main/java/
   freeswitch/branches/jkr888/CDRLogger/trunk/src/main/java/com/
   freeswitch/branches/jkr888/CDRLogger/trunk/src/main/java/com/jkr/
   freeswitch/branches/jkr888/CDRLogger/trunk/src/main/java/com/jkr/freeswitch/
   freeswitch/branches/jkr888/CDRLogger/trunk/src/main/java/com/jkr/freeswitch/cdr/
   freeswitch/branches/jkr888/CDRLogger/trunk/src/main/java/com/jkr/freeswitch/cdr/logger/
   freeswitch/branches/jkr888/CDRLogger/trunk/src/main/java/com/jkr/freeswitch/cdr/logger/FreeswitchCDRLogger.java
   freeswitch/branches/jkr888/CDRLogger/trunk/src/main/java/com/jkr/freeswitch/cdr/logger/FreeswitchCDRSchema.java
   freeswitch/branches/jkr888/CDRLogger/trunk/src/main/java/com/jkr/freeswitch/cdr/model/
   freeswitch/branches/jkr888/CDRLogger/trunk/src/main/java/com/jkr/freeswitch/cdr/model/ConstructCDRSchema.java
   freeswitch/branches/jkr888/CDRLogger/trunk/src/main/java/com/jkr/freeswitch/cdr/model/FreeswitchCDR.hbm.xml
   freeswitch/branches/jkr888/CDRLogger/trunk/src/main/java/com/jkr/freeswitch/cdr/model/FreeswitchCDR.java
   freeswitch/branches/jkr888/CDRLogger/trunk/src/main/java/com/jkr/freeswitch/cdr/model/FreeswitchCDRData.hbm.xml
   freeswitch/branches/jkr888/CDRLogger/trunk/src/main/java/com/jkr/freeswitch/cdr/model/FreeswitchCDRData.java
   freeswitch/branches/jkr888/CDRLogger/trunk/src/main/java/com/jkr/freeswitch/cdr/model/HibernateUtil.java
   freeswitch/branches/jkr888/CDRLogger/trunk/src/main/java/hibernate.cfg.xml
   freeswitch/branches/jkr888/CDRLogger/trunk/src/main/java/log4j.properties
   freeswitch/branches/jkr888/CDRLogger/trunk/src/main/java/webapp/
   freeswitch/branches/jkr888/CDRLogger/trunk/src/main/resources/
   freeswitch/branches/jkr888/CDRLogger/trunk/src/main/webapp/
   freeswitch/branches/jkr888/CDRLogger/trunk/src/main/webapp/WEB-INF/
   freeswitch/branches/jkr888/CDRLogger/trunk/src/main/webapp/WEB-INF/web.xml
   freeswitch/branches/jkr888/CDRLogger/trunk/src/test/
   freeswitch/branches/jkr888/CDRLogger/trunk/src/test/java/
   freeswitch/branches/jkr888/CDRLogger/trunk/src/test/resources/

Log:


Added: freeswitch/branches/jkr888/CDRLogger/trunk/.classpath
==============================================================================
--- (empty file)
+++ freeswitch/branches/jkr888/CDRLogger/trunk/.classpath	Fri Oct 17 20:30:23 2008
@@ -0,0 +1,31 @@
+<classpath>
+  <classpathentry kind="src" path="src/main/java"/>
+  <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
+  <classpathentry kind="src" path="src/test/java" output="target/test-classes"/>
+  <classpathentry kind="src" path="src/test/resources" output="target/test-classes" excluding="**/*.java"/>
+  <classpathentry kind="output" path="target/classes"/>
+  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+  <classpathentry kind="var" path="M2_REPO/antlr/antlr/2.7.6/antlr-2.7.6.jar"/>
+  <classpathentry kind="var" path="M2_REPO/asm/asm/1.5.3/asm-1.5.3.jar"/>
+  <classpathentry kind="var" path="M2_REPO/asm/asm-attrs/1.5.3/asm-attrs-1.5.3.jar"/>
+  <classpathentry kind="var" path="M2_REPO/cglib/cglib/2.1_3/cglib-2.1_3.jar"/>
+  <classpathentry kind="var" path="M2_REPO/commons-collections/commons-collections/3.1/commons-collections-3.1.jar"/>
+  <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar"/>
+  <classpathentry kind="var" path="M2_REPO/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar"/>
+  <classpathentry kind="var" path="M2_REPO/net/sf/ehcache/ehcache/1.2.3/ehcache-1.2.3.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/hibernate/ejb3-persistence/1.0.1.GA/ejb3-persistence-1.0.1.GA.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate/3.2.6.ga/hibernate-3.2.6.ga-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate/3.2.6.ga/hibernate-3.2.6.ga.jar" sourcepath="M2_REPO/org/hibernate/hibernate/3.2.6.ga/hibernate-3.2.6.ga-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-annotations/3.3.1.GA/hibernate-annotations-3.3.1.GA.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-commons-annotations/3.0.0.ga/hibernate-commons-annotations-3.0.0.ga.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/jdom/jdom/1.1/jdom-1.1.jar"/>
+  <classpathentry kind="var" path="M2_REPO/javax/transaction/jta/1.0.1B/jta-1.0.1B.jar"/>
+  <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
+  <classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14.jar"/>
+  <classpathentry kind="var" path="M2_REPO/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar"/>
+  <classpathentry kind="var" path="M2_REPO/postgresql/postgresql/8.3-603.jdbc3/postgresql-8.3-603.jdbc3.jar"/>
+  <classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-api/1.5.3/slf4j-api-1.5.3.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-log4j12/1.4.3/slf4j-log4j12-1.4.3.jar"/>
+  <classpathentry kind="var" path="M2_REPO/xerces/xercesImpl/2.2.1/xercesImpl-2.2.1.jar"/>
+</classpath>
\ No newline at end of file

Added: freeswitch/branches/jkr888/CDRLogger/trunk/.project
==============================================================================
--- (empty file)
+++ freeswitch/branches/jkr888/CDRLogger/trunk/.project	Fri Oct 17 20:30:23 2008
@@ -0,0 +1,17 @@
+<projectDescription>
+  <name>cdr-logger</name>
+  <comment></comment>
+  <projects/>
+  <buildSpec>
+    <buildCommand>
+      <name>org.eclipse.jdt.core.javabuilder</name>
+    </buildCommand>
+    <buildCommand>
+      <name>org.maven.ide.eclipse.maven2Builder</name>
+    </buildCommand>
+  </buildSpec>
+  <natures>
+    <nature>org.eclipse.jdt.core.javanature</nature>
+    <nature>org.maven.ide.eclipse.maven2Nature</nature>
+  </natures>
+</projectDescription>
\ No newline at end of file

Added: freeswitch/branches/jkr888/CDRLogger/trunk/.settings/org.eclipse.jdt.core.prefs
==============================================================================
--- (empty file)
+++ freeswitch/branches/jkr888/CDRLogger/trunk/.settings/org.eclipse.jdt.core.prefs	Fri Oct 17 20:30:23 2008
@@ -0,0 +1,5 @@
+#Wed Oct 01 21:11:48 EDT 2008
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5

Added: freeswitch/branches/jkr888/CDRLogger/trunk/.settings/org.maven.ide.eclipse.prefs
==============================================================================
--- (empty file)
+++ freeswitch/branches/jkr888/CDRLogger/trunk/.settings/org.maven.ide.eclipse.prefs	Fri Oct 17 20:30:23 2008
@@ -0,0 +1,8 @@
+#Mon Sep 29 12:50:26 EDT 2008
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+version=1

Added: freeswitch/branches/jkr888/CDRLogger/trunk/pom.xml
==============================================================================
--- (empty file)
+++ freeswitch/branches/jkr888/CDRLogger/trunk/pom.xml	Fri Oct 17 20:30:23 2008
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>com.jkr.freeswitch</groupId>
+  <artifactId>cdr-logger</artifactId>
+  <packaging>war</packaging>
+  <name/>
+  <version>1.0</version>
+  <description/>
+	<repositories>
+		<repository>
+			<id>jboss</id>
+			<url>http://repository.jboss.org/maven2
+			</url>
+		</repository>
+	</repositories>
+	<dependencies>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>3.8.1</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>commons-collections</groupId>
+			<artifactId>commons-collections</artifactId>
+			<version>3.1</version>
+		</dependency>
+		<dependency>
+			<groupId>org.hibernate</groupId>
+			<artifactId>hibernate</artifactId>
+			<version>3.2.6.ga</version>
+			<scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.hibernate</groupId>
+			<artifactId>hibernate</artifactId>
+			<version>3.2.6.ga</version>
+			<scope>compile</scope>
+			<classifier>sources</classifier>
+		</dependency>
+		<dependency>
+			<groupId>org.hibernate</groupId>
+			<artifactId>hibernate-annotations</artifactId>
+			<version>3.3.1.GA</version>
+		</dependency>
+		<dependency>
+			<groupId>javax.persistence</groupId>
+			<artifactId>persistence-api</artifactId>
+			<version>1.0</version>
+		</dependency>
+		<dependency>
+			<groupId>postgresql</groupId>
+			<artifactId>postgresql</artifactId>
+			<version>8.3-603.jdbc3</version>
+			<scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>javax.transaction</groupId>
+			<artifactId>jta</artifactId>
+			<version>1.0.1B</version>
+			<scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>log4j</groupId>
+			<artifactId>log4j</artifactId>
+			<version>1.2.14</version>
+			<scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>jdom</groupId>
+			<artifactId>jdom</artifactId>
+			<version>1.1</version>
+			<scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>javax.servlet</groupId>
+			<artifactId>servlet-api</artifactId>
+			<version>2.5</version>
+			<scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>slf4j-api</artifactId>
+			<version>1.5.3</version>
+			<scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>slf4j-log4j12</artifactId>
+			<version>1.4.3</version>
+			<scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>xerces</groupId>
+			<artifactId>xercesImpl</artifactId>
+			<version>2.2.1</version>
+			<scope>compile</scope>
+		</dependency>
+		
+		
+	</dependencies>
+	<build>
+		<plugins>
+			<plugin>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<configuration>
+					<source>1.5</source>
+					<target>1.5</target>
+				</configuration>
+			</plugin>
+ 
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-war-plugin</artifactId>
+				<!--  <version>2.1-alpha-2</version>    -->
+				<configuration>
+					<webResources>
+						<resource>
+							<directory>src/main/java</directory>
+							<targetPath>WEB-INF/classes</targetPath>
+							<includes>
+								<include>*.properties</include>
+								<include>*.xml</include>
+								<include>**/*.hbm.xml</include>
+							</includes>
+						</resource>
+					</webResources>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>  
+</project>
\ No newline at end of file

Added: freeswitch/branches/jkr888/CDRLogger/trunk/sample.xml
==============================================================================
--- (empty file)
+++ freeswitch/branches/jkr888/CDRLogger/trunk/sample.xml	Fri Oct 17 20:30:23 2008
@@ -0,0 +1,151 @@
+<cdr>
+  <variables>
+    <sip_received_ip>192.168.150.161</sip_received_ip>
+    <sip_received_port>5060</sip_received_port>
+    <sip_authorized>true</sip_authorized>
+    <sip_mailbox>1000</sip_mailbox>
+    <sip_auth_username>1000</sip_auth_username>
+    <sip_auth_realm>192.168.150.134</sip_auth_realm>
+    <mailbox>1000</mailbox>
+    <record_stereo>true</record_stereo>
+    <accountcode>1000</accountcode>
+    <user_context>default</user_context>
+    <sip_from_user>1000</sip_from_user>
+    <sip_from_uri>1000%40192.168.150.134</sip_from_uri>
+    <sip_from_host>192.168.150.134</sip_from_host>
+    <sip_from_user_stripped>1000</sip_from_user_stripped>
+    <sip_from_tag>001e4a349d2c09e6483c5703-61e28258</sip_from_tag>
+    <sofia_profile_name>internal</sofia_profile_name>
+    <sofia_profile_domain_name>192.168.150.134</sofia_profile_domain_name>
+    <sip_req_user>912123794971</sip_req_user>
+    <sip_req_uri>912123794971%40192.168.150.134</sip_req_uri>
+    <sip_req_host>192.168.150.134</sip_req_host>
+    <sip_to_user>912123794971</sip_to_user>
+    <sip_to_uri>912123794971%40192.168.150.134</sip_to_uri>
+    <sip_to_host>192.168.150.134</sip_to_host>
+    <sip_contact_params>transport%3Dudp</sip_contact_params>
+    <sip_contact_user>1000</sip_contact_user>
+    <sip_contact_port>5060</sip_contact_port>
+    <sip_contact_uri>1000%40192.168.150.161%3A5060</sip_contact_uri>
+    <sip_contact_host>192.168.150.161</sip_contact_host>
+    <channel_name>sofia/internal/1000%40192.168.150.134</channel_name>
+    <sip_call_id>001e4a34-9d2c006c-422507ed-1e352484%40192.168.150.161</sip_call_id>
+    <sip_via_host>192.168.150.161</sip_via_host>
+    <sip_via_port>5060</sip_via_port>
+    <sip_via_rport>5060</sip_via_rport>
+    <max_forwards>70</max_forwards>
+    <presence_id>1000%40192.168.150.134</presence_id>
+    <remote_media_ip>192.168.150.161</remote_media_ip>
+    <remote_media_port>17482</remote_media_port>
+    <write_codec>PCMU</write_codec>
+    <write_rate>8000</write_rate>
+    <open>true</open>
+    <use_profile>nat</use_profile>
+    <numbering_plan>US</numbering_plan>
+    <default_gateway>asterlink.com</default_gateway>
+    <default_area_code>918</default_area_code>
+    <user_name>default</user_name>
+    <domain_name>192.168.150.134</domain_name>
+    <local_media_ip>192.168.150.134</local_media_ip>
+    <local_media_port>17482</local_media_port>
+    <sip_nat_detected>true</sip_nat_detected>
+    <endpoint_disposition>ANSWER</endpoint_disposition>
+    <effective_caller_id_name>SWN%20Office</effective_caller_id_name>
+    <switch_m_sdp>v%3D0%0D%0Ao%3DLATVOCMSX02%207404%2024425%20IN%20IP4%20192.168.36.30%0D%0As%3Dsip%20call%0D%0Ac%3DIN%20IP4%20192.168.36.40%0D%0At%3D0%200%0D%0Am%3Daudio%2041734%20RTP/AVP%200%20101%0D%0Aa%3Drtpmap%3A0%20PCMU/8000%0D%0Aa%3Drtpmap%3A101%20telephone-event/8000%0D%0Aa%3Dfmtp%3A101%200-15%0D%0Aa%3Dmaxptime%3A20%0D%0A</switch_m_sdp>
+    <originate_disposition>SUCCESS</originate_disposition>
+    <read_codec>PCMU</read_codec>
+    <read_rate>8000</read_rate>
+    <bridge_channel>sofia/internal/12123794971%40192.168.36.30%3A5060</bridge_channel>
+    <bridge_uuid>4c09e290-8f19-11dd-8395-05986565905d</bridge_uuid>
+    <signal_bond>4c09e290-8f19-11dd-8395-05986565905d</signal_bond>
+    <switch_r_sdp>v%3D0%0D%0Ao%3DCisco-SIPUA%20446%201%20IN%20IP4%20192.168.150.161%0D%0As%3DSIP%20Call%0D%0At%3D0%200%0D%0Am%3Daudio%2017482%20RTP/AVP%200%20101%0D%0Ac%3DIN%20IP4%20192.168.150.161%0D%0Aa%3Drtpmap%3A0%20PCMU/8000%0D%0Aa%3Drtpmap%3A101%20telephone-event/8000%0D%0Aa%3Dfmtp%3A101%200-15%0D%0A</switch_r_sdp>
+    <sip_user_agent>Cisco-CP7960G/8.0</sip_user_agent>
+    <sip_term_status>200</sip_term_status>
+    <sip_term_cause>16</sip_term_cause>
+    <hangup_cause>NORMAL_CLEARING</hangup_cause>
+    <start_stamp>2008-09-30%2013%3A57%3A24</start_stamp>
+    <profile_start_stamp>2008-09-30%2013%3A57%3A24</profile_start_stamp>
+    <answer_stamp>2008-09-30%2013%3A57%3A24</answer_stamp>
+    <end_stamp>2008-09-30%2013%3A58%3A44</end_stamp>
+    <start_epoch>1222797444</start_epoch>
+    <start_uepoch>1222797444308052</start_uepoch>
+    <profile_start_epoch>1222797444</profile_start_epoch>
+    <profile_start_uepoch>1222797444308052</profile_start_uepoch>
+    <answer_epoch>1222797444</answer_epoch>
+    <answer_uepoch>1222797444536656</answer_uepoch>
+    <end_epoch>1222797524</end_epoch>
+    <end_uepoch>1222797524597844</end_uepoch>
+    <last_app>bridge</last_app>
+    <last_arg>sofia/default/12123794971%40192.168.36.30%3A5060</last_arg>
+    <caller_id>%221000%22%20%3C1000%3E</caller_id>
+    <duration>80</duration>
+    <billsec>80</billsec>
+    <flow_billsec>80</flow_billsec>
+    <mduration>80289</mduration>
+    <billmsec>80061</billmsec>
+    <flow_billmsec>80289</flow_billmsec>
+    <uduration>80289792</uduration>
+    <billusec>80061188</billusec>
+    <flow_billusec>80289792</flow_billusec>
+  </variables>
+  <app_log>
+    <application app_name="set" app_data="open=true"></application>
+    <application app_name="set" app_data="use_profile=nat"></application>
+    <application app_name="set_user" app_data="default at 192.168.150.134"></application>
+    <application app_name="db" app_data="insert/spymap/1000/3c81e9ee-8f19-11dd-8395-05986565905d"></application>
+    <application app_name="db" app_data="insert/last_dial/1000/912123794971"></application>
+    <application app_name="db" app_data="insert/last_dial/global/3c81e9ee-8f19-11dd-8395-05986565905d"></application>
+    <application app_name="javascript" app_data="cidspoof.js 12123794971"></application>
+    <application app_name="bridge" app_data="sofia/default/12123794971 at 192.168.36.30:5060"></application>
+  </app_log>
+  <callflow dialplan="XML" profile_index="1">
+    <extension name="tod_example" number="912123794971">
+      <application app_name="set" app_data="open=true"></application>
+      <application app_name="set" app_data="use_profile=${cond(${acl(${network_addr} rfc1918)} == true ? nat : default)}"></application>
+      <application app_name="set_user" app_data="default@${domain}"></application>
+      <application app_name="db" app_data="insert/spymap/${caller_id_number}/${uuid}"></application>
+      <application app_name="db" app_data="insert/last_dial/${caller_id_number}/${destination_number}"></application>
+      <application app_name="db" app_data="insert/last_dial/global/${uuid}"></application>
+      <application app_name="javascript" app_data="cidspoof.js"></application>
+    </extension>
+    <caller_profile>
+      <username>1000</username>
+      <dialplan>XML</dialplan>
+      <caller_id_name>1000</caller_id_name>
+      <ani></ani>
+      <aniii></aniii>
+      <caller_id_number>1000</caller_id_number>
+      <network_addr>192.168.150.161</network_addr>
+      <rdnis></rdnis>
+      <destination_number>912123794971</destination_number>
+      <uuid>3c81e9ee-8f19-11dd-8395-05986565905d</uuid>
+      <source>mod_sofia</source>
+      <context>default</context>
+      <chan_name>sofia/internal/1000 at 192.168.150.134</chan_name>
+      <originatee>
+        <originatee_caller_profile>
+          <username>1000</username>
+          <dialplan>XML</dialplan>
+          <caller_id_name>SWN Office</caller_id_name>
+          <ani></ani>
+          <aniii></aniii>
+          <caller_id_number>1000</caller_id_number>
+          <network_addr>192.168.150.161</network_addr>
+          <rdnis></rdnis>
+          <destination_number>12123794971 at 192.168.36.30:5060</destination_number>
+          <uuid>4c09e290-8f19-11dd-8395-05986565905d</uuid>
+          <source>mod_sofia</source>
+          <context>default</context>
+          <chan_name>sofia/internal/12123794971 at 192.168.36.30:5060</chan_name>
+        </originatee_caller_profile>
+      </originatee>
+    </caller_profile>
+    <times>
+      <created_time>1222797444308052</created_time>
+      <profile_created_time>1222797444308052</profile_created_time>
+      <answered_time>1222797444536656</answered_time>
+      <hangup_time>1222797524597844</hangup_time>
+      <transfer_time>0</transfer_time>
+    </times>
+  </callflow>
+</cdr>

Added: freeswitch/branches/jkr888/CDRLogger/trunk/src/main/java/com/jkr/freeswitch/cdr/logger/FreeswitchCDRLogger.java
==============================================================================
--- (empty file)
+++ freeswitch/branches/jkr888/CDRLogger/trunk/src/main/java/com/jkr/freeswitch/cdr/logger/FreeswitchCDRLogger.java	Fri Oct 17 20:30:23 2008
@@ -0,0 +1,272 @@
+package com.jkr.freeswitch.cdr.logger;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.List;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.hibernate.Session;
+import org.jdom.Document;
+import org.jdom.Element;
+import org.jdom.JDOMException;
+import org.jdom.input.SAXBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.jkr.freeswitch.cdr.model.FreeswitchCDR;
+import com.jkr.freeswitch.cdr.model.FreeswitchCDRData;
+import com.jkr.freeswitch.cdr.model.HibernateUtil;
+
+public class FreeswitchCDRLogger extends HttpServlet {
+
+    private final Logger logger = LoggerFactory.getLogger(getClass());
+    private boolean storeXML;
+    private String custom_tag_1;
+    private String custom_tag_2;
+    private String custom_tag_3;
+    private String custom_tag_4;
+    private String custom_tag_5;
+    private String custom_tag_6;
+    private String custom_tag_7;
+    private String custom_tag_8;
+    private String custom_tag_9;
+    private SAXBuilder saxBuilder;
+    private FreeswitchCDR cdrRecord;
+    private Session session;
+	
+	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
+			throws ServletException, IOException {
+		
+		String cdrXML = req.getParameter("cdr");
+		logger.debug("GET XML = "+cdrXML);
+		if (cdrXML != null)
+			XMLtoModel(cdrXML);
+		sendResponse(resp);
+	}
+
+	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
+			throws ServletException, IOException {
+
+		String cdrXML = req.getParameter("cdr");
+		logger.debug("POST XML = "+cdrXML);
+		if (cdrXML != null)
+			XMLtoModel(cdrXML);
+		sendResponse(resp);
+	}
+
+	private void XMLtoModel(String cdrXML) {
+		session = HibernateUtil.getSessionFactory().getCurrentSession();
+        session.beginTransaction();
+		
+        cdrRecord = new FreeswitchCDR();
+
+        if (storeXML) 
+        	cdrRecord.setXml_data(cdrXML);
+        
+        session.save(cdrRecord);
+        
+		try {
+			Reader stringReader = new StringReader(cdrXML);
+			Document doc = saxBuilder.build(stringReader);
+
+			// work on the category elements
+			Element root = doc.getRootElement();
+			List categories = root.getChildren();
+			for (int i = 0; i < categories.size(); i++) {
+				Element category = (Element)categories.get(i);
+				String categoryName = category.getName();
+				
+				// invoke special xml schema handler 
+				if (categoryName.equalsIgnoreCase("app_log")) {
+					
+					logger.debug("Parsing app_log.");
+					traverseChildrenAttr(categoryName, category);
+					
+				} 
+				else if (categoryName.equalsIgnoreCase("callflow")) {
+					
+					logger.debug("Parsing callflow.");
+					List subCategories = category.getChildren();
+					for (int j = 0; j < subCategories.size(); j++) {
+						Element subCategory = (Element)subCategories.get(j);
+						String subCategoryName = subCategory.getName();
+
+						if (subCategoryName.equalsIgnoreCase("extension"))
+							
+							traverseChildrenAttr(categoryName+"."+subCategoryName, subCategory);
+						
+						else if (subCategoryName.equalsIgnoreCase("caller_profile"))
+							
+							traverseChildren(categoryName+"."+subCategoryName, subCategory);
+						
+						else  if (subCategoryName.equalsIgnoreCase("times"))
+							
+							traverseChildren(categoryName+"."+subCategoryName, subCategory);
+							
+					}
+				}   
+				else if (categoryName.equalsIgnoreCase("variables"))
+					
+					traverseChildren(categoryName, category);
+
+				else
+					
+					logger.debug("Warning. Unrecognized category = " + categoryName);
+			}
+
+			session.getTransaction().commit();
+
+		} catch (JDOMException e) {
+			e.printStackTrace();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		
+	}
+	
+	private void traverseChildren(String categoryName, Element parent) {
+		List parms = parent.getChildren();
+		for (int j = 0; j < parms.size(); j++) {
+			Element field = (Element)parms.get(j);
+			String fieldName = field.getName();
+			String fieldValue = "";
+			try {
+				fieldValue = URLDecoder.decode(field.getValue(), "UTF8");
+			} catch (UnsupportedEncodingException e) {
+				e.printStackTrace();
+			}
+			logger.debug(categoryName+","+fieldName+","+fieldValue);
+			saveToDB(categoryName, fieldName, fieldValue);
+		}
+	}
+	
+	private void traverseChildrenAttr(String categoryName, Element parent) {
+		List parms = parent.getChildren();
+		for (int j = 0; j < parms.size(); j++) {
+			Element field = (Element)parms.get(j);
+			String appName = field.getAttributeValue("app_name");
+			String appData = "";
+			try {
+				appData = URLDecoder.decode(field.getAttributeValue("app_data"), "UTF8");
+			} catch (UnsupportedEncodingException e) {
+				e.printStackTrace();
+			}
+			logger.debug(categoryName+","+appName+","+appData);
+			saveToDB(categoryName, appName, appData);
+		}
+	}
+	
+	private void saveToDB(String category, String field, String value) {
+	    FreeswitchCDRData cdrData = new FreeswitchCDRData();
+	    cdrData.setCategory(category);
+	    cdrData.setName(field);
+	    cdrData.setValue(value);
+	    cdrData.setCdr(cdrRecord);
+	    session.save(cdrData);
+	    
+	    // move field to main record
+	    if (field.equalsIgnoreCase("start_stamp")) 
+	    	cdrRecord.setStart_stamp(value);
+	    
+	    else if (field.equalsIgnoreCase("answer_stamp")) 
+	    	cdrRecord.setAnswer_stamp(value);
+
+	    else if (field.equalsIgnoreCase("end_stamp")) 
+	    	cdrRecord.setEnd_stamp(value);
+	    
+	    else if (field.equalsIgnoreCase("profile_start_stamp")) 
+	    	cdrRecord.setProfile_start_stamp(value);
+	    
+	    else if (field.equalsIgnoreCase("answered_time")) 
+	    	cdrRecord.setAnswered_time(value);
+	    
+	    else if (field.equalsIgnoreCase("hangup_time")) 
+	    	cdrRecord.setHangup_time(value);
+
+	    else if (field.equalsIgnoreCase("created_time")) 
+	    	cdrRecord.setCreated_time(value);
+	    
+	    else if (field.equalsIgnoreCase("billsec")) 
+	    	cdrRecord.setBillsec(Integer.parseInt(value));
+	    
+	    else if (field.equalsIgnoreCase("billmsec")) 
+	    	cdrRecord.setBillmsec(Integer.parseInt(value));
+
+	    else if (field.equalsIgnoreCase("billusec")) 
+	    	cdrRecord.setBillusec(Integer.parseInt(value));
+
+	    else if (field.equalsIgnoreCase("duration")) 
+	    	cdrRecord.setTotal_duration_sec(Integer.parseInt(value));
+
+	    else if (field.equalsIgnoreCase("mduration")) 
+	    	cdrRecord.setTotal_duration_msec(Integer.parseInt(value));
+
+	    else if (field.equalsIgnoreCase("sip_from_uri")) 
+	    	cdrRecord.setSip_from_uri(value);
+
+	    else if (field.equalsIgnoreCase("sip_to_uri")) 
+	    	cdrRecord.setSip_to_uri(value);
+
+	    else if (field.equalsIgnoreCase("sip_call_id")) 
+	    	cdrRecord.setSip_call_id(value);
+	    
+	    else if (this.custom_tag_1.length()>0 && field.equalsIgnoreCase(this.custom_tag_1)) 
+	    	cdrRecord.setCustom_tag_1(value);
+	    
+	    else if (this.custom_tag_2.length()>0 && field.equalsIgnoreCase(this.custom_tag_2)) 
+	    	cdrRecord.setCustom_tag_2(value);
+
+	    else if (this.custom_tag_3.length()>0 && field.equalsIgnoreCase(this.custom_tag_3)) 
+	    	cdrRecord.setCustom_tag_3(value);
+
+	    else if (this.custom_tag_4.length()>0 && field.equalsIgnoreCase(this.custom_tag_4)) 
+	    	cdrRecord.setCustom_tag_4(value);
+
+	    else if (this.custom_tag_5.length()>0 && field.equalsIgnoreCase(this.custom_tag_5)) 
+	    	cdrRecord.setCustom_tag_5(value);
+
+	    else if (this.custom_tag_6.length()>0 && field.equalsIgnoreCase(this.custom_tag_6)) 
+	    	cdrRecord.setCustom_tag_6(value);
+
+	    else if (this.custom_tag_7.length()>0 && field.equalsIgnoreCase(this.custom_tag_7)) 
+	    	cdrRecord.setCustom_tag_7(value);
+
+	    else if (this.custom_tag_8.length()>0 && field.equalsIgnoreCase(this.custom_tag_8)) 
+	    	cdrRecord.setCustom_tag_8(value);
+
+	    else if (this.custom_tag_9.length()>0 && field.equalsIgnoreCase(this.custom_tag_9)) 
+	    	cdrRecord.setCustom_tag_9(value);
+	    
+	}
+	
+	private void sendResponse(HttpServletResponse resp) throws IOException {
+		PrintWriter out = resp.getWriter();
+		out.println("CDR recorded.");
+	}
+
+	public void init() throws ServletException {
+		// get initial configuration
+		this.storeXML = (getServletConfig().getInitParameter("StoreRawXML").equalsIgnoreCase("true") ? true : false);
+		this.custom_tag_1 = getServletConfig().getInitParameter("custom_tag_1");
+		this.custom_tag_2 = getServletConfig().getInitParameter("custom_tag_2");
+		this.custom_tag_3 = getServletConfig().getInitParameter("custom_tag_3");
+		this.custom_tag_4 = getServletConfig().getInitParameter("custom_tag_4");
+		this.custom_tag_5 = getServletConfig().getInitParameter("custom_tag_5");
+		this.custom_tag_6 = getServletConfig().getInitParameter("custom_tag_6");
+		this.custom_tag_7 = getServletConfig().getInitParameter("custom_tag_7");
+		this.custom_tag_8 = getServletConfig().getInitParameter("custom_tag_8");
+		this.custom_tag_9 = getServletConfig().getInitParameter("custom_tag_9");
+		saxBuilder = new SAXBuilder("org.apache.xerces.parsers.SAXParser");
+		
+		super.init();
+	};
+
+}

Added: freeswitch/branches/jkr888/CDRLogger/trunk/src/main/java/com/jkr/freeswitch/cdr/logger/FreeswitchCDRSchema.java
==============================================================================
--- (empty file)
+++ freeswitch/branches/jkr888/CDRLogger/trunk/src/main/java/com/jkr/freeswitch/cdr/logger/FreeswitchCDRSchema.java	Fri Oct 17 20:30:23 2008
@@ -0,0 +1,56 @@
+package com.jkr.freeswitch.cdr.logger;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jdom.input.SAXBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.jkr.freeswitch.cdr.model.ConstructCDRSchema;
+
+public class FreeswitchCDRSchema extends HttpServlet {
+
+    private final Logger logger = LoggerFactory.getLogger(getClass());
+    private boolean allowSchemaGenerator = false;
+    
+	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
+		throws ServletException, IOException {
+
+		String type = req.getParameter("type");
+		if (type == null) 
+			type = "null";
+		
+		logger.debug("Schema operation = "+type);
+		
+		if (type.equalsIgnoreCase("insert")) {
+			new ConstructCDRSchema().insertSampleData();
+			sendResponse(resp, "New sample row was inserted. Check it out!!");
+		}
+		else if (type.equalsIgnoreCase("create") && (this.allowSchemaGenerator)) {
+			new ConstructCDRSchema().create();
+			sendResponse(resp, "New database schema was generated. Check it out!!");
+		}
+		else 
+			sendResponse(resp, "Unrecognized '"+type+"' operation type. Type should be 'insert' or 'create'.");
+		
+	}
+
+	private void sendResponse(HttpServletResponse resp, String text) throws IOException {
+		PrintWriter out = resp.getWriter();
+		out.println(text);
+	}
+
+	public void init() throws ServletException {
+		// get initial configuration
+		this.allowSchemaGenerator = (getServletConfig().getInitParameter("allowShemaGenerator").equalsIgnoreCase("true") ? true : false);
+		
+		super.init();
+	};
+	
+}

Added: freeswitch/branches/jkr888/CDRLogger/trunk/src/main/java/com/jkr/freeswitch/cdr/model/ConstructCDRSchema.java
==============================================================================
--- (empty file)
+++ freeswitch/branches/jkr888/CDRLogger/trunk/src/main/java/com/jkr/freeswitch/cdr/model/ConstructCDRSchema.java	Fri Oct 17 20:30:23 2008
@@ -0,0 +1,41 @@
+package com.jkr.freeswitch.cdr.model;
+
+import org.hibernate.Session;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.tool.hbm2ddl.SchemaExport;
+
+public class ConstructCDRSchema {
+
+	public void create() {
+        Configuration config = new Configuration().configure();
+        new SchemaExport(config).create(true, true);
+	}
+	
+	public void insertSampleData() {
+		Session session = HibernateUtil.getSessionFactory().getCurrentSession();
+
+		session.beginTransaction();
+
+		FreeswitchCDR event = new FreeswitchCDR();
+		event.setStart_stamp("Start time");
+
+		session.save(event);
+
+		FreeswitchCDRData cdrData = new FreeswitchCDRData();
+		cdrData.setCategory("Test Category");
+		cdrData.setName("test");
+		cdrData.setValue("value");
+		event.addCDRData(cdrData);
+
+		session.save(cdrData);
+
+		session.getTransaction().commit();
+
+	}
+	
+	public static void main(String[] args) {
+
+		new ConstructCDRSchema().create();
+
+	}
+}

Added: freeswitch/branches/jkr888/CDRLogger/trunk/src/main/java/com/jkr/freeswitch/cdr/model/FreeswitchCDR.hbm.xml
==============================================================================
--- (empty file)
+++ freeswitch/branches/jkr888/CDRLogger/trunk/src/main/java/com/jkr/freeswitch/cdr/model/FreeswitchCDR.hbm.xml	Fri Oct 17 20:30:23 2008
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+        "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="com.jkr.freeswitch.cdr.model">
+
+    <class name="FreeswitchCDR" table="FREESWITCH_CDRS">
+        <id name="id">
+            <generator class="increment"/>
+        </id>
+
+        <property name="start_stamp" length="32"/>
+        <property name="answer_stamp" length="32"/>
+        <property name="end_stamp" length="32"/>
+        <property name="profile_start_stamp" length="32"/>
+        <property name="answered_time" length="32"/>
+        <property name="hangup_time" length="32"/>
+        <property name="created_time" length="32"/>
+	
+        <property name="billsec"/>
+	    <property name="billmsec"/>
+        <property name="billusec"/>
+        <property name="total_duration_sec"/>
+        <property name="total_duration_msec"/>
+	
+        <property name="sip_from_uri" length="64"/>
+        <property name="sip_to_uri" length="64"/>
+        <property name="sip_call_id" length="64"/>
+
+        <property name="custom_tag_1" type="text"/>
+        <property name="custom_tag_2" type="text"/>
+        <property name="custom_tag_3" type="text"/>
+        <property name="custom_tag_4" type="text"/>
+        <property name="custom_tag_5" type="text"/>
+        <property name="custom_tag_6" type="text"/>
+        <property name="custom_tag_7" type="text"/>
+        <property name="custom_tag_8" type="text"/>
+        <property name="custom_tag_9" type="text"/>
+
+        <property name="xml_data" type="text"/>
+        
+        <set name="cdr_data" inverse="true">
+        	<key column="cdr_id"/>
+        	<one-to-many class="FreeswitchCDRData"/>
+        </set>
+		
+    </class>
+
+</hibernate-mapping>
\ No newline at end of file

Added: freeswitch/branches/jkr888/CDRLogger/trunk/src/main/java/com/jkr/freeswitch/cdr/model/FreeswitchCDR.java
==============================================================================
--- (empty file)
+++ freeswitch/branches/jkr888/CDRLogger/trunk/src/main/java/com/jkr/freeswitch/cdr/model/FreeswitchCDR.java	Fri Oct 17 20:30:23 2008
@@ -0,0 +1,267 @@
+package com.jkr.freeswitch.cdr.model;
+
+import java.sql.Timestamp;
+import java.util.HashSet;
+import java.util.Set;
+
+public class FreeswitchCDR {
+
+	private Long id;
+	
+	private String start_stamp;
+	private String answer_stamp;
+	private String end_stamp;
+	private String profile_start_stamp;
+	private String answered_time;
+	private String hangup_time;
+	private String created_time;
+	
+	private int billsec;
+	private int billmsec;
+	private int billusec;
+	private int total_duration_sec;
+	private int total_duration_msec;
+	
+	private String sip_from_uri;
+	private String sip_to_uri;
+	private String sip_call_id;
+
+	private String custom_tag_1;
+	private String custom_tag_2;
+	private String custom_tag_3;
+	private String custom_tag_4;
+	private String custom_tag_5;
+	private String custom_tag_6;
+	private String custom_tag_7;
+	private String custom_tag_8;
+	private String custom_tag_9;
+	
+	private String xml_data;
+	
+	private Set cdr_data = new HashSet();
+ 
+	public FreeswitchCDR() {}
+
+	public void addCDRData(FreeswitchCDRData cdr) {
+		cdr.setCdr(this);
+		getCdr_data().add(cdr);
+	}
+	
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public String getStart_stamp() {
+		return start_stamp;
+	}
+
+	public void setStart_stamp(String start_stamp) {
+		this.start_stamp = start_stamp;
+	}
+
+	public String getAnswer_stamp() {
+		return answer_stamp;
+	}
+
+	public void setAnswer_stamp(String answer_stamp) {
+		this.answer_stamp = answer_stamp;
+	}
+
+	public String getEnd_stamp() {
+		return end_stamp;
+	}
+
+	public void setEnd_stamp(String end_stamp) {
+		this.end_stamp = end_stamp;
+	}
+
+	public String getProfile_start_stamp() {
+		return profile_start_stamp;
+	}
+
+	public void setProfile_start_stamp(String profile_start_stamp) {
+		this.profile_start_stamp = profile_start_stamp;
+	}
+
+	public int getBillsec() {
+		return billsec;
+	}
+
+	public void setBillsec(int billsec) {
+		this.billsec = billsec;
+	}
+
+	public int getBillmsec() {
+		return billmsec;
+	}
+
+	public void setBillmsec(int billmsec) {
+		this.billmsec = billmsec;
+	}
+
+	public int getBillusec() {
+		return billusec;
+	}
+
+	public void setBillusec(int billusec) {
+		this.billusec = billusec;
+	}
+
+	public int getTotal_duration_sec() {
+		return total_duration_sec;
+	}
+
+	public void setTotal_duration_sec(int total_duration_sec) {
+		this.total_duration_sec = total_duration_sec;
+	}
+
+	public int getTotal_duration_msec() {
+		return total_duration_msec;
+	}
+
+	public void setTotal_duration_msec(int total_duration_msec) {
+		this.total_duration_msec = total_duration_msec;
+	}
+
+	public String getSip_from_uri() {
+		return sip_from_uri;
+	}
+
+	public void setSip_from_uri(String sip_from_uri) {
+		this.sip_from_uri = sip_from_uri;
+	}
+
+	public String getSip_to_uri() {
+		return sip_to_uri;
+	}
+
+	public void setSip_to_uri(String sip_to_uri) {
+		this.sip_to_uri = sip_to_uri;
+	}
+
+	public String getCustom_tag_1() {
+		return custom_tag_1;
+	}
+
+	public void setCustom_tag_1(String custom_tag_1) {
+		this.custom_tag_1 = custom_tag_1;
+	}
+
+	public String getCustom_tag_2() {
+		return custom_tag_2;
+	}
+
+	public void setCustom_tag_2(String custom_tag_2) {
+		this.custom_tag_2 = custom_tag_2;
+	}
+
+	public String getCustom_tag_3() {
+		return custom_tag_3;
+	}
+
+	public void setCustom_tag_3(String custom_tag_3) {
+		this.custom_tag_3 = custom_tag_3;
+	}
+
+	public String getCustom_tag_4() {
+		return custom_tag_4;
+	}
+
+	public void setCustom_tag_4(String custom_tag_4) {
+		this.custom_tag_4 = custom_tag_4;
+	}
+
+	public String getCustom_tag_5() {
+		return custom_tag_5;
+	}
+
+	public void setCustom_tag_5(String custom_tag_5) {
+		this.custom_tag_5 = custom_tag_5;
+	}
+
+	public String getCustom_tag_6() {
+		return custom_tag_6;
+	}
+
+	public void setCustom_tag_6(String custom_tag_6) {
+		this.custom_tag_6 = custom_tag_6;
+	}
+
+	public String getCustom_tag_7() {
+		return custom_tag_7;
+	}
+
+	public void setCustom_tag_7(String custom_tag_7) {
+		this.custom_tag_7 = custom_tag_7;
+	}
+
+	public String getCustom_tag_8() {
+		return custom_tag_8;
+	}
+
+	public void setCustom_tag_8(String custom_tag_8) {
+		this.custom_tag_8 = custom_tag_8;
+	}
+
+	public String getCustom_tag_9() {
+		return custom_tag_9;
+	}
+
+	public void setCustom_tag_9(String custom_tag_9) {
+		this.custom_tag_9 = custom_tag_9;
+	}
+
+	public Set getCdr_data() {
+		return cdr_data;
+	}
+
+	public void setCdr_data(Set cdr_data) {
+		this.cdr_data = cdr_data;
+	}
+
+	public String getSip_call_id() {
+		return sip_call_id;
+	}
+
+	public void setSip_call_id(String sip_call_id) {
+		this.sip_call_id = sip_call_id;
+	}
+
+	public String getXml_data() {
+		return xml_data;
+	}
+
+	public void setXml_data(String xml_data) {
+		this.xml_data = xml_data;
+	}
+
+	public String getAnswered_time() {
+		return answered_time;
+	}
+
+	public void setAnswered_time(String answered_time) {
+		this.answered_time = answered_time;
+	}
+
+	public String getHangup_time() {
+		return hangup_time;
+	}
+
+	public void setHangup_time(String hangup_time) {
+		this.hangup_time = hangup_time;
+	}
+
+	public String getCreated_time() {
+		return created_time;
+	}
+
+	public void setCreated_time(String created_time) {
+		this.created_time = created_time;
+	}
+
+	
+}

Added: freeswitch/branches/jkr888/CDRLogger/trunk/src/main/java/com/jkr/freeswitch/cdr/model/FreeswitchCDRData.hbm.xml
==============================================================================
--- (empty file)
+++ freeswitch/branches/jkr888/CDRLogger/trunk/src/main/java/com/jkr/freeswitch/cdr/model/FreeswitchCDRData.hbm.xml	Fri Oct 17 20:30:23 2008
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+        "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="com.jkr.freeswitch.cdr.model">
+
+    <class name="FreeswitchCDRData" table="FREESWITCH_CDR_DATA">
+        <id name="id">
+            <generator class="increment"/>
+        </id>
+        
+        <property name="category" length="64"/>
+        <property name="name" length="64"/>
+        <property name="value" type="text"/>
+        
+        <many-to-one name="cdr" 
+        	column="cdr_id"
+        	class="FreeswitchCDR"
+        	not-null="true"/>
+		
+    </class>
+
+</hibernate-mapping>
\ No newline at end of file

Added: freeswitch/branches/jkr888/CDRLogger/trunk/src/main/java/com/jkr/freeswitch/cdr/model/FreeswitchCDRData.java
==============================================================================
--- (empty file)
+++ freeswitch/branches/jkr888/CDRLogger/trunk/src/main/java/com/jkr/freeswitch/cdr/model/FreeswitchCDRData.java	Fri Oct 17 20:30:23 2008
@@ -0,0 +1,42 @@
+package com.jkr.freeswitch.cdr.model;
+
+public class FreeswitchCDRData {
+
+	private Long id;
+	private String category;
+	private String name;
+	private String value;
+	private FreeswitchCDR cdr;
+	
+	public Long getId() {
+		return id;
+	}
+	public void setId(Long id) {
+		this.id = id;
+	}
+	public FreeswitchCDR getCdr() {
+		return cdr;
+	}
+	public void setCdr(FreeswitchCDR cdr) {
+		this.cdr = cdr;
+	}
+	public String getCategory() {
+		return category;
+	}
+	public void setCategory(String category) {
+		this.category = category;
+	}
+	public String getName() {
+		return name;
+	}
+	public void setName(String name) {
+		this.name = name;
+	}
+	public String getValue() {
+		return value;
+	}
+	public void setValue(String value) {
+		this.value = value;
+	}
+	
+}

Added: freeswitch/branches/jkr888/CDRLogger/trunk/src/main/java/com/jkr/freeswitch/cdr/model/HibernateUtil.java
==============================================================================
--- (empty file)
+++ freeswitch/branches/jkr888/CDRLogger/trunk/src/main/java/com/jkr/freeswitch/cdr/model/HibernateUtil.java	Fri Oct 17 20:30:23 2008
@@ -0,0 +1,25 @@
+package com.jkr.freeswitch.cdr.model;
+
+import org.hibernate.*;
+import org.hibernate.cfg.*;
+
+public class HibernateUtil {
+
+    private static final SessionFactory sessionFactory;
+
+    static {
+        try {
+            // Create the SessionFactory from hibernate.cfg.xml
+            sessionFactory = new Configuration().configure().buildSessionFactory();
+        } catch (Throwable ex) {
+            // Make sure you log the exception, as it might be swallowed
+            System.err.println("Initial SessionFactory creation failed." + ex);
+            throw new ExceptionInInitializerError(ex);
+        }
+    }
+
+    public static SessionFactory getSessionFactory() {
+        return sessionFactory;
+    }
+
+}
\ No newline at end of file

Added: freeswitch/branches/jkr888/CDRLogger/trunk/src/main/java/hibernate.cfg.xml
==============================================================================
--- (empty file)
+++ freeswitch/branches/jkr888/CDRLogger/trunk/src/main/java/hibernate.cfg.xml	Fri Oct 17 20:30:23 2008
@@ -0,0 +1,33 @@
+<?xml version='1.0' encoding='utf-8'?>
+<!DOCTYPE hibernate-configuration PUBLIC
+        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
+<hibernate-configuration>
+
+	<session-factory>
+		<property name="connection.url">jdbc:postgresql://localhost/mydb</property>
+		<property name="connection.username">postgres</property>
+		<property name="connection.driver_class">org.postgresql.Driver</property>
+		<property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
+		<property name="connection.password">postgres</property>
+		<property name="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
+		<!--
+			thread is the short name for
+			org.hibernate.context.ThreadLocalSessionContext and let Hibernate
+			bind the session automatically to the thread
+		-->
+		<property name="current_session_context_class">thread</property>
+		
+    	<!-- this will show us all sql statements -->
+		<property name="hibernate.show_sql">true</property>
+		
+        <!-- Drop and re-create the database schema on startup 
+        <property name="hbm2ddl.auto">create</property>
+		-->
+		
+		<!-- mapping files -->
+		<mapping resource="com/jkr/freeswitch/cdr/model/FreeswitchCDR.hbm.xml" />
+		<mapping resource="com/jkr/freeswitch/cdr/model/FreeswitchCDRData.hbm.xml" />
+		
+	</session-factory>
+</hibernate-configuration>
\ No newline at end of file

Added: freeswitch/branches/jkr888/CDRLogger/trunk/src/main/java/log4j.properties
==============================================================================
--- (empty file)
+++ freeswitch/branches/jkr888/CDRLogger/trunk/src/main/java/log4j.properties	Fri Oct 17 20:30:23 2008
@@ -0,0 +1,43 @@
+# Set root logger level to DEBUG and its only appender to A1.
+#log4j.rootLogger=DEBUG, A1
+
+log4j.rootLogger=ERROR, A1
+#log4j.rootLogger=DEBUG, A1
+# A1 is set to be a ConsoleAppender.
+log4j.appender.A1=org.apache.log4j.ConsoleAppender
+log4j.appender.A1.layout=org.apache.log4j.PatternLayout
+log4j.appender.A1.layout.ConversionPattern=%d{HH:mm:ss,S} [%20.20t] %-5p %l %x - %m%n
+
+# detail application logging configuration
+# ========================================
+log4j.logger.com.jkr.freeswitch=DEBUG, R
+
+# R is set to be a RollingFileAppender
+log4j.appender.R=org.apache.log4j.RollingFileAppender
+log4j.appender.R.File=../../logs/cdr-logger.log
+log4j.appender.R.MaxFileSize=10MB
+log4j.appender.R.MaxBackupIndex=10
+log4j.appender.R.layout=org.apache.log4j.PatternLayout
+# log4j.appender.R.layout.ConversionPattern=%d{HH:mm:ss,S} [%20.20t] %-5p %c{1} %x - %m%n
+log4j.appender.R.layout.ConversionPattern=%d{HH:mm:ss,S} [%20.20t] %-5p %l %x - %m%n
+
+Log all SQL DML statements as they are executed
+org.hibernate.SQL = DEBUG	
+#Log all JDBC parameters
+#org.hibernate.type	
+#Log all SQL DDL statements as they are executed
+org.hibernate.tool.hbm2ddl = DEBUG
+#Log the state of all entities (max 20 entities) associated with the session at flush time	
+#org.hibernate.pretty
+#Log all second-level cache activity	
+#org.hibernate.cache	
+#Log transaction related activity
+#org.hibernate.transaction
+#Log all JDBC resource acquisition	
+#org.hibernate.jdbc	
+#Log HQL and SQL ASTs during query parsing
+#org.hibernate.hql.ast.AST
+#Log all JAAS authorization requests	
+#org.hibernate.secure	
+#Log everything (a lot of information, but very useful for troubleshooting) 
+#org.hibernate
\ No newline at end of file

Added: freeswitch/branches/jkr888/CDRLogger/trunk/src/main/webapp/WEB-INF/web.xml
==============================================================================
--- (empty file)
+++ freeswitch/branches/jkr888/CDRLogger/trunk/src/main/webapp/WEB-INF/web.xml	Fri Oct 17 20:30:23 2008
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	version="2.4"
+	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+	<description>Freeswitch CDR Logger</description>
+	<display-name>com.jkr.freeswitch.cdr.logger
+	</display-name>
+	<distributable />
+	<welcome-file-list>
+		<welcome-file>index.jsp</welcome-file>
+		<welcome-file>index.html</welcome-file>
+	</welcome-file-list>
+	<servlet>
+		<servlet-name>CDRLogger</servlet-name>
+		<servlet-class>com.jkr.freeswitch.cdr.logger.FreeswitchCDRLogger</servlet-class>
+		<!-- Log raw cdr XML -->
+		<init-param>
+			<param-name>StoreRawXML</param-name>
+			<param-value>false</param-value>
+		</init-param>
+		<init-param>
+			<param-name>custom_tag_1</param-name>
+			<param-value>caller_id_number</param-value>
+		</init-param>
+		<init-param>
+			<param-name>custom_tag_2</param-name>
+			<param-value>caller_id_name</param-value>
+		</init-param>
+		<init-param>
+			<param-name>custom_tag_3</param-name>
+			<param-value>destination_number</param-value>
+		</init-param>
+		<init-param>
+			<param-name>custom_tag_4</param-name>
+			<param-value>uuid</param-value>
+		</init-param>
+		<init-param>
+			<param-name>custom_tag_5</param-name>
+			<param-value>chan_name</param-value>
+		</init-param>
+		<init-param>
+			<param-name>custom_tag_6</param-name>
+			<param-value></param-value>
+		</init-param>
+		<init-param>
+			<param-name>custom_tag_7</param-name>
+			<param-value></param-value>
+		</init-param>
+		<init-param>
+			<param-name>custom_tag_8</param-name>
+			<param-value></param-value>
+		</init-param>
+		<init-param>
+			<param-name>custom_tag_9</param-name>
+			<param-value></param-value>
+		</init-param>
+	</servlet>
+	<servlet>
+		<servlet-name>CDRSchema</servlet-name>
+		<servlet-class>com.jkr.freeswitch.cdr.logger.FreeswitchCDRSchema</servlet-class>
+		<!-- Log raw cdr XML -->
+		<init-param>
+			<param-name>allowShemaGenerator</param-name>
+			<param-value>true</param-value>
+		</init-param>
+	</servlet>	
+	<servlet-mapping>
+		<servlet-name>CDRLogger</servlet-name>
+		<url-pattern>/cdr</url-pattern>
+	</servlet-mapping>
+		<servlet-mapping>
+		<servlet-name>CDRSchema</servlet-name>
+		<url-pattern>/schema</url-pattern>
+	</servlet-mapping>
+</web-app>
\ No newline at end of file



More information about the Freeswitch-branches mailing list