[sr-dev] git:master: modules:sipcapture Changed authorization column to "auth". Now PostgreSQL should be happy.
Alexandr Dubovikov
alexandr.dubovikov at gmail.com
Tue Jan 22 11:44:07 CET 2013
Module: sip-router
Branch: master
Commit: 58417e5f23c50a1892584d368e49373c579af31e
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=58417e5f23c50a1892584d368e49373c579af31e
Author: Alexandr Dubovikov <alexandr.dubovikov at gmail.com>
Committer: Alexandr Dubovikov <alexandr.dubovikov at gmail.com>
Date: Tue Jan 22 11:41:43 2013 +0100
modules:sipcapture Changed authorization column to "auth". Now PostgreSQL should be happy.
for old schema please use:
modparam("sipcapture", "authorization_column", "authorization")
---
modules/sipcapture/examples/kamailio.cfg | 2 ++
.../examples/partrotate_unixtimestamp.pl | 8 ++++++--
modules/sipcapture/sipcapture.c | 2 +-
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/modules/sipcapture/examples/kamailio.cfg b/modules/sipcapture/examples/kamailio.cfg
index f6e57de..4edf63a 100644
--- a/modules/sipcapture/examples/kamailio.cfg
+++ b/modules/sipcapture/examples/kamailio.cfg
@@ -52,6 +52,8 @@ modparam("sipcapture", "raw_moni_capture_on", 0)
#modparam("sipcapture", "promiscious_on", 1)
/* activate Linux Socket Filter (LSF/BPF) on mirroring interface. Linux only */
#modparam("sipcapture", "raw_moni_bpf_on", 1)
+/* !!! old schema !!!! */
+#modparam("sipcapture", "authorization_column", "authorization")
# Main SIP request routing logic
# - processing of any incoming SIP request starts with this route
diff --git a/modules/sipcapture/examples/partrotate_unixtimestamp.pl b/modules/sipcapture/examples/partrotate_unixtimestamp.pl
index a2f5690..ad2e5e7 100644
--- a/modules/sipcapture/examples/partrotate_unixtimestamp.pl
+++ b/modules/sipcapture/examples/partrotate_unixtimestamp.pl
@@ -32,6 +32,9 @@ $maxparts = 6; #6 days How long keep the data in the DB
$newparts = 2; #new partitions for 2 days. Anyway, start this script daily!
@stepsvalues = (86400, 3600, 1800, 900);
$partstep = 0; # 0 - Day, 1 - Hour, 2 - 30 Minutes, 3 - 15 Minutes
+# version 1 = auth_field is "authorization"
+$schema_version = 2;
+$auth_field = "auth";
#Check it
$partstep=0 if(!defined $stepsvalues[$partstep]);
@@ -43,11 +46,12 @@ $coof=int(86400/$mystep);
#How much partitions
$maxparts*=$coof;
$newparts*=$coof;
+$auth_field = "authorization" if($schema_version == 1);
+
my $db = DBI->connect("DBI:mysql:$mysql_dbname:$mysql_host:3306", $mysql_user, $mysql_password);
#$db->{PrintError} = 0;
-
my $sth = $db->do("
CREATE TABLE IF NOT EXISTS `".$mysql_table."` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
@@ -72,7 +76,7 @@ CREATE TABLE IF NOT EXISTS `".$mysql_table."` (
`diversion` varchar(256) NOT NULL,
`reason` varchar(200) NOT NULL,
`content_type` varchar(256) NOT NULL,
- `authorization` varchar(256) NOT NULL,
+ `".$auth_field."` varchar(256) NOT NULL,
`user_agent` varchar(256) NOT NULL,
`source_ip` varchar(50) NOT NULL DEFAULT '',
`source_port` int(10) NOT NULL,
diff --git a/modules/sipcapture/sipcapture.c b/modules/sipcapture/sipcapture.c
index dc74a3b..b857558 100644
--- a/modules/sipcapture/sipcapture.c
+++ b/modules/sipcapture/sipcapture.c
@@ -136,7 +136,7 @@ static str cseq_column = str_init("cseq");
static str diversion_column = str_init("diversion_user");
static str reason_column = str_init("reason");
static str content_type_column = str_init("content_type");
-static str authorization_column = str_init("authorization");
+static str authorization_column = str_init("auth");
static str user_agent_column = str_init("user_agent");
static str source_ip_column = str_init("source_ip");
static str source_port_column = str_init("source_port");
More information about the sr-dev
mailing list