[svn-commits] moy: branch moy/mfcr2 r126734 - /team/moy/mfcr2/channels/chan_zap.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Jun 30 23:20:04 CDT 2008


Author: moy
Date: Mon Jun 30 23:20:03 2008
New Revision: 126734

URL: http://svn.digium.com/view/asterisk?view=rev&rev=126734
Log:
added mfcr2 set blocked command

Modified:
    team/moy/mfcr2/channels/chan_zap.c

Modified: team/moy/mfcr2/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/moy/mfcr2/channels/chan_zap.c?view=diff&rev=126734&r1=126733&r2=126734
==============================================================================
--- team/moy/mfcr2/channels/chan_zap.c (original)
+++ team/moy/mfcr2/channels/chan_zap.c Mon Jun 30 23:20:03 2008
@@ -12751,12 +12751,56 @@
 	return CLI_SUCCESS;
 }
 
+static char *handle_mfcr2_set_blocked(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+	struct zt_pvt *p = NULL;
+	int channo = 0;
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "mfcr2 set blocked";
+		e->usage = 
+			"Usage: mfcr2 set blocked <channel>\n"
+			"       DON'T USE THIS UNLESS YOU KNOW WHAT YOU ARE DOING.\n"
+			"       Force the given channel into IDLE state.\n"
+			"       If no channel is specified, all channels will be set to IDLE.\n";
+		return NULL;
+	case CLI_GENERATE:
+		return NULL;
+	}
+	channo = (a->argc == 4) ? atoi(a->argv[3]) : -1;
+	ast_mutex_lock(&iflock);
+	p = iflist;
+	while (p) {
+		if (!(p->sig & SIG_MFCR2) || !p->r2chan) {
+			p = p->next;
+			continue;
+		}
+		if ((channo != -1) && (p->channel != channo )) {
+			p = p->next;
+			continue;
+		}
+		openr2_proto_set_blocked(p->r2chan);
+		openr2_proto_handle_abcd_change(p->r2chan);
+		if (channo != -1) {
+			break;
+		} else {
+			p = p->next;
+		}
+	}
+	if ((channo != -1) && !p) {
+		ast_cli(a->fd, "MFC/R2 channel %d not found.\n", channo);
+	}
+	ast_mutex_unlock(&iflock);
+	return CLI_SUCCESS;
+}
+
 static struct ast_cli_entry zap_mfcr2_cli[] = {
 	AST_CLI_DEFINE(handle_mfcr2_version, "Show OpenR2 library version"),
 	AST_CLI_DEFINE(handle_mfcr2_show_channels, "Show MFC/R2 channels"),
 	AST_CLI_DEFINE(handle_mfcr2_set_debug, "Set MFC/R2 channel logging level"),
 	AST_CLI_DEFINE(handle_mfcr2_call_files, "Enable/Disable MFC/R2 call files"),
 	AST_CLI_DEFINE(handle_mfcr2_set_idle, "Reset MFC/R2 channel forcing it to IDLE"),
+	AST_CLI_DEFINE(handle_mfcr2_set_blocked, "Reset MFC/R2 channel forcing it to BLOCKED"),
 };
 
 #endif /* HAVE_OPENR2 */




More information about the svn-commits mailing list