Browse code

- fixed tables creation - added 2 new classes of tables to be independently created (on init or later): - presence - creates tables required by presence and pua modules - extra - creates tables requied by rare used modules (cpl, imc, siptrace, domainpolicy) Similar to serweb class, the user will be asked at initial installation if he wants to install also these additional clasess of tables. Also he can add them later by: mysqldb.sh extra mysqldb.sh presence

Presence part for postgres contributed by Klaus Darilion

Closes BUG 1637296.


git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@1601 689a6050-402a-0410-94f2-e92a70836424

Bogdan-Andrei Iancu authored on 08/02/2007 12:16:25
Showing 2 changed files
... ...
@@ -123,6 +123,8 @@ usage: $COMMAND create
123 123
        $COMMAND restore <file> (restores tables from a file)
124 124
        $COMMAND copy <new_db> (creates a new db from an existing one)
125 125
        $COMMAND reinstall (updates to a new OpenSER database)
126
+       $COMMAND presence (adds the presence related tables)
127
+       $COMMAND extra (adds the extra tables - imc,cpl,siptrace,domainpolicy)
126 128
        $COMMAND serweb (adds the SERWEB specific tables)
127 129
 
128 130
        if you want to manipulate database as other MySQL user than
... ...
@@ -315,9 +317,7 @@ INSERT INTO version VALUES ( 'dbaliases', '1');
315 315
 INSERT INTO version VALUES ( 'gw', '3');
316 316
 INSERT INTO version VALUES ( 'gw_grp', '1');
317 317
 INSERT INTO version VALUES ( 'lcr', '2');
318
-INSERT INTO version VALUES ( 'sip_trace', '1');
319 318
 INSERT INTO version VALUES ( 'address', '3');
320
-INSERT INTO version VALUES ( 'domainpolicy', '2');
321 319
 
322 320
 
323 321
 #
