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

Freeswitch SVN mikej at freeswitch.org
Mon Dec 4 02:24:46 EST 2006


Author: mikej
Date: Mon Dec  4 02:24:45 2006
New Revision: 3530

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

Log:
// => /* */

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	Mon Dec  4 02:24:45 2006
@@ -51,8 +51,8 @@
 #define MIN(a,b) ((a)<(b)?(a):(b))
 #endif
 
-// this doesn't work correctly yet, don't bother trying!
-//#define OPTION_IVR_MENU_SUPPORT
+/* this doesn't work correctly yet, don't bother trying! */
+//#define OPTION_IVR_MENU_SUPPORT */
 
 typedef enum {
 	FILE_STOP_CURRENT,
@@ -88,7 +88,7 @@
 	CALLER_CONTROL_DIAL,
 } caller_control_t;
 
-// forward declaration for conference_obj and caller_control
+/* forward declaration for conference_obj and caller_control */
 struct conference_member;
 typedef struct conference_member conference_member_t;
 
@@ -233,7 +233,7 @@
 	switch_memory_pool_t *pool;
 } conference_record_t;
 
-// API command parser
+/* API command parser */
 typedef struct api_command {
 	char *pname;
 	void *pfnapicmd;
@@ -341,12 +341,13 @@
 	return rel;
 }
 
-// traverse the conference member list for the specified member id and return it's pointer
+/* traverse the conference member list for the specified member id and return it's pointer */
 static conference_member_t *conference_member_get(conference_obj_t *conference, uint32_t id)
 {
 	conference_member_t *member = NULL;
 
 	for(member = conference->members; member; member = member->next) {
+
 		if (switch_test_flag(member, MFLAG_NOCHANNEL)) {
 			continue;
 		}
@@ -359,7 +360,7 @@
 	return member;
 }
 
-// stop the specified recording
+/* stop the specified recording */
 static int conference_record_stop(conference_obj_t *conference, char *path)
 {
 	conference_member_t *member = NULL;
@@ -433,6 +434,7 @@
 	member->energy_level = conference->energy_level;
 	conference->members = member;
 
+
 	if (!switch_test_flag(member, MFLAG_NOCHANNEL)) {
 		conference->count++;
 		if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
@@ -444,6 +446,7 @@
 			switch_event_fire(&event);
 		}
 
+
 		if (conference->enter_sound) {
 			conference_play_file(conference, conference->enter_sound, CONF_DEFAULT_LEADIN);
 		}
@@ -499,6 +502,7 @@
 		last = imember;
 	}
 
+
 	member->conference = NULL;
 
 	if (!switch_test_flag(member, MFLAG_NOCHANNEL)) {
@@ -539,7 +543,10 @@
 	switch_mutex_unlock(member->audio_in_mutex);
 	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,12 +757,12 @@
 			if (!switch_test_flag(imember, MFLAG_NOCHANNEL)) {
 				channel = switch_core_session_get_channel(imember->session);
 
-				// add this little bit to preserve the bridge cause code in case of an early media call that
-				// never answers
+				/* add this little bit to preserve the bridge cause code in case of an early media call that */
+				/* never answers */
 				if (switch_test_flag(conference, CFLAG_ANSWERED)) {
 					switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);	
 				} else 	{
-					// put actual cause code from outbound channel hangup here
+					/* put actual cause code from outbound channel hangup here */
 					switch_channel_hangup(channel, conference->bridge_hangup_cause);
 				}
 			}
@@ -778,7 +785,7 @@
 
 		// 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;
@@ -986,7 +993,7 @@
 	}
 }
 
