[tools] / trunk / Video_Conferencing_Startup_Kit_Pkg_2 / agi_scripts / leave_controlled_conf.agi Repository:
ViewVC logotype

View of /trunk/Video_Conferencing_Startup_Kit_Pkg_2/agi_scripts/leave_controlled_conf.agi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 89 - (download) (annotate)
Wed Sep 7 14:38:33 2011 UTC (20 months, 1 week ago) by jhermanski
File size: 1738 byte(s)
Add Video Demo Startup Kit
    1 #!/bin/bash
    2 #
    3 # leave_controlled_conf.agi
    4 #
    5 # Find the desired ID in the controlled conference database,
    6 # and set it to zero.  Once the conference controller leaves,
    7 # that's the end of the conference.  Other conferees are
    8 # automaticallt hung up by Diastar.
    9 #
   10 # Use the Linux "lockfile" command to controll concurrent access
   11 #
   12 #set -x
   13 
   14 declare -a array
   15 while read -e ARG && [ "$ARG" ] ; do
   16   array=(` echo $ARG | sed -e 's/://'`)
   17   export ${array[0]}=${array[1]}
   18 done
   19 
   20 checkresults() {
   21   while read line
   22   do
   23   case ${line:0:4} in
   24   "200 " ) echo $line >&2
   25            return;;
   26   "510 " ) echo $line >&2
   27            return;;
   28   "520 " ) echo $line >&2
   29            return;;
   30   *      ) echo $line >&2;; #keep on reading those Invlid command
   31           #command syntax until "520 End ..."
   32   esac
   33   done
   34 }
   35 
   36 
   37 # Have conference IDs 111 - 116.  Our "database" looks like this:
   38 # 111 0-N
   39 # 112 0-N
   40 # 113 0-N
   41 # .
   42 # .
   43 # 2nd column is number of people currently in the conference
   44 # We decrement the number by 1
   45 
   46 DBFILE=/var/lib/asterisk/agi-bin/controlledconf_id_db
   47 LOCKFILE=/tmp/controlledconf_id_db.lock
   48 TMPFILE=/tmp/controlledconf_id_db.tmp
   49 
   50 UPDATEID=$1
   51 
   52 lockfile $LOCKFILE
   53 
   54 while read DBLINE
   55 do
   56     THISID=`echo $DBLINE | awk '{print $1}'`
   57     if [ $THISID = $UPDATEID ]
   58     then
   59   NUMCONFEREES=`echo $DBLINE | awk '{print $2}'`
   60   # Number of conferees are set to zero since they are thrown out when the controller
   61   # hangs up.
   62   # There may be a small window of time where presenters and attendees are still
   63   # on the way out and the conference ID is selected for a new conference.  Not sure
   64   # if this will be a problem.
   65   cat $DBFILE | sed -e "s/$UPDATEID $NUMCONFEREES/$UPDATEID 0/" > $TMPFILE
   66   mv $TMPFILE $DBFILE
   67     fi
   68 done < $DBFILE
   69 
   70 rm -f $LOCKFILE
   71 exit 0;
   72 
   73 

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.8