# # $Id$ # # control tool for maintaining Kamailio # #=================================================================== ##### ----------------------------------------------- ##### ### FIFO specific variables and functions # ##### ----------------------------------------------- ##### ### load CTL base # if [ -f "$MYLIBDIR/kamctl.ctlbase" ]; then . "$MYLIBDIR/kamctl.ctlbase" else mwarn "Cannot load CTL core functions '$MYLIBDIR/kamctl.ctlbase' ..." # exit -1 fi # ##### ----------------------------------------------- ##### ### parameters # if [ -z "$FIFOPATH" ]; then if [ -z "$OSER_FIFO" ]; then FIFOPATH=/tmp/kamailio_fifo else FIFOPATH=$OSER_FIFO fi fi # ##### ----------------------------------------------- ##### ### functions # usage_fifo() { echo mecho " -- command 'mi' - send raw MI commands" echo cat < $FIFOPATH # wait for the reader to complete wait rm $path mdbg "FIFO command was:\n$CMD" } CTLCMD=fifo_cmd fifo_kamailio_monitor() { name=kamailio_receiver_$$ path=$CHROOT_DIR/tmp/$name # delete existing fifo file with same name if test -p $path; then rm -f $path fi if [ ! -w $FIFOPATH ]; then merr "Error opening Kamailio's FIFO $FIFOPATH" merr "Make sure you have the line 'modparam(\"mi_fifo\", \"fifo_name\", \"$FIFOPATH\")' in your config" merr "and also have loaded the mi_fifo module." exit 1 fi if ! test -p $path; then mkfifo $path if [ $? -ne 0 ] ; then merr "monitor - error opening read fifo $path" exit 1 fi chmod a+w $path fi trap "rm $path; clear; echo monitor ^C-ed; exit 1" 2 attempt=0 if [ "$2" = "" ]; then loops=-1; else loops=$2; fi clear while [ $loops -ne $attempt ] ; do attempt=`$EXPR $attempt + 1` #clear tput clear # print_stats $name $path $attempt mecho "[cycle #: $attempt; if constant make sure server lives]" cat < $path | filter_fl & cat > $FIFOPATH < $FIFOPATH << EOF :uptime:$name EOF wait echo mecho "Transaction Statistics: " cat < $path | filter_fl & cat > $FIFOPATH < $FIFOPATH < $FIFOPATH <