[asterisk-commits] dvossel: branch dvossel/hd_confbridge r309637 - in /team/dvossel/hd_confbridg...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Mar 4 16:45:36 CST 2011


Author: dvossel
Date: Fri Mar  4 16:45:31 2011
New Revision: 309637

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=309637
Log:
Addition of the playback action without continuing the dtmf sequence

Modified:
    team/dvossel/hd_confbridge/apps/app_confbridge.c
    team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c
    team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h
    team/dvossel/hd_confbridge/configs/confbridge.conf.sample
    team/dvossel/hd_confbridge/main/bridging.c

Modified: team/dvossel/hd_confbridge/apps/app_confbridge.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/apps/app_confbridge.c?view=diff&rev=309637&r1=309636&r2=309637
==============================================================================
--- team/dvossel/hd_confbridge/apps/app_confbridge.c (original)
+++ team/dvossel/hd_confbridge/apps/app_confbridge.c Fri Mar  4 16:45:31 2011
@@ -674,7 +674,16 @@
 	return ast_stream_and_wait(bridge_channel->chan, (conference_bridge_user->features.mute ? "conf-muted" : "conf-unmuted"), "");
 }
 
-static int action_playback(struct conference_bridge *conference_bridge,
+static int action_playback(struct ast_bridge_channel *bridge_channel, const char *playback_file)
+{
+	if (ast_stream_and_wait(bridge_channel->chan, playback_file, "")) {
+		ast_log(LOG_WARNING, "Failed to playback file %s to channel\n", playback_file);
+		return -1;
+	}
+	return 0;
+}
+
+static int action_playback_and_continue(struct conference_bridge *conference_bridge,
 	struct conference_bridge_user *conference_bridge_user,
 	struct ast_bridge_channel *bridge_channel,
 	struct conf_menu *menu,
@@ -747,7 +756,10 @@
 				bridge_channel);
 			break;
 		case MENU_ACTION_PLAYBACK:
-			res |= action_playback(conference_bridge,
+			res |= action_playback(bridge_channel, menu_action->data.playback_file);
+			break;
+		case MENU_ACTION_PLAYBACK_AND_CONTINUE:
+			res |= action_playback_and_continue(conference_bridge,
 				conference_bridge_user,
 				bridge_channel,
 				menu,

Modified: team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c?view=diff&rev=309637&r1=309636&r2=309637
==============================================================================
--- team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c (original)
+++ team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c Fri Mar  4 16:45:31 2011
@@ -243,6 +243,7 @@
 	case MENU_ACTION_TOGGLE_MUTE:
 		break;
 	case MENU_ACTION_PLAYBACK:
+	case MENU_ACTION_PLAYBACK_AND_CONTINUE:
 		if (!(ast_strlen_zero(databuf))) {
 			ast_copy_string(menu_action->data.playback_file, databuf, sizeof(menu_action->data.playback_file));
 		} else {
@@ -262,23 +263,29 @@
 	struct conf_menu_entry *menu_entry = ast_calloc(1, sizeof(*menu_entry));
 	int res = 0;
 	unsigned int action_len = strlen(action);
+	char *filename;
+	char *tmp;
+
 	if (!(menu_entry)) {
 		return -1;
 	}
 	ast_copy_string(menu_entry->dtmf, dtmf, sizeof(menu_entry->dtmf));
 	if (!strcasecmp(action, "toggle_mute")) {
 		res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_TOGGLE_MUTE, NULL);
-	}
-	if (action_len >= 8 && !strncasecmp(action, "playback", 8)) {
-		char *filename = ast_strdupa(action);
-		char *tmp;
+	} else if (action_len >= 21 && !strncasecmp(action, "playback_and_continue", 21)) {
+		filename = ast_strdupa(action);
 		if ((filename = strchr(action, '(')) && (tmp = strrchr(filename, ')'))) {
 			*tmp = '\0';
 			filename++;
-			res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_PLAYBACK, filename);
-		} else {
-			res |= -1;
-		}
+		}
+		res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_PLAYBACK_AND_CONTINUE, filename);
+	} else if (action_len >= 8 && !strncasecmp(action, "playback", 8)) {
+		filename = ast_strdupa(action);
+		if ((filename = strchr(action, '(')) && (tmp = strrchr(filename, ')'))) {
+			*tmp = '\0';
+			filename++;
+		}
+		res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_PLAYBACK, filename);
 	}
 
 	/* if adding any of the actions failed, bail */
