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

View of /trunk/Video_Conferencing_Startup_Kit_Pkg_2/agi_scripts/validate_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: 1450 byte(s)
Add Video Demo Startup Kit
    1 #!/bin/bash
    2 #
    3 # validate_controlled_conf.agi
    4 #
    5 # See if the desired ID is in the controlled conference database.
    6 # Return boolean VALID_PIN and numerical id CONTROLLED_CONF_ID if
    7 # it is found.
    8 #
    9 # Use the Linux "lockfile" command to control concurrent access
   10 #
   11 #set -x
   12 
   13 declare -a array
   14 while read -e ARG && [ "$ARG" ] ; do
   15   array=(` echo $ARG | sed -e 's/://'`)
   16   export ${array[0]}=${array[1]}
   17 done
   18 
   19 checkresults() {
   20   while read line
   21   do
   22   case ${line:0:4} in
   23   "200 " ) echo $line >&2
   24            return;;
   25   "510 " ) echo $line >&2
   26            return;;
   27   "520 " ) echo $line >&2
   28            return;;
   29   *      ) echo $line >&2;; #keep on reading those Invlid command
   30           #command syntax until "520 End ..."
   31   esac
   32   done
   33 }
   34 
   35 
   36 # Have conference IDs 111 - 116.  Our "database" looks like this:
   37 # 111 0-N
   38 # 112 0-N
   39 # 113 0-N
   40 # .
   41 # .
   42 # 2nd column is number of people currently in the conference
   43 
   44 DBFILE=/var/lib/asterisk/agi-bin/controlledconf_id_db
   45 LOCKFILE=/tmp/controlledconf_id_db.lock
   46 TMPFILE=/tmp/controlledconf_id_db.tmp
   47 
   48 IDWANTED=$1
   49 
   50 lockfile $LOCKFILE
   51 
   52 echo "SET VARIABLE VALID_PIN F"
   53 checkresults
   54 
   55 while read DBLINE
   56 do
   57     THISID=`echo $DBLINE | awk '{print $1}'`
   58     if [ $THISID = $IDWANTED ]
   59     then
   60   NUMCONFEREES=`echo $DBLINE | awk '{print $2}'`
   61   if [ $NUMCONFEREES -gt 0 ]
   62   then
   63     echo "SET VARIABLE VALID_PIN T"
   64     checkresults
   65     echo "SET VARIABLE CONTROLLED_CONF_ID $IDWANTED"
   66     checkresults
   67   fi
   68     fi
   69 done < $DBFILE
   70 
   71 rm -f $LOCKFILE
   72 exit 0;
   73 
   74 

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