Pārlūkot izejas kodu

modules:sipcapture Changed authorization column to "auth". Now PostgreSQL should be happy.

for old schema please use:

modparam("sipcapture", "authorization_column", "authorization")
Alexandr Dubovikov 12 gadi atpakaļ
vecāks
revīzija
58417e5f23

+ 2 - 0
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

+ 6 - 2
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,

+ 1 - 1
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");