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

Freeswitch SVN knhor at freeswitch.org
Fri Dec 8 20:19:30 EST 2006


Author: knhor
Date: Fri Dec  8 20:19:30 2006
New Revision: 3587

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

Log:
separate the stream context from the parser context. fix api syntax help typos

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	Fri Dec  8 20:19:30 2006
@@ -223,6 +223,7 @@
 	switch_audio_resampler_t *read_resampler;
 	confernce_file_node_t *fnode;
 	conference_relationship_t *relationships;
+	switch_ivr_digit_stream_t *digit_stream;
 	struct conference_member *next;
 };
 
@@ -507,7 +508,6 @@
 		last = imember;
 	}
 
-
 	member->conference = NULL;
 
 	if (!switch_test_flag(member, MFLAG_NOCHANNEL)) {
@@ -549,9 +549,7 @@
 	switch_mutex_unlock(conference->member_mutex);
 	switch_mutex_unlock(conference->mutex);
 
-
 	switch_thread_rwlock_unlock(conference->rwlock);
-
 }
 
 /* Main monitor thread (1 per distinct conference room) */
@@ -750,8 +748,6 @@
 		switch_mutex_unlock(conference->mutex);
 	} /* Rinse ... Repeat */
 
-
-
 	if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO);
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", conference->name);
@@ -763,7 +759,6 @@
 		switch_event_fire(&event);
 	}
 
-    
 	switch_core_timer_destroy(&timer);
     
 	if (switch_test_flag(conference, CFLAG_DESTRUCT)) {
@@ -802,9 +797,7 @@
 		switch_core_hash_delete(globals.conference_hash, conference->name);
 		switch_mutex_unlock(globals.hash_mutex);
         
-		// this probably should be done, but doing it causes "shutdown" to hang until you kill it
-		// XXX - i'll chase this down later
-		// switch_ivr_digit_stream_parser_destroy(&conference->dtmf_parser);
+		switch_ivr_digit_stream_parser_destroy(conference->dtmf_parser);
 
 		if (conference->pool) {
 			switch_memory_pool_t *pool = conference->pool;
@@ -1208,6 +1201,11 @@
 	/* Start the input thread */
 	launch_conference_loop_input(member, switch_core_session_get_pool(member->session));
 
+	/* build a digit stream object */
+	if (member->conference->dtmf_parser != NULL && switch_ivr_digit_stream_new(member->conference->dtmf_parser,&member->digit_stream) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Warning Will Robinson, there is no digit parser stream object\n");
+	}
+
 	/* Fair WARNING, If you expect the caller to hear anything or for digit handling to be proccessed,		*/
 	/* you better not block this thread loop for more than the duration of member->conference->timer_name!	*/
 	while(switch_test_flag(member, MFLAG_RUNNING) && switch_test_flag(member, MFLAG_ITHREAD) && switch_channel_ready(channel)) {
@@ -1259,12 +1257,12 @@
 			if(member->conference->dtmf_parser != NULL) {
 
 				for (digit = dtmf; *digit && caller_action == NULL; digit++) {
-					caller_action = (caller_control_action_t *)switch_ivr_digit_stream_parser_feed(member->conference->dtmf_parser, *digit);
+					caller_action = (caller_control_action_t *)switch_ivr_digit_stream_parser_feed(member->conference->dtmf_parser, member->digit_stream, *digit);
 				}
 			}
 		/* otherwise, clock the parser so that it can handle digit timeout detection */
 		} else if(member->conference->dtmf_parser != NULL) {
-			caller_action = (caller_control_action_t *)switch_ivr_digit_stream_parser_feed(member->conference->dtmf_parser, '\0');
+			caller_action = (caller_control_action_t *)switch_ivr_digit_stream_parser_feed(member->conference->dtmf_parser, member->digit_stream, '\0');
 		}
 
 		/* if a caller action has been detected, handle it */
@@ -1384,6 +1382,10 @@
 		}
 	} /* Rinse ... Repeat */
 
+	if (member->digit_stream != NULL) {
+		switch_ivr_digit_stream_destroy(member->digit_stream);
+	}
+
 	switch_clear_flag_locked(member, MFLAG_RUNNING);
 	switch_core_timer_destroy(&timer);
 
@@ -2590,13 +2592,13 @@
 	{"volume out",	&conf_api_sub_volume_out,	CONF_API_SUB_MEMBER_TARGET,	"<confname> volume_out <member_id|all|last> [<newval>]"},
 	{"play",	&conf_api_sub_play,		CONF_API_SUB_ARGS_SPLIT,	"<confname> play <file_path> [<member_id>]"},
 	{"say",		&conf_api_sub_say,		CONF_API_SUB_ARGS_AS_ONE,	"<confname> say <text>"},
