[libpri-commits] rmudgett: branch rmudgett/t312 r2223 - /team/rmudgett/t312/

SVN commits to the libpri project libpri-commits at lists.digium.com
Fri Feb 25 19:54:18 CST 2011


Author: rmudgett
Date: Fri Feb 25 19:54:14 2011
New Revision: 2223

URL: http://svnview.digium.com/svn/libpri?view=rev&rev=2223
Log:
Make pri_dump_info_str() more useful.

Modified:
    team/rmudgett/t312/pri.c
    team/rmudgett/t312/pri_facility.c

Modified: team/rmudgett/t312/pri.c
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/t312/pri.c?view=diff&rev=2223&r1=2222&r2=2223
==============================================================================
--- team/rmudgett/t312/pri.c (original)
+++ team/rmudgett/t312/pri.c Fri Feb 25 19:54:14 2011
@@ -1712,6 +1712,10 @@
 	size_t used;
 	struct q921_frame *f;
 	struct q921_link *link;
+	struct pri_cc_record *cc_record;
+	struct q931_call *call;
+	unsigned num_calls;
+	unsigned num_globals;
 	unsigned q921outstanding;
 	unsigned idx;
 	unsigned long switch_bit;
@@ -1730,7 +1734,8 @@
 	used = 0;
 	used = pri_snprintf(buf, used, buf_size, "Switchtype: %s\n",
 		pri_switch2str(ctrl->switchtype));
-	used = pri_snprintf(buf, used, buf_size, "Type: %s\n", pri_node2str(ctrl->localtype));
+	used = pri_snprintf(buf, used, buf_size, "Type: %s%s\n",
+		pri_node2str(ctrl->localtype), PTMP_MODE(ctrl) ? " PTMP" : "");
 	used = pri_snprintf(buf, used, buf_size, "Overlap Dial: %d\n", ctrl->overlapdial);
 	used = pri_snprintf(buf, used, buf_size, "Logical Channel Mapping: %d\n",
 		ctrl->chan_mapping_logical);
@@ -1747,6 +1752,7 @@
 			}
 		}
 	}
+
 	/* Remember that Q921 Counters include Q931 packets (and any retransmissions) */
 	used = pri_snprintf(buf, used, buf_size, "Q931 RX: %d\n", ctrl->q931_rxcount);
 	used = pri_snprintf(buf, used, buf_size, "Q931 TX: %d\n", ctrl->q931_txcount);
@@ -1760,38 +1766,38 @@
 		used = pri_snprintf(buf, used, buf_size, "Q921 Outstanding: %u (TEI=%d)\n",
 			q921outstanding, link->tei);
 	}
-#define DEBUG_CALL_RECORDS
-#if defined(DEBUG_CALL_RECORDS)
-	{
-		struct q931_call *call;
-		int num_calls;
-
-		num_calls = 0;
-		for (call = *ctrl->callpool; call; call = call->next) {
-			++num_calls;
-			if (call->outboundbroadcast) {
-				used = pri_snprintf(buf, used, buf_size,
-					"Master call subcall count: %d\n", q931_get_subcall_count(call));
-			}
-		}
-		used = pri_snprintf(buf, used, buf_size, "Total call records: %d\n", num_calls);
-	}
-#endif	/* defined(DEBUG_CALL_RECORDS) */
-#define DEBUG_CC_RECORDS
-#if defined(DEBUG_CC_RECORDS)
-	{
-		struct pri_cc_record *cc_record;
-
-		used = pri_snprintf(buf, used, buf_size, "CC records:\n");
-		for (cc_record = ctrl->cc.pool; cc_record; cc_record = cc_record->next) {
+
+	/* Count the call records in existance. */
+	num_calls = 0;
+	num_globals = 0;
+	for (call = *ctrl->callpool; call; call = call->next) {
+		if (!(call->cr & ~Q931_CALL_REFERENCE_FLAG)) {
+			++num_globals;
+			continue;
+		}
+		++num_calls;
+		if (call->outboundbroadcast) {
 			used = pri_snprintf(buf, used, buf_size,
-				"  %ld A:%s B:%s state:%s\n", cc_record->record_id,
-				cc_record->party_a.number.valid ? cc_record->party_a.number.str : "",
-				cc_record->party_b.number.valid ? cc_record->party_b.number.str : "",
-				pri_cc_fsm_state_str(cc_record->state));
-		}
-	}
-#endif	/* defined(DEBUG_CC_RECORDS) */
+				"Master call subcall count: %d\n", q931_get_subcall_count(call));
+		}
+	}
+	used = pri_snprintf(buf, used, buf_size, "Total calls:%u global:%u\n", num_calls,
+		num_globals);
+
+	/*
+	 * List simplified call completion records.
+	 *
+	 * This should be last in the output because it could overflow
+	 * the buffer.
+	 */
+	used = pri_snprintf(buf, used, buf_size, "CC records:\n");
+	for (cc_record = ctrl->cc.pool; cc_record; cc_record = cc_record->next) {
+		used = pri_snprintf(buf, used, buf_size,
+			"  %ld A:%s B:%s state:%s\n", cc_record->record_id,
+			cc_record->party_a.number.valid ? cc_record->party_a.number.str : "",
+			cc_record->party_b.number.valid ? cc_record->party_b.number.str : "",
+			pri_cc_fsm_state_str(cc_record->state));
+	}
 
 	if (buf_size < used) {
 		pri_message(ctrl,

Modified: team/rmudgett/t312/pri_facility.c
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/t312/pri_facility.c?view=diff&rev=2223&r1=2222&r2=2223
==============================================================================
--- team/rmudgett/t312/pri_facility.c (original)
+++ team/rmudgett/t312/pri_facility.c Fri Feb 25 19:54:14 2011
@@ -1907,7 +1907,7 @@
 	msg.operation = ROSE_NI2_InitiateTransfer;
 	msg.invoke_id = get_invokeid(ctrl);
 	/* Let's do the trickery to make sure the flag is correct */
-	msg.args.ni2.InitiateTransfer.call_reference = call->cr ^ 0x8000;
+	msg.args.ni2.InitiateTransfer.call_reference = call->cr ^ Q931_CALL_REFERENCE_FLAG;
 	pos = rose_encode_invoke(ctrl, pos, end, &msg);
 
 	return pos;




More information about the libpri-commits mailing list