@@ -533,6 +540,9 @@
 			case MENU_ACTION_PLAYBACK:
 				ast_cli(a->fd, "playback(%s)", menu_action->data.playback_file);
 				break;
+			case MENU_ACTION_PLAYBACK_AND_CONTINUE:
+				ast_cli(a->fd, "playback_and_continue(%s)", menu_action->data.playback_file);
+				break;
 			}
 
 			action_num++;
@@ -731,6 +741,7 @@
 int conf_find_menu_entry_by_sequence(const char *dtmf_sequence, struct conf_menu *menu, struct conf_menu_entry *result)
 {
 	struct conf_menu_entry *menu_entry = NULL;
+
 	ao2_lock(menu);
 	AST_LIST_TRAVERSE(&menu->entries, menu_entry, entry) {
 		if (!strcasecmp(menu_entry->dtmf, dtmf_sequence)) {

Modified: team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h?view=diff&rev=309637&r1=309636&r2=309637
==============================================================================
--- team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h (original)
+++ team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h Fri Mar  4 16:45:31 2011
@@ -43,6 +43,7 @@
 enum conf_menu_action_id {
 	MENU_ACTION_TOGGLE_MUTE = 1,
 	MENU_ACTION_PLAYBACK,
+	MENU_ACTION_PLAYBACK_AND_CONTINUE,
 };
 
 /*! The conference menu action contains both

Modified: team/dvossel/hd_confbridge/configs/confbridge.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/configs/confbridge.conf.sample?view=diff&rev=309637&r1=309636&r2=309637
==============================================================================
--- team/dvossel/hd_confbridge/configs/confbridge.conf.sample (original)
+++ team/dvossel/hd_confbridge/configs/confbridge.conf.sample Fri Mar  4 16:45:31 2011
@@ -31,8 +31,12 @@
                                ; closest sample rate Asterisk does support to the one requested
                                ; will be used.
 
-[sample_menu]
-type=menu
-*1=toggle_mute        ; Toggle turning on and off mute.  Mute will make the user silent
-                      ; to everyone else, but the user will still be able to listen in.
+;[sample_menu]
+;type=menu
+;*=playback_and_continue(conf-usermenu) ; playback_and_continue will play back a prompt
+                                        ; while continuing to collect the dtmf sequence
+;*1=toggle_mute        ; Toggle turning on and off mute.  Mute will make the user silent
+                       ; to everyone else, but the user will still be able to listen in.
+;*2=playback(tt-weasels)  ; playback will play a prompt back to the user but will not
+                          ; continue to collect the dtmf sequence.
 

Modified: team/dvossel/hd_confbridge/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/main/bridging.c?view=diff&rev=309637&r1=309636&r2=309637
==============================================================================
--- team/dvossel/hd_confbridge/main/bridging.c (original)
+++ team/dvossel/hd_confbridge/main/bridging.c Fri Mar  4 16:45:31 2011
@@ -819,6 +819,7 @@
 			/* If this hook matches just break out now */
 			if (!strcmp(hook->dtmf, dtmf)) {
 				ast_debug(1, "DTMF feature hook %p matched DTMF string '%s' on bridge channel %p\n", hook, dtmf, bridge_channel);
+				look_for_dtmf = 0;
 				break;
 			} else if (!strncmp(hook->dtmf, dtmf, dtmf_len)) {
 				ast_debug(1, "DTMF feature hook %p can match DTMF string '%s', it wants '%s', on bridge channel %p\n", hook, dtmf, hook->dtmf, bridge_channel);




More information about the asterisk-commits mailing list