[sr-dev] git:master: kamdbctl: fix presence tables provisioning

Ovidiu Sas osas at voipembedded.com
Mon Jan 21 21:15:35 CET 2013


Module: sip-router
Branch: master
Commit: c579bce3e6fa4efc29cf4fd8681f471a768a8e7c
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c579bce3e6fa4efc29cf4fd8681f471a768a8e7c

Author: Ovidiu Sas <osas at voipembedded.com>
Committer: Ovidiu Sas <osas at voipembedded.com>
Date:   Mon Jan 21 15:10:39 2013 -0500

kamdbctl: fix presence tables provisioning

---

 utils/kamctl/kamdbctl |   32 +++++++++++++++++++++++++++++++-
 1 files changed, 31 insertions(+), 1 deletions(-)

diff --git a/utils/kamctl/kamdbctl b/utils/kamctl/kamdbctl
index 4784729..d0a22e7 100755
--- a/utils/kamctl/kamdbctl
+++ b/utils/kamctl/kamdbctl
@@ -170,6 +170,12 @@ kamailio_restore() #pars: <database name> <filename>
 
 kamailio_pframework_create() #pars: none
 {
+	if [ -e $DEFAULT_CFG_DIR/pi_framework_sample ] ; then
+		get_answer ask "Sample already exists. Overwrite? (y/n): "
+		if [ "$ANSWER" != "y" ]; then
+			exit 1
+		fi
+	fi
 	touch $DEFAULT_CFG_DIR/pi_framework_sample
 	if [ $? -ne 0 ] ; then
 		merr "Unable to create $DEFAULT_CFG_DIR/pi_framework_sample"
@@ -191,7 +197,7 @@ kamailio_pframework_create() #pars: none
 
 	get_answer $INSTALL_PRESENCE_TABLES "Add provisionning framework for presence tables? (y/n): "
 	if [ "$ANSWER" = "y" ]; then
-		PI_MODULES="$PI_MODULES $PRESENCE_TABLES"
+		PI_PRESENCE_MODULES="TRUE"
 	fi
 
 	cat $DATA_DIR/xhttp_pi/pi_framework-00 > $DEFAULT_CFG_DIR/pi_framework_sample
@@ -202,6 +208,18 @@ kamailio_pframework_create() #pars: none
 			merr "Unable to configure: $TABLE - missing table descriptor"
 		fi
 	done
+	if [ "$PI_PRESENCE_MODULES" = "TRUE" ]; then
+		if [ -e $DATA_DIR/xhttp_pi/presence-table ]; then
+			cat $DATA_DIR/xhttp_pi/presence-table >> $DEFAULT_CFG_DIR/pi_framework_sample
+		else
+			merr "Unable to configure: presence - missing table descriptor"
+		fi
+		if [ -e $DATA_DIR/xhttp_pi/rls-table ]; then
+			cat $DATA_DIR/xhttp_pi/rls-table >> $DEFAULT_CFG_DIR/pi_framework_sample
+		else
+			merr "Unable to configure: rls - missing table descriptor"
+		fi
+	fi
 	cat $DATA_DIR/xhttp_pi/pi_framework-01 >> $DEFAULT_CFG_DIR/pi_framework_sample
 	for TABLE in $PI_MODULES; do
 		if [ -e $DATA_DIR/xhttp_pi/$TABLE-mod ]; then
@@ -210,6 +228,18 @@ kamailio_pframework_create() #pars: none
 			merr "Unable to configure: $TABLE - missing mod descriptor"
 		fi
 	done
+	if [ "$PI_PRESENCE_MODULES" = "TRUE" ]; then
+		if [ -e $DATA_DIR/xhttp_pi/presence-mod ]; then
+			cat $DATA_DIR/xhttp_pi/presence-mod >> $DEFAULT_CFG_DIR/pi_framework_sample
+		else
+			merr "Unable to configure: presence - missing mod descriptor"
+		fi
+		if [ -e $DATA_DIR/xhttp_pi/rls-mod ]; then
+			cat $DATA_DIR/xhttp_pi/rls-mod >> $DEFAULT_CFG_DIR/pi_framework_sample
+		else
+			merr "Unable to configure: rls - missing mod descriptor"
+		fi
+	fi
 	cat $DATA_DIR/xhttp_pi/pi_framework-02 >> $DEFAULT_CFG_DIR/pi_framework_sample
 
 	minfo "Sample provisionning framework saved as: $DEFAULT_CFG_DIR/pi_framework_sample"




More information about the sr-dev mailing list