[asterisk-commits] russell: branch russell/sla_trunk_moh r89403 - /team/russell/sla_trunk_moh/apps/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Nov 18 18:52:10 CST 2007


Author: russell
Date: Sun Nov 18 18:52:09 2007
New Revision: 89403

URL: http://svn.digium.com/view/asterisk?view=rev&rev=89403
Log:
Use the MOH class specified as a MeetMe arg in a couple of other places

Modified:
    team/russell/sla_trunk_moh/apps/app_meetme.c

Modified: team/russell/sla_trunk_moh/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/russell/sla_trunk_moh/apps/app_meetme.c?view=diff&rev=89403&r1=89402&r2=89403
==============================================================================
--- team/russell/sla_trunk_moh/apps/app_meetme.c (original)
+++ team/russell/sla_trunk_moh/apps/app_meetme.c Sun Nov 18 18:52:09 2007
@@ -1463,6 +1463,21 @@
 	return res;
 }
 
+static void conf_start_moh(struct ast_channel *chan, const char *musicclass)
+{
+  	char *original_moh;
+
+	ast_channel_lock(chan);
+	original_moh = ast_strdupa(chan->musicclass);
+	ast_string_field_set(chan, musicclass, musicclass);
+	ast_channel_unlock(chan);
+
+	ast_moh_start(chan, original_moh, NULL);
+
+	ast_channel_lock(chan);
+	ast_string_field_set(chan, musicclass, original_moh);
+	ast_channel_unlock(chan);
+}
 
 static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int confflags, char *optargs[])
 {
@@ -2096,20 +2111,8 @@
 							}
 						}
 					}
-					if (musiconhold == 0 && (confflags & CONFFLAG_MOH)) {
-						char *original_moh;
-
-						ast_channel_lock(chan);
-						original_moh = ast_strdupa(chan->musicclass);
-						ast_string_field_set(chan, musicclass, optargs[OPT_ARG_MOH_CLASS]);
-						ast_channel_unlock(chan);
-
-						ast_moh_start(chan, original_moh, NULL);
-
-						ast_channel_lock(chan);
-						ast_string_field_set(chan, musicclass, original_moh);
-						ast_channel_unlock(chan);
-
+					if (!musiconhold && (confflags & CONFFLAG_MOH)) {
+						conf_start_moh(chan, optargs[OPT_ARG_MOH_CLASS]);
 						musiconhold = 1;
 					}
 				} else if(currentmarked >= 1 && lastmarked == 0) {
@@ -2141,8 +2144,8 @@
 			/* trying to add moh for single person conf */
 			if ((confflags & CONFFLAG_MOH) && !(confflags & CONFFLAG_WAITMARKED)) {
 				if (conf->users == 1) {
-					if (musiconhold == 0) {
-						ast_moh_start(chan, NULL, NULL);
+					if (!musiconhold) {
+						conf_start_moh(chan, optargs[OPT_ARG_MOH_CLASS]);
 						musiconhold = 1;
 					} 
 				} else {
@@ -2494,7 +2497,7 @@
 						}
 					}
 					if (musiconhold)
-			   			ast_moh_start(chan, NULL, NULL);
+						conf_start_moh(chan, optargs[OPT_ARG_MOH_CLASS]);
 
 					if (ioctl(fd, ZT_SETCONF, &ztc)) {
 						ast_log(LOG_WARNING, "Error setting conference\n");




More information about the asterisk-commits mailing list