[Freeswitch-branches] [commit] r3525 - freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference

Freeswitch SVN knhor at freeswitch.org
Sun Dec 3 23:00:33 EST 2006


Author: knhor
Date: Sun Dec  3 23:00:29 2006
New Revision: 3525

Modified:
   freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c

Log:
a little more polish

Modified: freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c	(original)
+++ freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c	Sun Dec  3 23:00:29 2006
@@ -92,8 +92,15 @@
 struct conference_member;
 typedef struct conference_member conference_member_t;
 
-typedef struct caller_control_actions {
+typedef struct caller_control_fn_table {
+	char *key;
+	char *digits;
+	caller_control_t action;
 	void (*handler)(conference_member_t *, void *);
+} caller_control_fn_table_t;
+
+typedef struct caller_control_actions {
+	caller_control_fn_table_t *fndesc;
 	void *data;
 } caller_control_action_t;
 
@@ -1125,12 +1132,7 @@
 	switch_thread_create(&thread, thd_attr, conference_loop_input, member, pool);
 }
 
-static struct caller_control_fn_table {
-	char *key;
-	char *digits;
-	caller_control_t action;
-	void (*handler)(conference_member_t *, void *);
-} ccfntbl[] = {
+static caller_control_fn_table_t ccfntbl[] = {
 	{"mute",		"0",	CALLER_CONTROL_MUTE,		conference_loop_fn_mute_toggle},
 	{"deaf mute",		"*",	CALLER_CONTROL_DEAF_MUTE,	conference_loop_fn_deafmute_toggle},
 	{"energy up",		"9",	CALLER_CONTROL_ENERGY_UP,	conference_loop_fn_energy_up},
@@ -1249,21 +1251,22 @@
 		}
 
 		// if a caller action has been detected, handle it
-		if (caller_action != NULL) {
-			
-			if (caller_action->handler != NULL) {
-				int i,found;
+		if (caller_action != NULL && caller_action->fndesc != NULL && caller_action->fndesc->handler != NULL) {
+			switch_channel_t *channel		= switch_core_session_get_channel(member->session);
+			switch_caller_profile_t *profile	= switch_channel_get_caller_profile(channel);
 
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "digit_stream_parser_feed result != NULL %u\n",caller_action != NULL);
-				for(i=0,found=0; i<CCFNTBL_QTY && !found; i++) {
-					if (caller_action->handler == ccfntbl[i].handler) {
-						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "excuting caller control '%s' param '%s'\n",ccfntbl[i].key,(ccfntbl[i].action != CALLER_CONTROL_MENU ? caller_action->data : ""));
-						found = 1;
-					}
-				}
+			switch_log_printf(SWITCH_CHANNEL_LOG,
+					SWITCH_LOG_INFO,
+					"executing caller control '%s' param '%s' on call '%u,%s,%s,%s'\n",
+					caller_action->fndesc->key,
+					(caller_action->fndesc->action != CALLER_CONTROL_MENU ? caller_action->data : ""),
+					member->id,
+					switch_channel_get_name(channel),
+					profile->caller_id_name,
+					profile->caller_id_number
+					);
+			caller_action->fndesc->handler(member,caller_action->data);
 
-				caller_action->handler(member,caller_action->data);
-			}
 			// set up for next pass
 			caller_action = NULL;
 		}
@@ -3516,7 +3519,7 @@
 											ccfntbl[i].digits);
 				action = (caller_control_action_t *)switch_core_alloc(conference->pool,sizeof(caller_control_action_t));
 				if (action != NULL) {
-					action->handler = ccfntbl[i].handler;
+					action->fndesc = &ccfntbl[i];
 					action->data = NULL;
 					status = switch_ivr_digit_stream_parser_set_event(conference->dtmf_parser,ccfntbl[i].digits,action);
 				} else {
@@ -3572,7 +3575,7 @@
 							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Installing caller control action '%s' bound to '%s'.\n",key,val);
 							action = (caller_control_action_t *)switch_core_alloc(conference->pool,sizeof(caller_control_action_t));
 							if (action != NULL) {
-								action->handler = ccfntbl[i].handler;
+								action->fndesc = &ccfntbl[i];
 								action->data = (void *)data;
 								status = switch_ivr_digit_stream_parser_set_event(conference->dtmf_parser,val,action);
 							} else {



More information about the Freeswitch-branches mailing list