Module: kamailio
Branch: master
Commit: c7f4837e2e2d55e294e699e0a3a8173cde77ef83
URL:
https://github.com/kamailio/kamailio/commit/c7f4837e2e2d55e294e699e0a3a8173…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2019-03-28T17:43:29+01:00
kamctl: added acc initdb command
- command to add additional columns needed with default kamailio.cfg and
defined WITH_ACCDB for acc and missed_calls table
---
Modified: utils/kamctl/kamctl
Modified: utils/kamctl/kamctl.base
---
Diff:
https://github.com/kamailio/kamailio/commit/c7f4837e2e2d55e294e699e0a3a8173…
Patch:
https://github.com/kamailio/kamailio/commit/c7f4837e2e2d55e294e699e0a3a8173…
---
diff --git a/utils/kamctl/kamctl b/utils/kamctl/kamctl
index 3a25443355..a5f51803d8 100755
--- a/utils/kamctl/kamctl
+++ b/utils/kamctl/kamctl
@@ -2345,6 +2345,32 @@ acc() {
shift;
require_dbengine
case $1 in
+ initdb)
+ QUERY=$(cat <<-END
+ALTER TABLE acc ADD COLUMN src_user VARCHAR(64) NOT NULL DEFAULT '';
+ALTER TABLE acc ADD COLUMN src_domain VARCHAR(128) NOT NULL DEFAULT '';
+ALTER TABLE acc ADD COLUMN src_ip varchar(64) NOT NULL default '';
+ALTER TABLE acc ADD COLUMN dst_ouser VARCHAR(64) NOT NULL DEFAULT '';
+ALTER TABLE acc ADD COLUMN dst_user VARCHAR(64) NOT NULL DEFAULT '';
+ALTER TABLE acc ADD COLUMN dst_domain VARCHAR(128) NOT NULL DEFAULT '';
+ALTER TABLE missed_calls ADD COLUMN src_user VARCHAR(64) NOT NULL DEFAULT '';
+ALTER TABLE missed_calls ADD COLUMN src_domain VARCHAR(128) NOT NULL DEFAULT '';
+ALTER TABLE missed_calls ADD COLUMN src_ip varchar(64) NOT NULL default '';
+ALTER TABLE missed_calls ADD COLUMN dst_ouser VARCHAR(64) NOT NULL DEFAULT '';
+ALTER TABLE missed_calls ADD COLUMN dst_user VARCHAR(64) NOT NULL DEFAULT '';
+ALTER TABLE missed_calls ADD COLUMN dst_domain VARCHAR(128) NOT NULL DEFAULT '';
+END
+)
+ $DBCMD "$QUERY"
+ if [ $? -ne 0 ] ; then
+ merr "error - acc db init"
+ exit 1
+ fi
+
+ mecho "ok - acc db init"
+
+ ;;
+
showdb)
QUERY="select * FROM $ACC_TABLE ;"
$DBROCMD "$QUERY"
diff --git a/utils/kamctl/kamctl.base b/utils/kamctl/kamctl.base
index 16f61e04a5..46494f5a04 100644
--- a/utils/kamctl/kamctl.base
+++ b/utils/kamctl/kamctl.base
@@ -577,6 +577,7 @@ usage_acc() {
mecho " -- command 'acc' - manage accounding records"
echo
cat <<EOF
+ acc initdb .................. init acc table by adding extra colums
acc showdb .................. show content of acc table
recent [<secs>] ............. show most recent records in acc (default 300s)
EOF