... ...
@@ -612,29 +612,6 @@ CREATE TABLE lcr (
612 612
 
613 613
 
614 614
 #
615
-# Table structure for table 'siptrace'
616
-#
617
-CREATE TABLE sip_trace (
618
-  id int(10) NOT NULL auto_increment,
619
-  date datetime NOT NULL default '0000-00-00 00:00:00',
620
-  callid varchar(254) NOT NULL default '',
621
-  traced_user varchar(128) NOT NULL default '',
622
-  msg text NOT NULL,
623
-  method varchar(50) NOT NULL default '',
624
-  status varchar(254) NOT NULL default '',
625
-  fromip varchar(50) NOT NULL default '',
626
-  toip varchar(50) NOT NULL default '',
627
-  fromtag varchar(64) NOT NULL default '',
628
-  direction varchar(4) NOT NULL default '',
629
-  INDEX user_idx (traced_user),
630
-  INDEX date_id (date),
631
-  INDEX ip_idx (fromip),
632
-  KEY call_id (callid),
633
-  PRIMARY KEY  (id)
634
-) $TABLE_TYPE;
635
-
636
-
637
-#
638 615
 # Table structure for table 'address'
639 616
 #
640 617
 CREATE TABLE address (
... ...
@@ -658,6 +635,245 @@ CREATE TABLE pdt (
658 658
   UNIQUE KEY sp_pdt (sdomain, prefix),
659 659
   PRIMARY KEY (id)
660 660
 ) $TABLE_TYPE;
661
+EOF
662
+
663
+echo -n "Install presence related tables ?(y/n):"
664
+read INPUT
665
+if [ "$INPUT" = "y" ] || [ "$INPUT" = "Y" ]
666
+then
667
+	presence_create $1
668
+fi
669
+
670
+echo -n "Install extra tables - imc,cpl,siptrace,domainpolicy ?(y/n):"
671
+read INPUT
672
+if [ "$INPUT" = "y" ] || [ "$INPUT" = "Y" ]
673
+then
674
+	extra_create $1
675
+fi
676
+
677
+echo -n "Install SERWEB related tables ?(y/n):"
678
+read INPUT
679
+if [ "$INPUT" = "y" ] || [ "$INPUT" = "Y" ]
680
+then
681
+	serweb_create $1
682
+fi
683
+} # openser_create
684
+
685
+
686
+presence_create () # pars: <database name>
687
+{
688
+if [ $# -ne 1 ] ; then
689
+	echo "presence_create function takes one param"
690
+	exit 1
691
+fi
692
+
693
+echo "creating presence tables into $1 ..."
694
+
695
+sql_query <<EOF
696
+use $1;
697
+
698
+INSERT INTO version VALUES ( 'presentity', '1');
699
+INSERT INTO version VALUES ( 'active_watchers', '1');
700
+INSERT INTO version VALUES ( 'watchers', '1');
701
+INSERT INTO version VALUES ( 'xcap_xml', '1');
702
+INSERT INTO version VALUES ( 'pua', '1');
703
+
704
+#
705
+# Table structure for table 'presentity'
706
+# 
707
+# used by presence module
708
+#
709
+CREATE TABLE presentity (
710
+  id int(10) NOT NULL auto_increment,
711
+  username varchar(64) NOT NULL,
712
+  domain varchar(124) NOT NULL,
713
+  event varchar(64) NOT NULL,
714
+  etag varchar(64) NOT NULL,
715
+  expires int(11) NOT NULL,
716
+  received_time int(11) NOT NULL,
717
+  body text NOT NULL,
718
+  UNIQUE KEY udee_presentity (username,domain,event,etag),
719
+  PRIMARY KEY (id)
720
+) $TABLE_TYPE;
721
+
722
+
723
+#
724
+# Table structure for table 'active_watchers'
725
+# 
726
+# used by presence module
727
+#
728
+CREATE TABLE active_watchers (
729
+  id int(10) NOT NULL auto_increment,
730
+  to_user varchar(64) NOT NULL,
731
+  to_domain varchar(128) NOT NULL,
732
+  from_user varchar(64) NOT NULL,
733
+  from_domain varchar(128) NOT NULL,
734
+  event varchar(64) NOT NULL default 'presence',
735
+  event_id varchar(64) NOT NULL,
736
+  to_tag varchar(128) NOT NULL,
737
+  from_tag varchar(128) NOT NULL,
738
+  callid varchar(128) NOT NULL,
739
+  cseq int(11) NOT NULL,
740
+  contact varchar(128) NOT NULL,
741
+  record_route varchar(255) NOT NULL,
742
+  expires int(11) NOT NULL,
743
+  status varchar(32) NOT NULL default 'pending',
744
+  version int(11) NOT NULL default '0',
745
+  UNIQUE KEY ft_watchers (from_tag),
746
+  PRIMARY KEY (id)
747
+) $TABLE_TYPE;
748
+
749
+
750
+#
751
+# Table structure for table 'watchers'
752
+# 
753
+# used by presence module
754
+#
755
+CREATE TABLE watchers (
756
+  id int(10) NOT NULL auto_increment,
757
+  p_user varchar(64) NOT NULL,
758
+  p_domain varchar(128) NOT NULL,
759
+  w_user varchar(64) NOT NULL,
760
+  w_domain varchar(128) NOT NULL,
761
+  subs_status varchar(64) NOT NULL,
762
+  reason varchar(64) NOT NULL,
763
+  inserted_time int(11) NOT NULL,
764
+  UNIQUE KEY udud_watchers (p_user,p_domain,w_user,w_domain),
765
+  PRIMARY KEY (id)
766
+) $TABLE_TYPE;
767
+
768
+
769
+#
770
+# Table structure for table 'xcap_xml'
771
+# 
772
+# used by presence module
773
+#
774
+CREATE TABLE xcap_xml (
775
+  id int(10) NOT NULL auto_increment,
776
+  username varchar(66) NOT NULL,
777
+  domain varchar(128) NOT NULL,
778
+  xcap text NOT NULL,
779
+  doc_type varchar(64) NOT NULL,
780
+  UNIQUE KEY udd_xcap (user,domain,doc_type),
781
+  PRIMARY KEY (id)
782
+) $TABLE_TYPE;
783
+
784
+
785
+#
786
+# Table structure for table 'pua'
787
+# 
788
+# used by pua module
789
+#
790
+CREATE TABLE pua (
791
+  id int(10) unsigned NOT NULL auto_increment,
792
+  pres_uri varchar(128) NOT NULL,
793
+  pres_id varchar(128) NOT NULL,
794
+  expires int(11) NOT NULL,
795
+  flag int(11) NOT NULL,
796
+  etag varchar(128) NOT NULL,
797
+  tuple_id varchar(128) NOT NULL,
798
+  watcher_uri varchar(128) NOT NULL,
799
+  call_id varchar(128) NOT NULL,
800
+  to_tag varchar(128) NOT NULL,
801
+  from_tag varchar(128) NOT NULL,
802
+  cseq int(11) NOT NULL,
803
+  PRIMARY KEY  (id)
804
+) $TABLE_TYPE;
805
+EOF
806
+
807
+	if [ $? -eq 0 ] ; then
808
+		echo "...presence tables created"
809
+	fi
810
+}  # end presence_create
811
+
812
+
813
+extra_create () # pars: <database name>
814
+{
815
+if [ $# -ne 1 ] ; then
816
+	echo "extra_create function takes one param"
817
+	exit 1
818
+fi
819
+
820
+echo "creating extra tables into $1 ..."
821
+
822
+sql_query <<EOF
823
+use $1;
824
+
825
+INSERT INTO version VALUES ( 'cpl', '1');
826
+INSERT INTO version VALUES ( 'imc_members', '1');
827
+INSERT INTO version VALUES ( 'imc_rooms', '1');
828
+INSERT INTO version VALUES ( 'sip_trace', '1');
829
+INSERT INTO version VALUES ( 'domainpolicy', '2');
830
+
831
+
832
+#
833
+# Table structure for table 'cpl'
834
+#
835
+# used by cpl-c module
836
+#
837
+CREATE TABLE cpl (
838
+  id int(10) unsigned NOT NULL auto_increment,
839
+  username varchar(64) NOT NULL,
840
+  domain varchar(64) NOT NULL default '',
841
+  cpl_xml text,
842
+  cpl_bin text,
843
+  UNIQUE KEY ud_cpl (username, domain),
844
+  PRIMARY KEY (id)
845
+) $TABLE_TYPE;
846
+
847
+
848
+#
849
+# Table structure for table 'imc_members'
850
+#
851
+# used by imc module
852
+#
853
+CREATE TABLE imc_members (
854
+  id int(10) unsigned NOT NULL auto_increment,
855
+  user varchar(128) NOT NULL,
856
+  domain varchar(128) NOT NULL,
857
+  room varchar(64) NOT NULL,
858
+  flag int(11) NOT NULL,
859
+  UNIQUE KEY ndr_imc (user,domain,room),
860
+  PRIMARY KEY (id)
861
+) $TABLE_TYPE;
862
+
863
+
864
+#
865
+# Table structure for table 'imc_rooms'
866
+#
867
+# used by imc module
868
+#
869
+CREATE TABLE imc_rooms (
870
+  id int(10) unsigned NOT NULL auto_increment,
871
+  name varchar(128) NOT NULL,
872
+  domain varchar(128) NOT NULL,
873
+  flag int(11) NOT NULL,
874
+  UNIQUE KEY nd_imc (name,domain),
875
+  PRIMARY KEY (id)
876
+) $TABLE_TYPE;
877
+
878
+
879
+#
880
+# Table structure for table 'siptrace'
881
+#
882
+CREATE TABLE sip_trace (
883
+  id int(10) NOT NULL auto_increment,
884
+  date datetime NOT NULL default '0000-00-00 00:00:00',
885
+  callid varchar(254) NOT NULL default '',
886
+  traced_user varchar(128) NOT NULL default '',
887
+  msg text NOT NULL,
888
+  method varchar(50) NOT NULL default '',
889
+  status varchar(254) NOT NULL default '',
890
+  fromip varchar(50) NOT NULL default '',
891
+  toip varchar(50) NOT NULL default '',
892
+  fromtag varchar(64) NOT NULL default '',
893
+  direction varchar(4) NOT NULL default '',
894
+  INDEX user_idx (traced_user),
895
+  INDEX date_id (date),
896
+  INDEX ip_idx (fromip),
897
+  KEY call_id (callid),
898
+  PRIMARY KEY  (id)
899
+) $TABLE_TYPE;
661 900
 
662 901
 
663 902
 #
... ...
@@ -674,15 +890,13 @@ CREATE TABLE domainpolicy (
674 674
   INDEX  rule_idx (rule),
675 675
   PRIMARY KEY (id)
676 676
 ) $TABLE_TYPE;
677
+
677 678
 EOF
678 679
 
679
-echo -n "Install SERWEB tables ?(y/n):"
680
-read INPUT
681
-if [ "$INPUT" = "y" ] || [ "$INPUT" = "Y" ]
682
-then
683
-	serweb_create $1
684
-fi
685
-} # openser_create
680
+	if [ $? -eq 0 ] ; then
681
+		echo "...extra tables created"
682
+	fi
683
+}  # end extra_create
686 684
 
687 685
 
688 686
 serweb_create () # pars: <database name>
... ...
@@ -999,6 +1213,14 @@ case $1 in
999 999
 		serweb_create $DBNAME
1000 1000
 		exit $?
1001 1001
 		;;
1002
+	presence)
1003
+		presence_create $DBNAME
1004
+		exit $?
1005
+		;;
1006
+	extra)
1007
+		extra_create $DBNAME
1008
+		exit $?
1009
+		;;
1002 1010
 	drop)
