[libpri-commits] rmudgett: branch 1.4 r2232 - /branches/1.4/
SVN commits to the libpri project
libpri-commits at lists.digium.com
Mon Feb 28 17:20:28 CST 2011
Author: rmudgett
Date: Mon Feb 28 17:20:25 2011
New Revision: 2232
URL: http://svnview.digium.com/svn/libpri?view=rev&rev=2232
Log:
Improve the usefulness of pri_dump_info_str() output.
* Add BRI and PTMP strings to node type config when configured that way.
* Move Q.921 statistics to after configuration settings.
* Add call and cc_record debug statistics to pri_dump_info_str().
Modified:
branches/1.4/pri.c
branches/1.4/pri_cc.c
branches/1.4/pri_internal.h
branches/1.4/q931.c
Modified: branches/1.4/pri.c
URL: http://svnview.digium.com/svn/libpri/branches/1.4/pri.c?view=diff&rev=2232&r1=2231&r2=2232
==============================================================================
--- branches/1.4/pri.c (original)
+++ branches/1.4/pri.c Mon Feb 28 17:20:25 2011
@@ -1710,6 +1710,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;
@@ -1728,9 +1732,29 @@
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%s\n",
+ ctrl->bri ? "BRI " : "",
+ pri_node2str(ctrl->localtype),
+ PTMP_MODE(ctrl) ? " PTMP" : "");
used = pri_snprintf(buf, used, buf_size, "Remote type: %s\n",
pri_node2str(ctrl->remotetype));
+ 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);
+ used = pri_snprintf(buf, used, buf_size, "Timer and counter settings:\n");
+ switch_bit = PRI_BIT(ctrl->switchtype);
+ for (idx = 0; idx < ARRAY_LEN(pri_timer); ++idx) {
+ if (pri_timer[idx].used_by & switch_bit) {
+ enum PRI_TIMERS_AND_COUNTERS tmr;
+
+ tmr = pri_timer[idx].number;
+ if (0 <= ctrl->timers[tmr]) {
+ used = pri_snprintf(buf, used, buf_size, " %s: %d\n",
+ pri_timer[idx].name, ctrl->timers[tmr]);
+ }
+ }
+ }
+
/* 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);
@@ -1744,29 +1768,37 @@
used = pri_snprintf(buf, used, buf_size, "Q921 Outstanding: %u (TEI=%d)\n",
q921outstanding, link->tei);
}
-#if 0
- used = pri_snprintf(buf, used, buf_size, "Window Length: %d/%d\n",
- ctrl->timers[PRI_TIMER_K], ctrl->window);
- used = pri_snprintf(buf, used, buf_size, "Sentrej: %d\n", ctrl->sentrej);
- used = pri_snprintf(buf, used, buf_size, "SolicitFbit: %d\n", ctrl->solicitfbit);
- used = pri_snprintf(buf, used, buf_size, "Retrans: %d\n", ctrl->retrans);
- used = pri_snprintf(buf, used, buf_size, "Busy: %d\n", ctrl->busy);
-#endif
- 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);
- used = pri_snprintf(buf, used, buf_size, "Timer and counter settings:\n");
- switch_bit = PRI_BIT(ctrl->switchtype);
- for (idx = 0; idx < ARRAY_LEN(pri_timer); ++idx) {
- if (pri_timer[idx].used_by & switch_bit) {
- enum PRI_TIMERS_AND_COUNTERS tmr;
-
- tmr = pri_timer[idx].number;
- if (0 <= ctrl->timers[tmr]) {
- used = pri_snprintf(buf, used, buf_size, " %s: %d\n",
- pri_timer[idx].name, ctrl->timers[tmr]);
- }
- }
+
+ /* Count the call records in existance. Useful to check for unreleased calls. */
+ 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,
+ "Master call subcall count: %d\n", q931_get_subcall_count(call));
+ }
+ }
+ used = pri_snprintf(buf, used, buf_size, "Total active-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) {
Modified: branches/1.4/pri_cc.c
URL: http://svnview.digium.com/svn/libpri/branches/1.4/pri_cc.c?view=diff&rev=2232&r1=2231&r2=2232
==============================================================================
--- branches/1.4/pri_cc.c (original)
+++ branches/1.4/pri_cc.c Mon Feb 28 17:20:25 2011
@@ -2504,14 +2504,13 @@
}
/*!
- * \internal
* \brief Convert the given call completion state to a string.
*
* \param state CC state to convert to string.
*
* \return String version of call completion state.
*/
-static const char *pri_cc_fsm_state_str(enum CC_STATES state)
+const char *pri_cc_fsm_state_str(enum CC_STATES state)
{
const char *str;
@@ -2555,14 +2554,13 @@
}
/*!
- * \internal
* \brief Convert the given call completion event to a string.
*
* \param event CC event to convert to string.
*
* \return String version of call completion event.
*/
-static const char *pri_cc_fsm_event_str(enum CC_EVENTS event)
+const char *pri_cc_fsm_event_str(enum CC_EVENTS event)
{
const char *str;
Modified: branches/1.4/pri_internal.h
URL: http://svnview.digium.com/svn/libpri/branches/1.4/pri_internal.h?view=diff&rev=2232&r1=2231&r2=2232
==============================================================================
--- branches/1.4/pri_internal.h (original)
+++ branches/1.4/pri_internal.h Mon Feb 28 17:20:25 2011
@@ -981,6 +981,7 @@
const char *q931_call_state_str(enum Q931_CALL_STATE callstate);
const char *msg2str(int msg);
+int q931_get_subcall_count(struct q931_call *master);
struct q931_call *q931_find_winning_call(struct q931_call *call);
int q931_master_pass_event(struct pri *ctrl, struct q931_call *subcall, int msg_type);
struct pri_subcommand *q931_alloc_subcommand(struct pri *ctrl);
@@ -997,6 +998,8 @@
struct pri_cc_record *pri_cc_find_by_addressing(struct pri *ctrl, const struct q931_party_address *party_a, const struct q931_party_address *party_b, unsigned length, const unsigned char *q931_ies);
struct pri_cc_record *pri_cc_new_record(struct pri *ctrl, q931_call *call);
void pri_cc_qsig_determine_available(struct pri *ctrl, q931_call *call);
+const char *pri_cc_fsm_state_str(enum CC_STATES state);
+const char *pri_cc_fsm_event_str(enum CC_EVENTS event);
int pri_cc_event(struct pri *ctrl, q931_call *call, struct pri_cc_record *cc_record, enum CC_EVENTS event);
int q931_cc_timeout(struct pri *ctrl, struct pri_cc_record *cc_record, enum CC_EVENTS event);
void q931_cc_indirect(struct pri *ctrl, struct pri_cc_record *cc_record, void (*func)(struct pri *ctrl, q931_call *call, struct pri_cc_record *cc_record));
Modified: branches/1.4/q931.c
URL: http://svnview.digium.com/svn/libpri/branches/1.4/q931.c?view=diff&rev=2232&r1=2231&r2=2232
==============================================================================
--- branches/1.4/q931.c (original)
+++ branches/1.4/q931.c Mon Feb 28 17:20:25 2011
@@ -4199,6 +4199,20 @@
}
}
free(cur);
+}
+
+int q931_get_subcall_count(struct q931_call *master)
+{
+ int count = 0;
+ int idx;
+
+ for (idx = 0; idx < ARRAY_LEN(master->subcalls); ++idx) {
+ if (master->subcalls[idx]) {
+ ++count;
+ }
+ }
+
+ return count;
}
static void pri_create_fake_clearing(struct q931_call *c, struct pri *master);
@@ -6409,8 +6423,6 @@
c->retranstimer = pri_schedule_event(master, 0, pri_fake_clearing, c);
}
-//static int q931_get_subcall_count(struct q931_call *call);
-
static int __q931_hangup(struct pri *ctrl, q931_call *c, int cause)
{
int disconnect = 1;
@@ -6875,22 +6887,6 @@
}
}
}
-
-#if 0
-static int q931_get_subcall_count(struct q931_call *call)
-{
- int count = 0;
- int i;
-
- call = call->master_call;
- for (i = 0; i < ARRAY_LEN(call->subcalls); ++i) {
- if (call->subcalls[i])
- count++;
- }
-
- return count;
-}
-#endif
static void q931_set_subcall_winner(struct q931_call *subcall)
{
More information about the libpri-commits
mailing list