-// marshall frames from the call leg to the conference thread for muxing to other call legs
+/* marshall frames from the call leg to the conference thread for muxing to other call legs */
 static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *obj)
 {
 	conference_member_t *member = obj;
@@ -1028,8 +1035,8 @@
 
 		energy_level = member->energy_level;
 
-		// if the member can speak, compute the audio energy level and
-		// generate events when the level crosses the threshold
+		/* if the member can speak, compute the audio energy level and */
+		/* generate events when the level crosses the threshold        */
 		if (switch_test_flag(member, MFLAG_CAN_SPEAK) && energy_level) {
 			uint32_t energy = 0, i = 0, samples = 0, j = 0, score = 0;
 			int16_t *data;
@@ -1119,7 +1126,7 @@
 	return NULL;
 }
 
-// launch an input thread for the call leg
+/* launch an input thread for the call leg */
 static void launch_conference_loop_input(conference_member_t *member, switch_memory_pool_t *pool)
 {
 	switch_thread_t *thread;
@@ -1152,8 +1159,8 @@
 };
 #define CCFNTBL_QTY (sizeof(ccfntbl)/sizeof(ccfntbl[0]))
 
-// marshall frames from the conference (or file or tts output) to the call leg
-// NB. this starts the input thread after some initial setup for the call leg
+/* marshall frames from the conference (or file or tts output) to the call leg */
+/* NB. this starts the input thread after some initial setup for the call leg */
 static void conference_loop_output(conference_member_t *member)
 {
 	switch_channel_t *channel;
@@ -1189,11 +1196,11 @@
 		switch_channel_answer(channel);
 	}
 
-	// Start the input thread
+	/* Start the input thread */
 	launch_conference_loop_input(member, switch_core_session_get_pool(member->session));
 
-	// 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!
+	/* 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)) {
 		char dtmf[128] = "";
 		uint8_t file_frame[CONF_BUFFER_SIZE] = {0};
@@ -1224,6 +1231,7 @@
 		}
 
 		if (switch_channel_test_flag(channel, CF_OUTBOUND)) {
+			/* test to see if outbound channel has answered */
 			if (switch_channel_test_flag(channel, CF_ANSWERED) && !switch_test_flag(member->conference, CFLAG_ANSWERED)) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Outbound conference channel answered, setting CFLAG_ANSWERED");
 				switch_set_flag(member->conference, CFLAG_ANSWERED);
@@ -1235,7 +1243,7 @@
 			}
 		}
 
-		// if we have caller digits, feed them to the parser to find an action
+		/* if we have caller digits, feed them to the parser to find an action */
 		if (switch_channel_has_dtmf(channel)) {
 			switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf));
 
@@ -1245,12 +1253,12 @@
 					caller_action = (caller_control_action_t *)switch_ivr_digit_stream_parser_feed(member->conference->dtmf_parser, *digit);
 				}
 			}
-		// otherwise, clock the parser so that it can handle digit timeout detection
+		/* 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');
 		}
 
-		// if a caller action has been detected, handle it
+		/* if a caller action has been detected, handle it */
 		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);
@@ -1267,13 +1275,13 @@
 					);
 			caller_action->fndesc->handler(member,caller_action->data);
 
-			// set up for next pass
+			/* set up for next pass */
 			caller_action = NULL;
 		}
 
-		// handle file and TTS frames
+		/* handle file and TTS frames */
 		if (member->fnode) {
-			// if we are done, clean it up
+			/* if we are done, clean it up */
 			if (member->fnode->done) {
 				confernce_file_node_t *fnode;
 				switch_memory_pool_t *pool;
@@ -1295,10 +1303,10 @@
 				switch_core_destroy_memory_pool(&pool);
 
 			} else {
-				// skip this frame until leadin time has expired
+				/* skip this frame until leadin time has expired */
 				if (member->fnode->leadin) {
 					member->fnode->leadin--;
-				} else {	// send the node frame instead of the conference frame to the call leg
+				} else {	/* send the node frame instead of the conference frame to the call leg */
 					if (member->fnode->type == NODE_TYPE_SPEECH) {
 						switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_BLOCKING;
 						uint32_t rate = member->conference->rate;
@@ -1337,7 +1345,7 @@
 					switch_core_timer_next(&timer);
 				}
 			}
-		} else {	// send the conferecne frame to the call leg
+		} else {	/* send the conferecne frame to the call leg */
 			switch_buffer_t *use_buffer = NULL;
 			uint32_t mux_used = (uint32_t)switch_buffer_inuse(member->mux_buffer);
 
@@ -1373,7 +1381,7 @@
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel leaving conference, cause: %s\n",
 			switch_channel_cause2str(switch_channel_get_cause(channel)));
 
-	// if it's an outbound channel, store the release cause in the conference struct, we might need it
+	/* if it's an outbound channel, store the release cause in the conference struct, we might need it */
 	if (switch_channel_test_flag(channel, CF_OUTBOUND)) {
 		member->conference->bridge_hangup_cause = switch_channel_get_cause(channel);
 	}
@@ -1516,7 +1524,7 @@
 	return count;
 }
 
