[asterisk-commits] dhubbard: branch group/issue3450 r138811 - /team/group/issue3450/channels/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Aug 19 09:32:13 CDT 2008


Author: dhubbard
Date: Tue Aug 19 09:32:12 2008
New Revision: 138811

URL: http://svn.digium.com/view/asterisk?view=rev&rev=138811
Log:
code cleanup stuffz

Modified:
    team/group/issue3450/channels/chan_dahdi.c

Modified: team/group/issue3450/channels/chan_dahdi.c
URL: http://svn.digium.com/view/asterisk/team/group/issue3450/channels/chan_dahdi.c?view=diff&rev=138811&r1=138810&r2=138811
==============================================================================
--- team/group/issue3450/channels/chan_dahdi.c (original)
+++ team/group/issue3450/channels/chan_dahdi.c Tue Aug 19 09:32:12 2008
@@ -10844,10 +10844,9 @@
 							if (why & SRVST_NEAREND) {
 								snprintf(db_answer, sizeof(db_answer), "%s:%d", SRVST_TYPE_OOS, SRVST_NEAREND);
 								ast_db_put(db_chan_name, SRVST_DBKEY, db_answer);
-								ast_log(LOG_DEBUG, "channel '%d' is far-end enabled, but the near-end is out-of-service.\n", ch);
+								ast_debug(2, "channel '%d' service state { near: out-of-service,  far: in-service }\n", ch);
 							}
-						} else
-							ast_log(LOG_WARNING, "Huh??  Channel '%s' wasn't listed in the persistent storage database\n", db_chan_name);
+						}
 						break;
 					case 2: /* out-of-service */
 						if (why == -1) {
@@ -10861,18 +10860,18 @@
 					default:
 						ast_log(LOG_ERROR, "Huh?  changestatus is: %d\n", e->service.changestatus);
 					}
-					ast_log(LOG_WARNING, "Received service change status %d on channel %d/%d span %d (logical: %d)\n",
-						e->service.changestatus, PRI_SPAN(e->service.channel), PRI_CHANNEL(e->service.channel), pri->span, ch);
+					ast_log(LOG_NOTICE, "Channel %d/%d span %d (logical: %d) received a change of service message, status '%d'\n",
+						PRI_SPAN(e->service.channel), PRI_CHANNEL(e->service.channel), pri->span, ch, e->service.changestatus);
 				}
 				break;
 			case PRI_EVENT_SERVICE_ACK:
 				chanpos = pri_find_principle(pri, e->service_ack.channel);
 				if (chanpos < 0) {
-					ast_log(LOG_WARNING, "Received service acknowledge change status %d on unconfigured channel %d/%d span %d\n",
+					ast_log(LOG_WARNING, "Received service acknowledge change status '%d' on unconfigured channel %d/%d span %d\n",
 						e->service_ack.changestatus, PRI_SPAN(e->service_ack.channel), PRI_CHANNEL(e->service_ack.channel), pri->span);
 				} else {
-					ast_log(LOG_WARNING, "Received service acknowledge change status %d on channel %d/%d span %d\n",
-						e->service_ack.changestatus, PRI_SPAN(e->service_ack.channel), PRI_CHANNEL(e->service_ack.channel), pri->span);
+					ast_debug(2, "Channel %d/%d span %d received a change os service acknowledgement message, status '%d'\n",
+						PRI_SPAN(e->service_ack.channel), PRI_CHANNEL(e->service_ack.channel), pri->span, e->service_ack.changestatus);
 				}
 				break;
 			case PRI_EVENT_RING:
@@ -11821,22 +11820,18 @@
 
 static char *handle_pri_service_generic(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a, int changestatus)
 {
+	int why;
 	int channel;
+	int trunkgroup;
+	int x, y, fd = a->fd;
 	int interfaceid = 0;
-	struct dahdi_pvt *tmp = NULL;
-	int x;
-	int y;
+	char *c;
+	char state;
+	char db_answer[5];
+	char db_chan_name[20];
+	struct dahdi_pvt *start, *tmp = NULL;
+	struct dahdi_pri *pri = NULL;
 	ast_mutex_t *lock;
-	struct dahdi_pvt *start;
-	char *c;
-	int trunkgroup;
-	struct dahdi_pri *pri=NULL;
-	int fd = a->fd;
-	char db_chan_name[20];
-	char db_answer[5];
-	char state;
-	int why;
-
 	
 	lock = &iflock;
 	start = iflist;
@@ -11868,8 +11863,8 @@
 		interfaceid = atoi(a->argv[5]);
 
 	/* either servicing a D-Channel */
-	for (x=0;x<NUM_SPANS;x++) {
-		for (y=0;y<NUM_DCHANS;y++) {
+	for (x = 0; x < NUM_SPANS; x++) {
+		for (y = 0; y < NUM_DCHANS; y++) {
 			if (pris[x].dchannels[y] == channel) {
 				pri = pris + x;
 				pri_maintenance_service(pri->pri, interfaceid, -1, changestatus);
@@ -11883,14 +11878,12 @@
 	tmp = start;
 	while (tmp) {
 		if (tmp->pri && tmp->channel == channel) {
-
 			why = -1;
 			snprintf(db_chan_name, sizeof(db_chan_name), "%s/%d", dahdi_db, channel);
 			if (!ast_db_get(db_chan_name, SRVST_DBKEY, db_answer, sizeof(db_answer))) {
 				sscanf(db_answer, "%c:%d", &state, &why);
 				ast_db_del(db_chan_name, SRVST_DBKEY);
 			}
-
 			switch(changestatus) {
 			case 0: /* enable */
 				if (why > -1) {
@@ -11898,11 +11891,11 @@
 						why = SRVST_FAREND;
 						snprintf(db_answer, sizeof(db_answer), "%s:%d", SRVST_TYPE_OOS, why);
 						ast_db_put(db_chan_name, SRVST_DBKEY, db_answer);
-						ast_debug(3, "channel '%d' is near-end enabled, but the far-end is out of service.\n", channel);
+						ast_debug(2, "channel '%d' service state { near: in-service,  far: out-of-service }\n", channel);
 					}
 				}
 				break;
-			//case 1: /* loop */
+			/* case 1:  -- loop */
 			case 2: /* disable */
 				if (why == -1) {
 					why = SRVST_NEAREND;
@@ -11912,10 +11905,10 @@
 				snprintf(db_answer, sizeof(db_answer), "%s:%d", SRVST_TYPE_OOS, why);
 				ast_db_put(db_chan_name, SRVST_DBKEY, db_answer);
 				break;
-			//case 3: /* continuity */
-			//case 4: /* shutdown */
+			/* case 3:  -- continuity */
+			/* case 4:  -- shutdown */
 			default:
-				ast_log(LOG_ERROR, "Unsupported changestatus: '%d'\n", changestatus);
+				ast_log(LOG_WARNING, "Unsupported changestatus: '%d'\n", changestatus);
 			}
 			pri_maintenance_service(tmp->pri->pri, PRI_SPAN(PVT_TO_CHANNEL(tmp)), PVT_TO_CHANNEL(tmp), changestatus);
 			ast_mutex_unlock(lock);




More information about the asterisk-commits mailing list