From e43f21b980467d1c8aa08f44dcde2b94bbdd81a4 Mon Sep 17 00:00:00 2001 From: abdulazizali77 Date: Tue, 14 Nov 2017 14:39:22 +0800 Subject: [PATCH] MSB-193: Add call_type column to CDR table. Modify CDR mapper files --- .../src/main/webapp/WEB-INF/data/hsql/restcomm.script | 2 +- .../src/main/webapp/WEB-INF/scripts/mariadb/init.sql | 3 ++- .../scripts/mariadb/sql/call-detail-records.xml | 11 ++++++++--- .../main/webapp/WEB-INF/sql/call-detail-records.xml | 11 ++++++++--- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/restcomm/restcomm.application/src/main/webapp/WEB-INF/data/hsql/restcomm.script b/restcomm/restcomm.application/src/main/webapp/WEB-INF/data/hsql/restcomm.script index 78c626a0f0..8419f5c7ac 100644 --- a/restcomm/restcomm.application/src/main/webapp/WEB-INF/data/hsql/restcomm.script +++ b/restcomm/restcomm.application/src/main/webapp/WEB-INF/data/hsql/restcomm.script @@ -8,7 +8,7 @@ CREATE MEMORY TABLE "restcomm_outgoing_caller_ids"("sid" VARCHAR(34) NOT NULL PR CREATE MEMORY TABLE "restcomm_http_cookies"("sid" VARCHAR(34) NOT NULL PRIMARY KEY,"comment" LONGVARCHAR,"domain" LONGVARCHAR,"expiration_date" DATETIME,"name" LONGVARCHAR NOT NULL,"path" LONGVARCHAR,"value" LONGVARCHAR,"version" INT) CREATE MEMORY TABLE "restcomm_incoming_phone_numbers"("sid" VARCHAR(34) NOT NULL PRIMARY KEY,"date_created" DATETIME NOT NULL,"date_updated" DATETIME NOT NULL,"friendly_name" VARCHAR(64) NOT NULL,"account_sid" VARCHAR(34) NOT NULL,"phone_number" VARCHAR(30) NOT NULL,"api_version" VARCHAR(10) NOT NULL,"voice_caller_id_lookup" BOOLEAN NOT NULL,"voice_url" LONGVARCHAR,"voice_method" VARCHAR(4),"voice_fallback_url" LONGVARCHAR,"voice_fallback_method" VARCHAR(4),"status_callback" LONGVARCHAR,"status_callback_method" VARCHAR(4),"voice_application_sid" VARCHAR(34),"sms_url" LONGVARCHAR,"sms_method" VARCHAR(4),"sms_fallback_url" LONGVARCHAR,"sms_fallback_method" VARCHAR(4),"sms_application_sid" VARCHAR(34),"uri" LONGVARCHAR NOT NULL, "voice_capable" BOOLEAN, "sms_capable" BOOLEAN, "mms_capable" BOOLEAN, "fax_capable" BOOLEAN, "pure_sip" BOOLEAN,"cost" VARCHAR(10), "ussd_url" LONGVARCHAR, "ussd_method" VARCHAR(4), "ussd_fallback_url" LONGVARCHAR, "ussd_fallback_method" VARCHAR(4), "ussd_application_sid" VARCHAR(34), "refer_url" LONGVARCHAR, "refer_method" VARCHAR(4), "refer_application_sid" VARCHAR(34), "organization_sid" VARCHAR(34) NOT NULL) CREATE MEMORY TABLE "restcomm_applications"("sid" VARCHAR(34) NOT NULL PRIMARY KEY,"date_created" DATETIME NOT NULL,"date_updated" DATETIME NOT NULL,"friendly_name" VARCHAR(64) NOT NULL,"account_sid" VARCHAR(34) NOT NULL,"api_version" VARCHAR(10) NOT NULL,"voice_caller_id_lookup" BOOLEAN NOT NULL,"uri" LONGVARCHAR NOT NULL,"rcml_url" LONGVARCHAR, "kind" VARCHAR(5)) -CREATE MEMORY TABLE "restcomm_call_detail_records"("sid" VARCHAR(1000) NOT NULL PRIMARY KEY,"parent_call_sid" VARCHAR(1000),"date_created" DATETIME NOT NULL,"date_updated" DATETIME NOT NULL,"account_sid" VARCHAR(34) NOT NULL,"sender" VARCHAR(255) NOT NULL,"recipient" VARCHAR(64) NOT NULL,"phone_number_sid" VARCHAR(34),"status" VARCHAR(20) NOT NULL,"start_time" DATETIME,"end_time" DATETIME,"duration" INTEGER,"price" VARCHAR(8),"direction" VARCHAR(20) NOT NULL,"answered_by" VARCHAR(64),"api_version" VARCHAR(10) NOT NULL,"forwarded_from" VARCHAR(30),"caller_name" VARCHAR(50),"uri" LONGVARCHAR NOT NULL, "call_path" VARCHAR(255),"ring_duration" INTEGER, "instanceid" VARCHAR(255) NOT NULL, "conference_sid" VARCHAR(34),"muted" BOOLEAN, "start_conference_on_enter" BOOLEAN, "end_conference_on_exit" BOOLEAN, "on_hold" BOOLEAN, "ms_id" VARCHAR(34)) +CREATE MEMORY TABLE "restcomm_call_detail_records"("sid" VARCHAR(1000) NOT NULL PRIMARY KEY,"parent_call_sid" VARCHAR(1000),"date_created" DATETIME NOT NULL,"date_updated" DATETIME NOT NULL,"account_sid" VARCHAR(34) NOT NULL,"sender" VARCHAR(255) NOT NULL,"recipient" VARCHAR(64) NOT NULL,"phone_number_sid" VARCHAR(34),"status" VARCHAR(20) NOT NULL,"start_time" DATETIME,"end_time" DATETIME,"duration" INTEGER,"price" VARCHAR(8),"direction" VARCHAR(20) NOT NULL,"answered_by" VARCHAR(64),"api_version" VARCHAR(10) NOT NULL,"forwarded_from" VARCHAR(30),"caller_name" VARCHAR(50),"uri" LONGVARCHAR NOT NULL, "call_path" VARCHAR(255),"ring_duration" INTEGER, "instanceid" VARCHAR(255) NOT NULL, "conference_sid" VARCHAR(34),"muted" BOOLEAN, "start_conference_on_enter" BOOLEAN, "end_conference_on_exit" BOOLEAN, "on_hold" BOOLEAN, "ms_id" VARCHAR(34), "call_type" VARCHAR(34)) CREATE MEMORY TABLE "restcomm_conference_detail_records" ( "sid" VARCHAR(34) NOT NULL PRIMARY KEY, "date_created" DATETIME NOT NULL, "date_updated" DATETIME NOT NULL, "account_sid" VARCHAR(34) NOT NULL, "status" VARCHAR(100) NOT NULL, "friendly_name" VARCHAR(60), "api_version" VARCHAR(10) NOT NULL, "uri" LONGVARCHAR NOT NULL, "master_ms_id" VARCHAR(34),"master_conference_endpoint_id" VARCHAR(20),"master_present" BOOLEAN DEFAULT TRUE, "master_ivr_endpoint_id" VARCHAR(20),"master_ivr_endpoint_session_id" VARCHAR(200),"master_bridge_endpoint_id" VARCHAR(20),"master_bridge_endpoint_session_id" VARCHAR(200),"master_bridge_conn_id" VARCHAR(200),"master_ivr_conn_id" VARCHAR(200)) CREATE MEMORY TABLE "restcomm_clients"("sid" VARCHAR(34) NOT NULL PRIMARY KEY,"date_created" DATETIME NOT NULL,"date_updated" DATETIME NOT NULL,"account_sid" VARCHAR(34) NOT NULL,"api_version" VARCHAR(10) NOT NULL,"friendly_name" VARCHAR(64) NOT NULL,"login" VARCHAR(64) NOT NULL,"password" VARCHAR(64) NOT NULL,"status" INTEGER NOT NULL,"voice_url" LONGVARCHAR,"voice_method" VARCHAR(4),"voice_fallback_url" LONGVARCHAR,"voice_fallback_method" VARCHAR(4),"voice_application_sid" VARCHAR(34),"uri" LONGVARCHAR NOT NULL, "push_client_identity" VARCHAR(34)) CREATE MEMORY TABLE "restcomm_registrations"("sid" VARCHAR(34) NOT NULL PRIMARY KEY,"date_created" DATETIME NOT NULL,"date_updated" DATETIME NOT NULL,"date_expires" DATETIME NOT NULL,"address_of_record" LONGVARCHAR NOT NULL,"display_name" VARCHAR(255),"user_name" VARCHAR(64) NOT NULL,"user_agent" LONGVARCHAR,"ttl" INTEGER NOT NULL,"location" LONGVARCHAR NOT NULL, "webrtc" BOOLEAN DEFAULT FALSE, "instanceid" VARCHAR(255), "isLBPresent" BOOLEAN DEFAULT FALSE, "organization_sid" VARCHAR(34)) diff --git a/restcomm/restcomm.application/src/main/webapp/WEB-INF/scripts/mariadb/init.sql b/restcomm/restcomm.application/src/main/webapp/WEB-INF/scripts/mariadb/init.sql index 75520403c9..7fe051ab7f 100644 --- a/restcomm/restcomm.application/src/main/webapp/WEB-INF/scripts/mariadb/init.sql +++ b/restcomm/restcomm.application/src/main/webapp/WEB-INF/scripts/mariadb/init.sql @@ -159,7 +159,8 @@ muted BOOLEAN, start_conference_on_enter BOOLEAN, end_conference_on_exit BOOLEAN, on_hold BOOLEAN, -ms_id VARCHAR(34) +ms_id VARCHAR(34), +call_type VARCHAR(34) ); CREATE TABLE restcomm_conference_detail_records ( diff --git a/restcomm/restcomm.application/src/main/webapp/WEB-INF/scripts/mariadb/sql/call-detail-records.xml b/restcomm/restcomm.application/src/main/webapp/WEB-INF/scripts/mariadb/sql/call-detail-records.xml index f6dd3f38be..d05a33923b 100644 --- a/restcomm/restcomm.application/src/main/webapp/WEB-INF/scripts/mariadb/sql/call-detail-records.xml +++ b/restcomm/restcomm.application/src/main/webapp/WEB-INF/scripts/mariadb/sql/call-detail-records.xml @@ -6,9 +6,9 @@ INSERT INTO restcomm_call_detail_records (sid, instanceid, parent_call_sid, date_created, date_updated, account_sid, recipient, sender, phone_number_sid, status, - start_time, end_time, duration, price, direction, answered_by, api_version, forwarded_from, caller_name, uri, call_path, ring_duration, conference_sid, muted, start_conference_on_enter, end_conference_on_exit, on_hold, ms_id) VALUES (#{sid}, #{instanceid}, #{parent_call_sid}, + start_time, end_time, duration, price, direction, answered_by, api_version, forwarded_from, caller_name, uri, call_path, ring_duration, conference_sid, muted, start_conference_on_enter, end_conference_on_exit, on_hold, ms_id, call_type) VALUES (#{sid}, #{instanceid}, #{parent_call_sid}, #{date_created}, #{date_updated}, #{account_sid}, #{to}, #{from}, #{phone_number_sid}, #{status}, #{start_time}, #{end_time}, #{duration}, #{price}, - #{direction}, #{answered_by}, #{api_version}, #{forwarded_from}, #{caller_name}, #{uri}, #{call_path}, #{ring_duration}, #{conference_sid}, #{muted}, #{start_conference_on_enter}, #{end_conference_on_exit}, #{on_hold}, #{ms_id}); + #{direction}, #{answered_by}, #{api_version}, #{forwarded_from}, #{caller_name}, #{uri}, #{call_path}, #{ring_duration}, #{conference_sid}, #{muted}, #{start_conference_on_enter}, #{end_conference_on_exit}, #{on_hold}, #{ms_id}, #{call_type}); @@ -118,7 +121,9 @@ AND end_time <= DATE_ADD(#{endTime},INTERVAL 1 DAY) - + + AND call_type = #{callType} + order by start_time LIMIT #{limit} OFFSET #{offset} diff --git a/restcomm/restcomm.application/src/main/webapp/WEB-INF/sql/call-detail-records.xml b/restcomm/restcomm.application/src/main/webapp/WEB-INF/sql/call-detail-records.xml index 294a2ce9a4..8e6527bf07 100644 --- a/restcomm/restcomm.application/src/main/webapp/WEB-INF/sql/call-detail-records.xml +++ b/restcomm/restcomm.application/src/main/webapp/WEB-INF/sql/call-detail-records.xml @@ -6,10 +6,10 @@ INSERT INTO "restcomm_call_detail_records" ("sid", "instanceid", "parent_call_sid", "date_created", "date_updated", "account_sid", "recipient", "sender", "phone_number_sid", "status", - "start_time", "end_time", "duration", "price", "direction", "answered_by", "api_version", "forwarded_from", "caller_name", "uri", "call_path", "ring_duration", "conference_sid", "muted", "start_conference_on_enter", "end_conference_on_exit", "on_hold", "ms_id") + "start_time", "end_time", "duration", "price", "direction", "answered_by", "api_version", "forwarded_from", "caller_name", "uri", "call_path", "ring_duration", "conference_sid", "muted", "start_conference_on_enter", "end_conference_on_exit", "on_hold", "ms_id", "call_type") VALUES (#{sid}, #{instanceid}, #{parent_call_sid}, #{date_created}, #{date_updated}, #{account_sid}, #{to}, #{from}, #{phone_number_sid}, #{status}, #{start_time}, #{end_time}, #{duration}, #{price}, #{direction}, - #{answered_by}, #{api_version}, #{forwarded_from}, #{caller_name}, #{uri}, #{call_path}, #{ring_duration}, #{conference_sid}, #{muted}, #{start_conference_on_enter}, #{end_conference_on_exit}, #{on_hold}, #{ms_id}); + #{answered_by}, #{api_version}, #{forwarded_from}, #{caller_name}, #{uri}, #{call_path}, #{ring_duration}, #{conference_sid}, #{muted}, #{start_conference_on_enter}, #{end_conference_on_exit}, #{on_hold}, #{ms_id}, #{call_type}); @@ -119,6 +121,9 @@ AND "end_time" <= DATE_ADD(#{endTime},INTERVAL 1 DAY) + + AND "call_type" = #{callType} + order by "start_time" LIMIT #{limit} OFFSET #{offset}