-	{"saymember",	&conf_api_sub_saymember,	CONF_API_SUB_ARGS_AS_ONE,	"<confname> saymember <member_id><text>"},
+	{"saymember",	&conf_api_sub_saymember,	CONF_API_SUB_ARGS_AS_ONE,	"<confname> saymember <member_id> <text>"},
 	{"stop",	&conf_api_sub_stop,		CONF_API_SUB_MEMBER_TARGET,	"<confname> stop <[current|all|last]> [<member_id>]"},
 	{"kick",	&conf_api_sub_kick,		CONF_API_SUB_MEMBER_TARGET,	"<confname> kick <[member_id|all|last]>"},
 	{"mute",	&conf_api_sub_mute,		CONF_API_SUB_MEMBER_TARGET,	"<confname> mute <[member_id|all]|last>"},
 	{"unmute",	&conf_api_sub_unmute,		CONF_API_SUB_MEMBER_TARGET,	"<confname> unmute <[member_id|all]|last>"},
 	{"deaf",	&conf_api_sub_deaf,		CONF_API_SUB_MEMBER_TARGET,	"<confname> deaf <[member_id|all]|last>"},
-	{"undeaf",	&conf_api_sub_undeaf,		CONF_API_SUB_MEMBER_TARGET,	"<confname> undef <[member_id|all]|last>"},
+	{"undeaf",	&conf_api_sub_undeaf,		CONF_API_SUB_MEMBER_TARGET,	"<confname> undeaf <[member_id|all]|last>"},
 	{"relate",	&conf_api_sub_relate,		CONF_API_SUB_ARGS_SPLIT,	"<confname> relate <member_id> <other_member_id> [nospeak|nohear|clear]"},
 	{"lock",	&conf_api_sub_lock,		CONF_API_SUB_ARGS_SPLIT,	"<confname> lock"},
 	{"unlock",	&conf_api_sub_unlock,		CONF_API_SUB_ARGS_SPLIT,	"<confname> unlock"},
@@ -3514,7 +3516,7 @@
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to build xml menu stack\n");
 
 /*
-					/* instruct ivr menu to use our file play and tts routines */
+					// instruct ivr menu to use our file play and tts routines
 					status = switch_ivr_menu_set_fileplay_callback((*ctx)->menu_stack, &ivr_menu_callback_play_file);
 					if (status != SWITCH_STATUS_SUCCESS)
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to set file play calback\n");
@@ -3852,19 +3854,19 @@
 	}
 	conference->rate = rate;
 	conference->interval = interval;
+	conference->dtmf_parser = NULL;
 
-	/* caller control configuration chores */
-	xml_controls = switch_xml_child(profile, "controls");
-	controls_set = (xml_controls != NULL ? (char *) switch_xml_attr_soft(xml_controls, "set") : NULL);
+	if(0 && switch_ivr_digit_stream_parser_new(conference->pool,&conference->dtmf_parser) == SWITCH_STATUS_SUCCESS) {
 
-	/* if no controls specified in the config, assume all should be specified */
-	if (xml_controls == NULL) {
-		status = conference_new_install_caller_controls_default(conference);
-	} else if (xml_controls != NULL && controls_set != NULL && strcasecmp(controls_set,"none") != 0) {
-	/* try to build caller control if the set has been specified and != "none" */
-		if(switch_ivr_digit_stream_parser_new(conference->pool,&conference->dtmf_parser) == SWITCH_STATUS_SUCCESS) {
-			
-			/* map in the default control handler strings if specified */
+		/* caller control configuration chores */
+		xml_controls = switch_xml_child(profile, "controls");
+		controls_set = (xml_controls != NULL ? (char *) switch_xml_attr_soft(xml_controls, "set") : NULL);
+
+		if (xml_controls == NULL) {
+		/* if no controls specified in the config, assume all should be specified */
+			status = conference_new_install_caller_controls_default(conference);
+		} else if (xml_controls != NULL && controls_set != NULL && strcasecmp(controls_set,"none") != 0) {
+		/* try to build caller control if the set has been specified and != "none" */
 			if (strcasecmp(controls_set,"default") == 0) {
 				status = conference_new_install_caller_controls_default(conference);
 			} else if (strcasecmp(controls_set,"custom") == 0) {
@@ -3873,10 +3875,10 @@
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown caller control set.\n");
 			}
 		} else {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to allocate caller control digit parser.\n");
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "no caller controls intalled.\n");
 		}
 	} else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "no caller controls intalled.\n");
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to allocate caller control digit parser.\n");
 	}
 
 	/* Activate the conference mutex for exclusivity */



More information about the Freeswitch-branches mailing list