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(). git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2232 2fbb986a-6c06-0410-b554-c9c1f0a7f128
This commit is contained in:
parent
9effbfc130
commit
898bc57fce
76
pri.c
76
pri.c
@ -1710,6 +1710,10 @@ char *pri_dump_info_str(struct pri *ctrl)
|
||||
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,30 +1732,12 @@ char *pri_dump_info_str(struct pri *ctrl)
|
||||
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));
|
||||
/* 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);
|
||||
used = pri_snprintf(buf, used, buf_size, "Q921 RX: %d\n", ctrl->q921_rxcount);
|
||||
used = pri_snprintf(buf, used, buf_size, "Q921 TX: %d\n", ctrl->q921_txcount);
|
||||
for (link = &ctrl->link; link; link = link->next) {
|
||||
q921outstanding = 0;
|
||||
for (f = link->tx_queue; f; f = f->next) {
|
||||
++q921outstanding;
|
||||
}
|
||||
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);
|
||||
@ -1769,6 +1755,52 @@ char *pri_dump_info_str(struct pri *ctrl)
|
||||
}
|
||||
}
|
||||
|
||||
/* 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);
|
||||
used = pri_snprintf(buf, used, buf_size, "Q921 RX: %d\n", ctrl->q921_rxcount);
|
||||
used = pri_snprintf(buf, used, buf_size, "Q921 TX: %d\n", ctrl->q921_txcount);
|
||||
for (link = &ctrl->link; link; link = link->next) {
|
||||
q921outstanding = 0;
|
||||
for (f = link->tx_queue; f; f = f->next) {
|
||||
++q921outstanding;
|
||||
}
|
||||
used = pri_snprintf(buf, used, buf_size, "Q921 Outstanding: %u (TEI=%d)\n",
|
||||
q921outstanding, link->tei);
|
||||
}
|
||||
|
||||
/* 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) {
|
||||
pri_message(ctrl,
|
||||
"pri_dump_info_str(): Produced output exceeded buffer capacity. (Truncated)\n");
|
||||
|
6
pri_cc.c
6
pri_cc.c
@ -2504,14 +2504,13 @@ void pri_cc_qsig_exec_possible(struct pri *ctrl, q931_call *call, int msgtype, c
|
||||
}
|
||||
|
||||
/*!
|
||||
* \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 @@ static const char *pri_cc_fsm_state_str(enum CC_STATES state)
|
||||
}
|
||||
|
||||
/*!
|
||||
* \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;
|
||||
|
||||
|
@ -981,6 +981,7 @@ int q931_facility_display_name(struct pri *ctrl, struct q931_call *call, const s
|
||||
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_linkage(struct pri *ctrl, unsigned linkage_
|
||||
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));
|
||||
|
32
q931.c
32
q931.c
@ -4201,6 +4201,20 @@ static void cleanup_and_free_call(struct q931_call *cur)
|
||||
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);
|
||||
|
||||
void q931_destroycall(struct pri *ctrl, q931_call *c)
|
||||
@ -6409,8 +6423,6 @@ static void pri_create_fake_clearing(struct q931_call *c, struct pri *master)
|
||||
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;
|
||||
@ -6876,22 +6888,6 @@ static void initiate_hangup_if_needed(struct pri *ctrl, struct q931_call *subcal
|
||||
}
|
||||
}
|
||||
|
||||
#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)
|
||||
{
|
||||
struct q931_call *realcall = subcall->master_call;
|
||||
|
Loading…
Reference in New Issue
Block a user