[asterisk-commits] rmudgett: branch rmudgett/bridge_phase r385383 - /team/rmudgett/bridge_phase/...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Apr 11 17:15:44 CDT 2013


Author: rmudgett
Date: Thu Apr 11 17:15:41 2013
New Revision: 385383

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=385383
Log:
Extracted tech capability and tech preference to string functions.

Modified:
    team/rmudgett/bridge_phase/main/bridging.c

Modified: team/rmudgett/bridge_phase/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_phase/main/bridging.c?view=diff&rev=385383&r1=385382&r2=385383
==============================================================================
--- team/rmudgett/bridge_phase/main/bridging.c (original)
+++ team/rmudgett/bridge_phase/main/bridging.c Thu Apr 11 17:15:41 2013
@@ -4370,6 +4370,47 @@
 	return CLI_SUCCESS;
 }
 
+/*! Bridge technology capabilities to string. */
+static const char *tech_capability2str(uint32_t capabilities)
+{
+	const char *type;
+
+	if (capabilities & AST_BRIDGE_CAPABILITY_HOLDING) {
+		type = "Holding";
+	} else if (capabilities & AST_BRIDGE_CAPABILITY_EARLY) {
+		type = "Early";
+	} else if (capabilities & AST_BRIDGE_CAPABILITY_NATIVE) {
+		type = "Native";
+	} else if (capabilities & AST_BRIDGE_CAPABILITY_1TO1MIX) {
+		type = "1to1Mix";
+	} else if (capabilities & AST_BRIDGE_CAPABILITY_MULTIMIX) {
+		type = "MultiMix";
+	} else {
+		type = "<Unknown>";
+	}
+	return type;
+}
+
+/*! Bridge technology priority preference to string. */
+static const char *tech_preference2str(enum ast_bridge_preference preference)
+{
+	const char *priority;
+
+	priority = "<Unknown>";
+	switch (preference) {
+	case AST_BRIDGE_PREFERENCE_HIGH:
+		priority = "High";
+		break;
+	case AST_BRIDGE_PREFERENCE_MEDIUM:
+		priority = "Medium";
+		break;
+	case AST_BRIDGE_PREFERENCE_LOW:
+		priority = "Low";
+		break;
+	}
+	return priority;
+}
+
 static char *handle_bridge_technology_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 #define FORMAT "%-20s %-20s %-10s %s\n"
@@ -4394,33 +4435,10 @@
 		const char *priority;
 
 		/* Decode type for display */
-		if (cur->capabilities & AST_BRIDGE_CAPABILITY_HOLDING) {
-			type = "Holding";
-		} else if (cur->capabilities & AST_BRIDGE_CAPABILITY_EARLY) {
-			type = "Early";
-		} else if (cur->capabilities & AST_BRIDGE_CAPABILITY_NATIVE) {
-			type = "Native";
-		} else if (cur->capabilities & AST_BRIDGE_CAPABILITY_1TO1MIX) {
-			type = "1to1Mix";
-		} else if (cur->capabilities & AST_BRIDGE_CAPABILITY_MULTIMIX) {
-			type = "MultiMix";
-		} else {
-			type = "<Unknown>";
-		}
-
-		/* Decode priority for display */
-		priority = "<Unknown>";
-		switch (cur->preference) {
-		case AST_BRIDGE_PREFERENCE_HIGH:
-			priority = "High";
-			break;
-		case AST_BRIDGE_PREFERENCE_MEDIUM:
-			priority = "Medium";
-			break;
-		case AST_BRIDGE_PREFERENCE_LOW:
-			priority = "Low";
-			break;
-		}
+		type = tech_capability2str(cur->capabilities);
+
+		/* Decode priority preference for display */
+		priority = tech_preference2str(cur->preference);
 
 		ast_cli(a->fd, FORMAT, cur->name, type, priority, AST_CLI_YESNO(cur->suspended));
 	}




More information about the asterisk-commits mailing list