1003 1011
 		# delete openser database
1004 1012
 		openser_drop $DBNAME
... ...
@@ -142,6 +142,7 @@ usage: $COMMAND create
142 142
        $COMMAND drop   (!!entirely deletes tables)
143 143
        $COMMAND reinit (!!entirely deletes and than re-creates tables
144 144
        $COMMAND presence (adds the presence related tables)
145
+       $COMMAND extra (adds the extra tables - imc,cpl,siptrace,domainpolicy)
145 146
        $COMMAND serweb (adds the SERWEB specific tables)
146 147
 
147 148
  NOTE: the following commands are not tested with postgresql,
... ...
@@ -290,7 +291,6 @@ GRANT_CMD="CREATE USER $DBRWUSER WITH PASSWORD '$DBRWPW';
290 290
 		aliases, aliases_id_seq,
291 291
 		dbaliases, dbaliases_id_seq, 
292 292
 		domain, domain_id_seq, 
293
-		domainpolicy, domainpolicy_id_seq, 
294 293
 		grp, grp_id_seq,
295 294
 		gw, gw_id_seq, 
296 295
 		gw_grp, gw_grp_grp_id_seq, 
... ...
@@ -300,7 +300,6 @@ GRANT_CMD="CREATE USER $DBRWUSER WITH PASSWORD '$DBRWPW';
300 300
 		pdt, pdt_id_seq, 
301 301
 		re_grp, re_grp_id_seq, 
302 302
 		silo, silo_id_seq, 
303
-		sip_trace, sip_trace_id_seq, 
304 303
 		speed_dial, speed_dial_id_seq, 
305 304
 		subscriber, subscriber_id_seq, 
306 305
 		trusted, trusted_id_seq, 
... ...
@@ -314,7 +313,6 @@ GRANT_CMD="CREATE USER $DBRWUSER WITH PASSWORD '$DBRWPW';
314 314
 		aliases, 
315 315
 		dbaliases, 
316 316
 		domain, 
317
-		domainpolicy, 
318 317
 		grp, 
319 318
 		gw, 
320 319
 		gw_grp, 
... ...
@@ -324,7 +322,6 @@ GRANT_CMD="CREATE USER $DBRWUSER WITH PASSWORD '$DBRWPW';
324 324
 		pdt, 
325 325
 		re_grp, 
326 326
 		silo, 
327
-		sip_trace, 
328 327
 		speed_dial, 
329 328
 		subscriber, 
330 329
 		trusted, 
... ...
@@ -376,9 +373,7 @@ INSERT INTO version VALUES ( 'dbaliases', '1');
376 376
 INSERT INTO version VALUES ( 'gw', '3');
377 377
 INSERT INTO version VALUES ( 'gw_grp', '1');
378 378
 INSERT INTO version VALUES ( 'lcr', '2');
379
-INSERT INTO version VALUES ( 'sip_trace', '1');
380 379
 INSERT INTO version VALUES ( 'address', '2');
381
-INSERT INTO version VALUES ( 'domainpolicy', '2');
382 380
 
383 381
 /*
384 382
  * Table structure for table 'subscriber' -- user database
... ...
@@ -664,28 +659,6 @@ CREATE FUNCTION "rand" () RETURNS double precision AS 'SELECT random();' LANGUAG
664 664
 
665 665
 
666 666
 /*
667
- * Table structure for table 'siptrace'
668
- */
669
-CREATE TABLE sip_trace (
670
-  id $AUTO_INCREMENT,
671
-  date $TIMESTAMP,
672
-  callid varchar(254) NOT NULL default '',
673
-  traced_user varchar(128) NOT NULL default '',
674
-  msg text NOT NULL,
675
-  method varchar(50) NOT NULL default '',
676
-  status varchar(254) NOT NULL default '',
677
-  fromip varchar(50) NOT NULL default '',
678
-  toip varchar(50) NOT NULL default '',
679
-  fromtag varchar(64) NOT NULL default '',
680
-  direction varchar(4) NOT NULL default ''
681
-) $TABLE_TYPE;
682
-CREATE INDEX user_idx ON sip_trace (traced_user);
683
-CREATE INDEX date_idx ON sip_trace (date);
684
-CREATE INDEX fromip_idx ON sip_trace (fromip);
685
-CREATE INDEX callid_idx ON sip_trace (callid);
686
-
687
-
688
-/*
689 667
 * Table structure for table 'address'
690 668
 */
691 669
 CREATE TABLE address (
... ...
@@ -710,21 +683,6 @@ CREATE TABLE pdt (
710 710
 
711 711
 
712 712
 /*
713
- * domainpolicy table (see README domainpolicy module)
714
- */
715
-CREATE TABLE domainpolicy (
716
-  id $AUTO_INCREMENT,
717
-  rule VARCHAR(255) NOT NULL,
718
-  type VARCHAR(255) NOT NULL,
719
-  att VARCHAR(255),
720
-  val VARCHAR(255),
721
-  comment VARCHAR(255),
722
-  UNIQUE ( rule, att, val )
723
-);
724
-CREATE INDEX domainpolicy_rule_idx ON domainpolicy(rule);
725
-
726
-
727
-/*
728 713
  * GRANT permissions
729 714
  */
730 715
 
... ...
@@ -739,13 +697,19 @@ then
739 739
 	presence_create $1
740 740
 fi
741 741
 
742
-echo -n "Install SERWEB tables ?(y/n):"
742
+echo -n "Install extra tables - imc,cpl,siptrace,domainpolicy ?(y/n):"
743 743
 read INPUT
744 744
 if [ "$INPUT" = "y" ] || [ "$INPUT" = "Y" ]
745 745
 then
746
-	serweb_create $1
746
+	extra_create $1
747 747
 fi
748 748
 
749
+echo -n "Install SERWEB related tables ?(y/n):"
750
+read INPUT
751
+if [ "$INPUT" = "y" ] || [ "$INPUT" = "Y" ]
752
+then
753
+	serweb_create $1
754
+fi
749 755
 } # openser_create
750 756
 
751 757
 
... ...
@@ -761,13 +725,15 @@ GRANT_PRESENCE_CMD="
761 761
 		active_watchers, active_watchers_id_seq, 
762 762
 		presentity, presentity_id_seq, 
763 763
 		watchers, watchers_id_seq, 
764
-		xcap_xml, xcap_xml_id_seq
765
-		TO $DBRWUSER; 
764
+		xcap_xml, xcap_xml_id_seq,
765
+		pua, pua_id_seq
766
+		TO $DBRWUSER;
766 767
 	GRANT SELECT ON TABLE 
767 768
 		active_watchers, 
768 769
 		presentity, 
769 770
 		watchers, 
770
-		xcap_xml 
771
+		xcap_xml,
772
+		pua
771 773
 		TO $DBROUSER;" 
772 774
 
773 775
 echo "creating presence tables into $1 ..."
... ...
@@ -779,6 +745,7 @@ INSERT INTO version VALUES ( 'presentity', '1');
779 779
 INSERT INTO version VALUES ( 'active_watchers', '1');
780 780
 INSERT INTO version VALUES ( 'watchers', '1');
781 781
 INSERT INTO version VALUES ( 'xcap_xml', '1');
782
+INSERT INTO version VALUES ( 'pua', '1');
782 783
 
783 784
 /*
784 785
  * Table structure for table 'presentity'
... ...
@@ -860,6 +827,27 @@ CREATE TABLE xcap_xml (
860 860
 ) $TABLE_TYPE;
861 861
 
862 862
 
863
+/*
864
+ * Table structure for table 'pua'
865
+ * 
866
+ * used by pua module
867
+ */
868
+
869
+CREATE TABLE pua (
870
+  id $AUTO_INCREMENT,
871
+  pres_uri varchar(128) NOT NULL,
872
+  pres_id varchar(128) NOT NULL,
873
+  expires int(11) NOT NULL,
874
+  flag int(11) NOT NULL,
875
+  etag varchar(128) NOT NULL,
876
+  tuple_id varchar(128) NOT NULL,
877
+  watcher_uri varchar(128) NOT NULL,
878
+  call_id varchar(128) NOT NULL,
879
+  to_tag varchar(128) NOT NULL,
880
+  from_tag varchar(128) NOT NULL,
881
+  cseq int(11) NOT NULL
882
+) $TABLE_TYPE;
883
+
863 884
 
864 885
 $GRANT_PRESENCE_CMD
865 886
 
... ...
@@ -868,10 +856,133 @@ EOF
868 868
 	if [ $? -eq 0 ] ; then
869 869
 		echo "...presence tables created"
870 870
 	fi
871
-
872 871
 }  # end presence_create
873 872
 
874 873
 
874
+extra_create () # pars: <database name>
875
+{
876
+if [ $# -ne 1 ] ; then
877
+	echo "extra_create function takes one param"
878
+	exit 1
879
+fi
880
+
881
+GRANT_EXTRA_CMD="
882
+	GRANT ALL PRIVILEGES ON TABLE 
883
+		cpl, cpl_id_seq,
884
+		imc_members, imc_members_id_seq,
885
+		imc_rooms, imc_rooms_id_seq,
886
+		sip_trace, sip_trace_id_seq,
887
+		domainpolicy, domainpolicy_id_seq
888
+		TO $DBRWUSER;
889
+	GRANT SELECT ON TABLE 
890
+		cpl,
891
+		imc_members,
892
+		imc_rooms,
893
+		sip_trace,
894
+		domainpolicy
895
+		TO $DBROUSER;"
896
+
897
+echo "creating extra tables into $1 ..."
898
+
899
+sql_query <<EOF
900
+$USE_CMD $1;
901
+
902
+INSERT INTO version VALUES ( 'cpl', '1');
903
+INSERT INTO version VALUES ( 'imc_members', '1');
904
+INSERT INTO version VALUES ( 'imc_rooms', '1');
905
+INSERT INTO version VALUES ( 'sip_trace', '1');
906
+INSERT INTO version VALUES ( 'domainpolicy', '2');
907
+
908
+/*
909
+ * Table structure for table 'cpl'
910
+ * 
911
+ * used by cpl-c module
912
+ */
913
+CREATE TABLE cpl (
914
+  id $AUTO_INCREMENT,
915
+  username varchar(64) NOT NULL,
916
+  domain varchar(64) NOT NULL default '',
917
+  cpl_xml text,
918
+  cpl_bin text,
919
+  UNIQUE (username, domain)
920
+) $TABLE_TYPE;
921
+
922
+
923
+/*
924
+ * Table structure for table 'imc_members'
925
+ * 
926
+ * used by imc module
927
+ */
928
+CREATE TABLE imc_members (
929
+  id $AUTO_INCREMENT,
930
+  user varchar(128) NOT NULL,
931
+  domain varchar(128) NOT NULL,
932
+  room varchar(64) NOT NULL,
933
+  flag int NOT NULL,
934
+  UNIQUE (user,domain,room)
935
+) $TABLE_TYPE;
936
+
937
+
938
+/*
939
+ * Table structure for table 'imc_rooms'
940
+ * 
941
+ * used by imc module
942
+ */
943
+CREATE TABLE imc_rooms (
944
+  id $AUTO_INCREMENT,
945
+  name varchar(128) NOT NULL,
946
+  domain varchar(128) NOT NULL,
947
+  flag int NOT NULL,
948
+  UNIQUE (name,domain)
949
+) $TABLE_TYPE;
950
+
951
+
952
+/*
953
+ * Table structure for table 'siptrace'
954
+ */
955
+CREATE TABLE sip_trace (
956
+  id $AUTO_INCREMENT,
957
+  date $TIMESTAMP,
958
+  callid varchar(254) NOT NULL default '',
959
+  traced_user varchar(128) NOT NULL default '',
960
+  msg text NOT NULL,
961
+  method varchar(50) NOT NULL default '',
962
+  status varchar(254) NOT NULL default '',
963
+  fromip varchar(50) NOT NULL default '',
964
+  toip varchar(50) NOT NULL default '',
965
+  fromtag varchar(64) NOT NULL default '',
966
+  direction varchar(4) NOT NULL default ''
967
+) $TABLE_TYPE;
968
+CREATE INDEX user_idx ON sip_trace (traced_user);
969
+CREATE INDEX date_idx ON sip_trace (date);
970
+CREATE INDEX fromip_idx ON sip_trace (fromip);
971
+CREATE INDEX callid_idx ON sip_trace (callid);
972
+
973
+
974
+/*
975
+ * domainpolicy table (see README domainpolicy module)
976
+ */
977
+CREATE TABLE domainpolicy (
978
+  id $AUTO_INCREMENT,
979
+  rule VARCHAR(255) NOT NULL,
980
+  type VARCHAR(255) NOT NULL,
981
+  att VARCHAR(255),
982
+  val VARCHAR(255),
983
+  comment VARCHAR(255),
984
+  UNIQUE ( rule, att, val )
985
+);
986
+CREATE INDEX domainpolicy_rule_idx ON domainpolicy(rule);
987
+
988
+$GRANT_EXTRA_CMD
989
+
990
+EOF
991
+
992
+	if [ $? -eq 0 ] ; then
993
+		echo "...extra tables created"
994
+	fi
995
+}  # end extra_create
996
+
997
+
875 998
 serweb_create () # pars: <database name>
876 999
 {
877 1000
 if [ $# -ne 1 ] ; then
... ...
@@ -1221,6 +1332,18 @@ case $1 in
1221 1221
 		openser_create $DBNAME
1222 1222
 		exit $?
1223 1223
 		;;
1224
+	serweb)
1225
+		serweb_create $DBNAME
1226
+		exit $?
1227
+		;;
1228
+	presence)
1229
+		presence_create $DBNAME
1230
+		exit $?
1231
+		;;
1232
+	extra)
1233
+		extra_create $DBNAME
1234
+		exit $?
1235
+		;;
1224 1236
 	drop)
1225 1237
 		# delete openser database
1226 1238
 		openser_drop $DBNAME