-// stop playing a file for the member of the conference
+/* stop playing a file for the member of the conference */
 static uint32_t conference_member_stop_file(conference_member_t *member, file_stop_t stop)
 {
 	confernce_file_node_t *nptr;
@@ -1791,7 +1799,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-// execute a callback for every member of the conference
+/* execute a callback for every member of the conference */
 static void conference_member_itterator(conference_obj_t *conference, switch_stream_handle_t *stream, conf_api_member_cmd_t pfncallback, void *data)
 {
 	conference_member_t *member = NULL;
@@ -2436,12 +2444,12 @@
 
 		channel = switch_core_session_get_channel(member->session);
 
-		// build a new conference if it doesn't exist
+		/* build a new conference if it doesn't exist */
 		if (!(new_conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, argv[3]))) {
 			switch_memory_pool_t *pool;
 			char *conf_name;
 
-			// Setup a memory pool to use.
+			/* Setup a memory pool to use. */
 			if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
 				goto done;
@@ -2452,7 +2460,7 @@
 			if ((profile_name = strchr(conf_name, '@'))) {
 				*profile_name++ = '\0';
 
-				// Open the config from the xml registry 
+				/* Open the config from the xml registry  */
 				if (!(cxml = switch_xml_open_cfg(global_cf_name, &cfg, NULL))) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", global_cf_name);
 					goto done;
@@ -2463,13 +2471,13 @@
 				}
 			} 
 
-			// Release the config registry handle 
+			/* Release the config registry handle */
 			if (cxml) {
 				switch_xml_free(cxml);
 				cxml = NULL;
 			}
 
-			// Create the conference object.
+			/* Create the conference object. */
 			new_conference = conference_new(conf_name, profile, pool);
 
 			if (!new_conference) {
@@ -2477,23 +2485,23 @@
 				goto done;
 			}
 
-			// Set the minimum number of members (once you go above it you cannot go below it)
+			/* Set the minimum number of members (once you go above it you cannot go below it) */
 			new_conference->min = 1;
 
-			// Indicate the conference is dynamic
+			/* Indicate the conference is dynamic */
 			switch_set_flag_locked(new_conference, CFLAG_DYNAMIC);
 
-			// Start the conference thread for this conference
+			/* Start the conference thread for this conference */
 			launch_conference_thread(new_conference);
 		}
 
-		// move the member from the old conference to the new one
+		/* move the member from the old conference to the new one */
 		conference_del_member(member->last_conference, member);
 		conference_add_member(new_conference, member);
 
 		stream->write_function(stream, "OK Member %u sent to conference %s.\n", id, argv[3]);
 
-		// tell them what happened
+		/* tell them what happened */
 		if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
 			switch_channel_event_set_data(channel, event);
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
@@ -2598,7 +2606,7 @@
 		memset(argv,0,sizeof(argv));
 		argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
 
