[Asterisk-cvs] asterisk/apps app_meetme.c,1.80,1.81

markster at lists.digium.com markster at lists.digium.com
Tue Feb 22 09:44:13 CST 2005


Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv6224/apps

Modified Files:
	app_meetme.c 
Log Message:
Add "admin pin" mode (bug #2387)


Index: app_meetme.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_meetme.c,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -d -r1.80 -r1.81
--- app_meetme.c	16 Feb 2005 03:50:41 -0000	1.80
+++ app_meetme.c	22 Feb 2005 15:42:41 -0000	1.81
@@ -128,6 +128,7 @@
 	char *recordingfilename;	/* Filename to record the Conference into */
 	char *recordingformat;		/* Format to record the Conference in */
 	char pin[AST_MAX_EXTENSION];			/* If protected by a PIN */
+	char pinadmin[AST_MAX_EXTENSION];	/* If protected by a admin PIN */
 	struct ast_conference *next;
 } *confs;
 
@@ -244,7 +245,7 @@
 		ast_autoservice_stop(chan);
 }
 
-static struct ast_conference *build_conf(char *confno, char *pin, int make, int dynamic)
+static struct ast_conference *build_conf(char *confno, char *pin, char *pinadmin, int make, int dynamic)
 {
 	struct ast_conference *cnf;
 	struct zt_confinfo ztc;
@@ -262,6 +263,7 @@
 			memset(cnf, 0, sizeof(struct ast_conference));
 			strncpy(cnf->confno, confno, sizeof(cnf->confno) - 1);
 			strncpy(cnf->pin, pin, sizeof(cnf->pin) - 1);
+			strncpy(cnf->pinadmin, pinadmin, sizeof(cnf->pinadmin) - 1);
 			cnf->markedusers = 0;
 			cnf->chan = ast_request("zap", AST_FORMAT_ULAW, "pseudo", NULL);
 			if (cnf->chan) {
@@ -1236,9 +1238,9 @@
 					/* Query the user to enter a PIN */
 					ast_app_getdata(chan, "conf-getpin", dynamic_pin, AST_MAX_EXTENSION - 1, 0);
 				}
-				cnf = build_conf(confno, dynamic_pin, make, dynamic);
+				cnf = build_conf(confno, dynamic_pin, "", make, dynamic);
 			} else {
-				cnf = build_conf(confno, "", make, dynamic);
+				cnf = build_conf(confno, "", "", make, dynamic);
 			}
 		} else {
 			/* Check the config */
@@ -1251,16 +1253,23 @@
 			while(var) {
 				if (!strcasecmp(var->name, "conf")) {
 					/* Separate the PIN */
-					char *pin, *conf;
+					char *pin, *pinadmin, *conf;
 
-					if ((pin = ast_strdupa(var->value))) {
-						conf = strsep(&pin, "|,");
+					if ((pinadmin = ast_strdupa(var->value))) {
+						conf = strsep(&pinadmin, "|");
+						pin = strsep(&pinadmin, "|");
 						if (!strcasecmp(conf, confno)) {
 							/* Bingo it's a valid conference */
 							if (pin)
-								cnf = build_conf(confno, pin, make, dynamic);
+								if (pinadmin)
+									cnf = build_conf(confno, pin, pinadmin, make, dynamic);
+								else
+									cnf = build_conf(confno, pin, "", make, dynamic);
 							else
-								cnf = build_conf(confno, "", make, dynamic);
+								if (pinadmin)
+									cnf = build_conf(confno, "", pinadmin, make, dynamic);
+								else
+									cnf = build_conf(confno, "", "", make, dynamic);
 							break;
 						}
 					}
@@ -1532,7 +1541,7 @@
 				if (allowretry)
 					confno[0] = '\0';
 			} else {
-				if (!ast_strlen_zero(cnf->pin)) {
+				if ((!ast_strlen_zero(cnf->pin) && ! (confflags & CONFFLAG_ADMIN)) || (!ast_strlen_zero(cnf->pinadmin) && (confflags & CONFFLAG_ADMIN))) {
 					char pin[AST_MAX_EXTENSION]="";
 					int j;
 
@@ -1546,9 +1555,12 @@
 							res = ast_app_getdata(chan, "conf-getpin", pin + strlen(pin), sizeof(pin) - 1 - strlen(pin), 0);
 						}
 						if (res >= 0) {
-							if (!strcasecmp(pin, cnf->pin)) {
+							if (!strcasecmp(pin, cnf->pin)  || (!ast_strlen_zero(cnf->pinadmin) && !strcasecmp(pin, cnf->pinadmin))) {
+
 								/* Pin correct */
 								allowretry = 0;
+								if (!ast_strlen_zero(cnf->pinadmin) && !strcasecmp(pin, cnf->pinadmin)) 
+									confflags |= CONFFLAG_ADMIN;
 								/* Run the conference */
 								res = conf_run(chan, cnf, confflags);
 								break;




More information about the svn-commits mailing list