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

Annotation of /trunk/Video_Conferencing_Startup_Kit_Pkg_2/agi_scripts/leave_pin_conf.agi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 89 - (view) (download)

1 : jhermanski 89 #!/bin/bash
2 :     #
3 :     # leave_pin_conf.agi
4 :     #
5 :     # Find the desired ID in the pin conference database,
6 :     # and decrement the number of conferees.
7 :     #
8 :     # Use the Linux "lockfile" command to control concurrent access
9 :     #
10 :     #set -x
11 :    
12 :     declare -a array
13 :     while read -e ARG && [ "$ARG" ] ; do
14 :     array=(` echo $ARG | sed -e 's/://'`)
15 :     export ${array[0]}=${array[1]}
16 :     done
17 :    
18 :     checkresults() {
19 :     while read line
20 :     do
21 :     case ${line:0:4} in
22 :     "200 " ) echo $line >&2
23 :     return;;
24 :     "510 " ) echo $line >&2
25 :     return;;
26 :     "520 " ) echo $line >&2
27 :     return;;
28 :     * ) echo $line >&2;; #keep on reading those Invlid command
29 :     #command syntax until "520 End ..."
30 :     esac
31 :     done
32 :     }
33 :    
34 :    
35 :     # Have conference IDs 101 - 106. Our "database" looks like this:
36 :     # 101 0-N
37 :     # 102 0-N
38 :     # 103 0-N
39 :     # .
40 :     # .
41 :     # 2nd column is number of people currently in the conference
42 :     # We decrement the number by 1
43 :    
44 :     DBFILE=/var/lib/asterisk/agi-bin/conf_id_db
45 :     LOCKFILE=/tmp/conf_id_db.lock
46 :     TMPFILE=/tmp/conf_id_db.tmp
47 :    
48 :     UPDATEID=$1
49 :    
50 :     lockfile $LOCKFILE
51 :    
52 :     while read DBLINE
53 :     do
54 :     THISID=`echo $DBLINE | awk '{print $1}'`
55 :     if [ $THISID = $UPDATEID ]
56 :     then
57 :     NUMCONFEREES=`echo $DBLINE | awk '{print $2}'`
58 :     NEWNUMCONFEREES=`expr $NUMCONFEREES - 1`
59 :     cat $DBFILE | sed -e "s/$UPDATEID $NUMCONFEREES/$UPDATEID $NEWNUMCONFEREES/" > $TMPFILE
60 :     mv $TMPFILE $DBFILE
61 :     fi
62 :     done < $DBFILE
63 :    
64 :     rm -f $LOCKFILE
65 :     exit 0;
66 :    
67 :    

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