-		// try to find a command to execute
+		/* try to find a command to execute */
 		if (argc) {
 			int i,found=0;
 			uint32_t cnum = atoi(argv[0]);
@@ -2607,24 +2615,24 @@
 			if(cnum == 0 || (cnum != 0 && conference != NULL && argc >= 3)) {
 				int argn = (cnum != 0 ? 1 : 0);
 
-				// loop through the command table to find a match
+				/* loop through the command table to find a match */
 				for (i=0; i<CONFFUNCAPISIZE && !found; i++) {
 					if (strcasecmp(argv[argn],conf_api_sub_commands[i].pname) == 0) {
 						found = 1;
 						switch(conf_api_sub_commands[i].fntype) {
 
-							// commands that we've broken the command line into arguments for
+							/* commands that we've broken the command line into arguments for */
 							case CONF_API_SUB_ARGS_SPLIT:
 								{	conf_api_args_cmd_t pfn = (conf_api_args_cmd_t)conf_api_sub_commands[i].pfnapicmd;
 
 									if (pfn(conference, stream, argc, &argv[0]) != 0) {
-										// command returned error, so show syntax usage
+										/* command returned error, so show syntax usage */
 										stream->write_function(stream,conf_api_sub_commands[i].psyntax);
 										}
 								}
 								break;
 
-							// member specific command that can be itteratted
+							/* member specific command that can be itteratted */
 							case CONF_API_SUB_MEMBER_TARGET:
 								{
 									uint32_t id = atoi(argv[argn+1]);
@@ -2639,7 +2647,7 @@
 
 										switch_mutex_lock(conference->member_mutex);
 
-										// find last (oldest) member
+										/* find last (oldest) member */
 										member = conference->members;
 										while (member != NULL) {
 											if (last_member == NULL || member->id > last_member->id) {
@@ -2648,7 +2656,7 @@
 											member = member->next;
 										}
 
-										// exec functio on last (oldest) member
+										/* exec functio on last (oldest) member */
 										if (last_member != NULL) {
 											conf_api_member_cmd_t pfn = (conf_api_member_cmd_t)conf_api_sub_commands[i].pfnapicmd;
 											pfn(last_member, stream, argv[argn+2]);
@@ -2672,19 +2680,19 @@
 								}
 								break;
 
-							// commands that deals with all text after command
+							/* commands that deals with all text after command */
 							case CONF_API_SUB_ARGS_AS_ONE:
 								{	conf_api_text_cmd_t pfn = (conf_api_text_cmd_t)conf_api_sub_commands[i].pfnapicmd;
 									char *pstr = lbuf+strlen(conf_api_sub_commands[i].pname)+1;
 
-									// advance past all leading white space after command
+									/* advance past all leading white space after command */
 									while(*pstr == ' ' || *pstr == '\t') {
 										pstr++;
 									}
 
-									// call the command handler
+									/* call the command handler */
 									if (pfn(conference, stream, pstr) != 0) {
-										// command returned error, so show syntax usage
+										/* command returned error, so show syntax usage */
 										stream->write_function(stream,conf_api_sub_commands[i].psyntax);
 										}
 								}
@@ -2693,7 +2701,7 @@
 					}
 				}
 
-				// no command found
+				/* no command found */
 				if(!found) {
 					stream->write_function(stream, "Confernece command '%s' not found.\nTry 'help conference'\n", argv[argn]);
 				}
@@ -2715,9 +2723,10 @@
 	}
 
 	return status;
+
 }
 
-// outbound call bridge progress call state callback handler
+/* outbound call bridge progress call state callback handler */
 static switch_status_t audio_bridge_on_ring(switch_core_session_t *session)
 {
 	switch_channel_t *channel = NULL;
@@ -2729,7 +2738,6 @@
 
 	/* put the channel in a passive state so we can loop audio to it */
 	switch_channel_set_state(channel, CS_TRANSMIT);
-
 	return SWITCH_STATUS_FALSE;
 }
 
@@ -2743,7 +2751,7 @@
 	/*.on_hold */ NULL,
 };
 
-// generate an outbound call from the conference
+/* generate an outbound call from the conference */
 static switch_status_t conference_outcall(conference_obj_t *conference,
 										  switch_core_session_t *session,
 										  char *bridgeto,
@@ -2770,7 +2778,7 @@
 	
 	}
 
-	// establish an outbound call leg
+	/* establish an outbound call leg */
 	if (switch_ivr_originate(session,
 							 &peer_session,
 							 &cause,
@@ -2788,10 +2796,11 @@
 		goto done;
 	} 
 
+
 	peer_channel = switch_core_session_get_channel(peer_session);
 	assert(peer_channel != NULL);
 
-	// make sure the conference still exists
+	/* make sure the conference still exists */
 	if (!switch_test_flag(conference, CFLAG_RUNNING)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Conference is gone now, nevermind..\n");
 		if (caller_channel) {
@@ -2805,17 +2814,16 @@
 		switch_channel_answer(caller_channel);
 	}
 
-	// if the outbound call leg is ready
+	/* if the outbound call leg is ready */
 	if (switch_channel_test_flag(peer_channel, CF_ANSWERED) || switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA)) {
 		switch_caller_extension_t *extension = NULL;
 
-		// build an extension name object
+		/* build an extension name object */
 		if ((extension = switch_caller_extension_new(peer_session, conference->name, conference->name)) == 0) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "memory error!\n");
 			status = SWITCH_STATUS_MEMERR;
 			goto done;
 		}
-
 		/* add them to the conference */
 		if (flags) {
 			snprintf(appdata, sizeof(appdata), "%s +flags{%s}", conference->name, flags);
@@ -2826,6 +2834,7 @@
 
 		switch_channel_set_caller_extension(peer_channel, extension);
 		switch_channel_set_state(peer_channel, CS_EXECUTE);
+
 	} else {
 		switch_channel_hangup(peer_channel, SWITCH_CAUSE_NO_ANSWER);
 		status = SWITCH_STATUS_FALSE;
@@ -2843,7 +2852,7 @@
 	uint32_t x = 0;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 
-	// generate some space infront of the file to be played
+	/* generate some space infront of the file to be played */
 	for (x = 0; x < leadin; x++) {
 		switch_frame_t *read_frame;
 		switch_status_t status = switch_core_session_read_frame(session, &read_frame, 1000, 0);
@@ -2853,7 +2862,7 @@
 		}
 	}
 
-	// if all is well, really play the file
+	/* if all is well, really play the file */
 	if (status == SWITCH_STATUS_SUCCESS) {
 		status = switch_ivr_play_file(session, NULL, path, NULL, NULL, NULL, 0);
 	}
@@ -2897,7 +2906,7 @@
 		return;
 	}
 
-	// Start the conference muted or deaf ?
+	/* Start the conference muted or deaf ? */
 	if ((flags_str=strstr(mydata, flags_prefix))) {
 		char *p;
 
@@ -2914,7 +2923,7 @@
 		}
 	}
 
