[Freeswitch-svn] [commit] r3254 - freeswitch/branches/knhor/wip/mod_conference

Freeswitch SVN knhor at freeswitch.org
Wed Nov 1 23:16:07 EST 2006


Author: knhor
Date: Wed Nov  1 23:16:06 2006
New Revision: 3254

Modified:
   freeswitch/branches/knhor/wip/mod_conference/mod_conference.c

Log:
make caller dtmf control digits configurable in the conference profile

Modified: freeswitch/branches/knhor/wip/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/branches/knhor/wip/mod_conference/mod_conference.c	(original)
+++ freeswitch/branches/knhor/wip/mod_conference/mod_conference.c	Wed Nov  1 23:16:06 2006
@@ -126,6 +126,7 @@
 	char *kicked_sound;
 	char *caller_id_name;
 	char *caller_id_number;
+	char *caller_dtmf_control;
 	char *pin;
 	char *pin_sound;
 	char *bad_pin_sound;
@@ -1015,47 +1016,55 @@
 
 		if (switch_channel_has_dtmf(channel)) {
 			switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf));
+			char *pcontroldigit;
 
 			for (digit = dtmf; *digit; digit++) {
-				switch(*digit) {
-				case '0':
-					conference_loop_fn_mute_toggle(member);
-					break;
-				case '*':
-					conference_loop_fn_deafmute_toggle(member);
-					break;
-				case '9':
-					conference_loop_fn_energy_up(member);
-					break;
-				case '8':
-					conference_loop_fn_energy_equ_conference(member);
-					break;
-				case '7':
-					conference_loop_fn_energy_dn(member);
-					break;
-				case '3':
-					conference_loop_fn_volume_talk_up(member);
-					break;
-				case '2':
-					conference_loop_fn_volume_talk_zero(member);
-					break;
-				case '1':
-					conference_loop_fn_volume_talk_dn(member);
-					break;
-				case '6':
-					conference_loop_fn_volume_listen_up(member);
-					break;
-				case '5':
-					conference_loop_fn_volume_listen_zero(member);
-					break;
-				case '4':
-					conference_loop_fn_volume_listen_dn(member);
-					break;
-				case '#':
-					conference_loop_fn_hangup(member);
-					break;
-				default:
-					break;
+				// The position of the dialed digit in the control string
+				// determines the operation that is being requested
+				// To disable the function for the user, make the control
+				// string digit something that can't be dialed... ie. a space
+				// The control string should have at least 11 characters in it
+				pcontroldigit = strchr(member->conference->caller_dtmf_control,*digit);
+
+				if(pcontroldigit != NULL) {
+					switch(pcontroldigit-member->conference->caller_dtmf_control) {
+					case 0:
+						conference_loop_fn_mute_toggle(member);
+						break;
+					case 1:
+						conference_loop_fn_deafmute_toggle(member);
+						break;
+					case 2:
+						conference_loop_fn_energy_up(member);
+						break;
+					case 3:
+						conference_loop_fn_energy_equ_conference(member);
+						break;
+					case 4:
+						conference_loop_fn_energy_dn(member);
+						break;
+					case 5:
+						conference_loop_fn_volume_talk_up(member);
+						break;
+					case 6:
+						conference_loop_fn_volume_talk_zero(member);
+						break;
+					case 7:
+						conference_loop_fn_volume_talk_dn(member);
+						break;
+					case 8:
+						conference_loop_fn_volume_listen_up(member);
+						break;
+					case 9:
+						conference_loop_fn_volume_listen_zero(member);
+						break;
+					case 10:
+						conference_loop_fn_volume_listen_dn(member);
+						break;
+					case 11:
+						conference_loop_fn_hangup(member);
+						break;
+					}
 				}
 			}
 		}
@@ -3207,6 +3216,7 @@
 	char *energy_level = NULL;
 	char *caller_id_name = NULL;
 	char *caller_id_number = NULL;
+	char *caller_dtmf_control = "0*987321654#";
 	uint32_t rate = 8000, interval = 20;
 	switch_status_t status;
 
@@ -3274,6 +3284,8 @@
 			caller_id_name = val;
 		} else if (!strcasecmp(var, "caller-id-number")) {
 			caller_id_number = val;
+		} else if (!strcasecmp(var, "caller-dtmf-control")) {
+			caller_dtmf_control = val;
 		}
 	}
 
@@ -3334,6 +3346,23 @@
 
 	conference->caller_id_name = switch_core_strdup(conference->pool, caller_id_name);
 	conference->caller_id_number = switch_core_strdup(conference->pool, caller_id_number);
+
+	// The position of the dialed digit in the control string
+	// determines the operation that is being requested
+	// To disable the function for the user, make the control
+	// string digit something that can't be dialed... ie. a space
+	// The control string should have at least 11 characters in it
+	if(strlen(caller_dtmf_control) < 11) {
+		char dbuf[12];
+
+		memset(dbuf,' ',sizeof(dbuf));
+		dbuf[11] = '\0';
+		memcpy(dbuf,caller_dtmf_control,strlen(caller_dtmf_control));
+
+		conference->caller_dtmf_control = switch_core_strdup(conference->pool, dbuf);
+	} else {
+		conference->caller_dtmf_control = switch_core_strdup(conference->pool, caller_dtmf_control);
+	}
 
 	if (!switch_strlen_zero(enter_sound)) {
 		conference->enter_sound = switch_core_strdup(conference->pool, enter_sound);



More information about the Freeswitch-svn mailing list