-	// is this a bridging conference ?
+	/* is this a bridging conference ? */
 	if (!strncasecmp(mydata, bridge_prefix, strlen(bridge_prefix))) {
 		isbr = 1;
 		mydata += strlen(bridge_prefix);
@@ -2928,12 +2937,12 @@
 
 	conf_name = mydata;
 
-	// is there a conference pin ?
+	/* is there a conference pin ? */
 	if ((dpin = strchr(conf_name, '+'))) {
 		*dpin++ = '\0';
 	}
 
-	// is there profile specification ?
+	/* is there profile specification ? */
 	if ((profile_name = strchr(conf_name, '@'))) {
 		*profile_name++ = '\0';
 
@@ -2948,8 +2957,8 @@
 		}
 	} 
 
-	// if this is a bridging call, and it's not a duplicate, build a
-	// conference object, and skip pin handling, and locked checking
+	/* if this is a bridging call, and it's not a duplicate, build a */
+	/* conference object, and skip pin handling, and locked checking */
 	if (isbr) {
 		char *uuid = switch_core_session_get_uuid(session);
 
@@ -2973,7 +2982,7 @@
 		/* Set the minimum number of members (once you go above it you cannot go below it) */
 		conference->min = 2;
 
-		// if the dialplan specified a pin, override the profile's value
+		/* if the dialplan specified a pin, override the profile's value */
 		if (dpin) {
 			conference->pin = switch_core_strdup(conference->pool, dpin);
 		}
@@ -2985,10 +2994,10 @@
 		launch_conference_thread(conference);
 
 	} else {
-		// if the conference exists, get the pointer to it
+		/* if the conference exists, get the pointer to it */
 		if ((conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, conf_name))) {
 			freepool = pool;
-		// couldn't find the conference, create one
+		/* couldn't find the conference, create one */
 		} else {
 			conference = conference_new(conf_name, profile, pool);
 
@@ -2997,7 +3006,7 @@
 				goto done;
 			}
 
-			// if the dialplan specified a pin, override the profile's value
+			/* if the dialplan specified a pin, override the profile's value */
 			if (dpin) {
 				conference->pin = switch_core_strdup(conference->pool, dpin);
 			}
@@ -3012,10 +3021,10 @@
 			launch_conference_thread(conference);
 		}
 
-		// if this is not an outbound call, deal with conference pins
+		/* if this is not an outbound call, deal with conference pins */
 		if (!switch_channel_test_flag(channel, CF_OUTBOUND) && conference->pin) {
 			char pin_buf[80] = "";
-			int  pin_retries = 3;	// XXX - this should be configurable - i'm too lazy to do it right now...
+			int  pin_retries = 3;	/* XXX - this should be configurable - i'm too lazy to do it right now... */
 			int  pin_valid = 0;
 			switch_status_t status = SWITCH_STATUS_SUCCESS;
 
@@ -3024,11 +3033,11 @@
 
 			while(!pin_valid && pin_retries && status == SWITCH_STATUS_SUCCESS) {
 
-				// be friendly
+				/* be friendly */
 				if (conference->pin_sound) {
 					conference_local_play_file(session, conference->pin_sound, 20, pin_buf, sizeof(pin_buf));
 				} 
-				// wait for them if neccessary
+				/* wait for them if neccessary */
 				if (strlen(pin_buf) < strlen(conference->pin)) {
 					char *buf = pin_buf + strlen(pin_buf);
 					char term = '\0';
@@ -3042,10 +3051,10 @@
 
 				pin_valid = (status == SWITCH_STATUS_SUCCESS && strcmp(pin_buf, conference->pin) == 0);
 				if (!pin_valid) {
-					// zero the collected pin
+					/* zero the collected pin */
 					memset(pin_buf,0,sizeof(pin_buf));
 
-					// more friendliness
+					/* more friendliness */
 					if (conference->bad_pin_sound) {
 						conference_local_play_file(session, conference->bad_pin_sound, 20, pin_buf, sizeof(pin_buf));
 					}
@@ -3058,7 +3067,7 @@
 			}
 		}
 
-		// don't allow more callers if the conference is locked, unless we invited them
+		/* don't allow more callers if the conference is locked, unless we invited them */
 		if (switch_test_flag(conference, CFLAG_LOCKED) && !switch_channel_test_flag(channel, CF_OUTBOUND)) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Conference %s is locked.\n", conf_name);
 			if (conference->locked_sound) {
@@ -3076,14 +3085,14 @@
 		cxml = NULL;
 	}
 
-	// if we're using "bridge:" make an outbound call and bridge it in
+	/* if we're using "bridge:" make an outbound call and bridge it in */
 	if (!switch_strlen_zero(bridgeto) && strcasecmp(bridgeto, "none")) {
 		if (conference_outcall(conference, session, bridgeto, 60, NULL, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
 			goto done;
 		}
 	} else {	
-		// if we're not using "bridge:" set the conference answered flag
-		// and this isn't an outbound channel, answer the call
+		/* if we're not using "bridge:" set the conference answered flag */
+		/* and this isn't an outbound channel, answer the call */
 		if (!switch_channel_test_flag(channel, CF_OUTBOUND)) 
 			switch_set_flag(conference, CFLAG_ANSWERED);
 	}
@@ -3096,9 +3105,7 @@
 	if (switch_core_codec_init(&member.read_codec,
 							   "L16",
 							   NULL,
-							   //conference->rate,
 							   read_codec->implementation->samples_per_second,
-							   //conference->interval,
 							   read_codec->implementation->microseconds_per_frame / 1000,
 							   1,
 							   SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
@@ -3135,9 +3142,7 @@
 							   "L16",
 							   NULL,
 							   conference->rate,
-							   //read_codec->implementation->samples_per_second,
 							   conference->interval,
-							   //read_codec->implementation->microseconds_per_frame / 1000,
 							   1,
 							   SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
 							   NULL,
@@ -3282,7 +3287,7 @@
 	/*.interface_name */	"conference",
 	/*.desc */		"Conference module commands",
 	/*.function */		conf_api_main,
-	/*.syntax */		// see switch_module_load
+	/*.syntax */		/* see switch_module_load, this is built on the fly */
 	/*.next */ 
 };
 
@@ -3332,6 +3337,7 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invaid Chat Interface [%s]!\n", proto);
 	}
 
+
 	if ((p = strchr(to, '@'))) {
 		switch_copy_string(name, to, ++p-to);
 	} else {
@@ -3354,12 +3360,15 @@
 	ci->chat_send(CONF_CHAT_PROTO, to, from, "", stream.data, NULL);
 	switch_safe_free(stream.data);
 
+
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
 static const switch_chat_interface_t conference_chat_interface = {
 	/*.name */ CONF_CHAT_PROTO,
 	/*.chat_send */ chat_send,
+
 };
 
 static switch_loadable_module_interface_t conference_module_interface = {
@@ -3389,12 +3398,12 @@
 			if (action_name != NULL) {
 				char *sep = (action_name != NULL ? strchr(action_name,' ') : NULL);
 
-				// split the action from any parameters
+				/* split the action from any parameters */
 				if (sep != NULL) {
 					*sep ='\0';
 				}
 
-				// find and execute the caller control handler
+				/* find and execute the caller control handler */
 				for(i=0,found=0; !found && i<CCFNTBL_QTY; i++) {
 					found = (ccfntbl[i].action != CALLER_CONTROL_MENU && strcasecmp(ccfntbl[i].key,action_name) == 0);
 					if (found) {
@@ -3453,30 +3462,30 @@
 		switch_xml_t xml_menus = switch_xml_child(profile, "menus");
 		switch_xml_t xml_menu = (xml_menus != NULL ? switch_xml_find_child(xml_menus, "menu", "name", menu_name) : NULL);
 
-		// if we found the requested menu in our profile
+		/* if we found the requested menu in our profile */
 		if (xml_menu != NULL && xml_menu != NULL) {
 			*ctx = (caller_control_menu_ctx_t *)switch_core_alloc(conference->pool,sizeof(caller_control_menu_ctx_t));
 
 			if (*ctx != NULL) {
 				memset(*ctx,0,sizeof(caller_control_menu_ctx_t));
 
-				// setup an xml parser context, and a menu stack context for the specified menu in our memory pool
+				/* setup an xml parser context, and a menu stack context for the specified menu in our memory pool */
 				status = switch_ivr_menu_stack_xml_init(&(*ctx)->xml_ctx, conference->pool);
 				if (status == SWITCH_STATUS_SUCCESS) {
 					(*ctx)->name = switch_core_strdup(conference->pool,menu_name);
 
-					// add our xml menu handler to the xml stack parser
+					/* add our xml menu handler to the xml stack parser */
 					status = switch_ivr_menu_stack_xml_add_custom((*ctx)->xml_ctx, "control", &conference_caller_control_menu_handler);
 					if (status != SWITCH_STATUS_SUCCESS)
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to add custom xml handler\n");
 
-					// parse the xml stack to build the menu stack
+					/* parse the xml stack to build the menu stack */
 					status = switch_ivr_menu_stack_xml_build((*ctx)->xml_ctx, &(*ctx)->menu_stack, xml_menus, xml_menu, conference->timer_name);
 					if (status != SWITCH_STATUS_SUCCESS)
 						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");
@@ -3540,7 +3549,7 @@
 	if (conference != NULL && profile != NULL && xml_controls != NULL) {
 		switch_xml_t xml_kvp;
 
-		// parse the controls tree for caller control digit strings
+		/* parse the controls tree for caller control digit strings */
 		for (xml_kvp = switch_xml_child(xml_controls, "control"); xml_kvp; xml_kvp = xml_kvp->next) {
 			char *key = (char *) switch_xml_attr(xml_kvp, "action");
 			char *val = (char *) switch_xml_attr(xml_kvp, "digits");
@@ -3549,9 +3558,9 @@
 			if(!switch_strlen_zero(key) && !switch_strlen_zero(val)) {
 				int i;
 
-				// scan through all of the valid actions, and if found,
-				// set the new caller control action digit string, then
-				// stop scanning the table, and go to the next xml kvp.
+				/* scan through all of the valid actions, and if found, */
+				/* set the new caller control action digit string, then */
+				/* stop scanning the table, and go to the next xml kvp. */
 				for(i=0,status=SWITCH_STATUS_NOOP; i<CCFNTBL_QTY && status == SWITCH_STATUS_NOOP; i++) {
 
 					if(strcasecmp(ccfntbl[i].key,key) == 0) {
@@ -3628,13 +3637,13 @@
 	uint32_t rate = 8000, interval = 20;
 	switch_status_t status;
 
-	// Validate the conference name
+	/* Validate the conference name */
 	if (switch_strlen_zero(name)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Record! no name.\n");
 		return NULL;
 	}
 
-	// parse the profile tree for param values
+	/* parse the profile tree for param values */
 	for (xml_kvp = switch_xml_child(profile, "param"); xml_kvp; xml_kvp = xml_kvp->next) {
 		char *var = (char *) switch_xml_attr_soft(xml_kvp, "name");
 		char *val = (char *) switch_xml_attr_soft(xml_kvp, "value");
@@ -3745,7 +3754,7 @@
 		return NULL;
 	}
 
-	// initialize the conference object with settings from the specified profile
+	/* initialize the conference object with settings from the specified profile */
 	conference->pool = pool;
 	conference->timer_name = switch_core_strdup(conference->pool, timer_name);
 	conference->tts_engine = switch_core_strdup(conference->pool, tts_engine);
@@ -3815,18 +3824,18 @@
 	conference->rate = rate;
 	conference->interval = interval;
 
-	// caller control configuration chores
+	/* 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 no controls specified in the config, assume all should be specified
+	/* 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"
+	/* 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
+			/* map in the default control handler strings if specified */
 			if (strcasecmp(controls_set,"default") == 0) {
 				status = conference_new_install_caller_controls_default(conference);
 			} else if (strcasecmp(controls_set,"custom") == 0) {
@@ -3861,7 +3870,7 @@
 
 	memset(&globals, 0, sizeof(globals));
 
-	// build api interface help ".syntax" field string
+	/* build api interface help ".syntax" field string */
 	p=strdup("list\n");
 	for (i=0; i<CONFFUNCAPISIZE; i++) {
 		nl=strlen(conf_api_sub_commands[i].psyntax)+4;
@@ -3876,14 +3885,14 @@
 		}
 		
 	}
-	// install api interface help ".syntax" field string
+	/* install api interface help ".syntax" field string */
 	if(p != NULL)
 		conf_api_interface.syntax = p;
 
 	/* Connect my internal structure to the blank pointer passed to me */
 	*module_interface = &conference_module_interface;
 
-	// create/register custom event message type
+	/* create/register custom event message type */
 	if (switch_event_reserve_subclass(CONF_EVENT_MAINT) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!", CONF_EVENT_MAINT);
 		return SWITCH_STATUS_TERM;
@@ -3911,15 +3920,15 @@
 
 
 	if (globals.running) {
-		// signal all threads to shutdown
+		/* signal all threads to shutdown */
 		globals.running = 0;
-		// wait for all threads
+		/* wait for all threads */
 		while (globals.threads) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Waiting for %d threads\n", globals.threads);
 			switch_yield(100000);
 		}
 
-		// free api interface help ".syntax" field string
+		/* free api interface help ".syntax" field string */
 		if (conf_api_interface.syntax != NULL)
 			free((char *)conf_api_interface.syntax);
 	}



More information about the Freeswitch-svn mailing list