freetdm: added trace type to raw traces

This commit is contained in:
David Yat Sin 2010-12-16 15:57:46 -05:00
parent 47c9773048
commit 48a1ae3896
4 changed files with 28 additions and 26 deletions

View File

@ -281,7 +281,10 @@ FTDM_ENUM_NAMES(SIGNALING_STATUS_NAMES, SIGSTATUS_STRINGS)
FTDM_STR2ENUM(ftdm_str2ftdm_signaling_status, ftdm_signaling_status2str, ftdm_signaling_status_t, SIGNALING_STATUS_NAMES, FTDM_SIG_STATE_INVALID)
FTDM_ENUM_NAMES(TRACE_DIR_NAMES, TRACE_DIR_STRINGS)
FTDM_STR2ENUM(ftdm_str2ftdm_trace_dir, ftdm_trace_dir2str, ftdm_trace_dir_t, TRACE_DIR_NAMES, FTDM_TRACE_INVALID)
FTDM_STR2ENUM(ftdm_str2ftdm_trace_dir, ftdm_trace_dir2str, ftdm_trace_dir_t, TRACE_DIR_NAMES, FTDM_TRACE_DIR_INVALID)
FTDM_ENUM_NAMES(TRACE_TYPE_NAMES, TRACE_TYPE_STRINGS)
FTDM_STR2ENUM(ftdm_str2ftdm_trace_type, ftdm_trace_type2str, ftdm_trace_type_t, TRACE_TYPE_NAMES, FTDM_TRACE_TYPE_INVALID)
FTDM_ENUM_NAMES(TON_NAMES, TON_STRINGS)
FTDM_STR2ENUM(ftdm_str2ftdm_ton, ftdm_ton2str, ftdm_ton_t, TON_NAMES, FTDM_TON_INVALID)
@ -2475,12 +2478,9 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_place(const char *file, const char
UNREFERENCED_PARAMETER(func);
UNREFERENCED_PARAMETER(line);
#endif
ftdm_wait_for_flag_cleared(ftdmchan, FTDM_CHANNEL_STATE_CHANGE, 100);
ftdm_call_set_call_id(&ftdmchan->caller_data);
ftdm_wait_for_flag_cleared(ftdmchan, FTDM_CHANNEL_STATE_CHANGE, 100);
ftdm_channel_unlock(ftdmchan);
return status;
}
@ -5117,14 +5117,6 @@ FT_DECLARE(ftdm_status_t) ftdm_configure_span_signaling(ftdm_span_t *span, const
FT_DECLARE(ftdm_status_t) ftdm_span_start(ftdm_span_t *span)
{
if (span->start) {
/* check the alarms again before starting the signaling module
this works-around some I/O modules (netborder I/O module) that cannot
check the alarm status before during configuration because the spans are
not really started yet at the I/O level */
if (ftdm_set_channels_alarms(span, 0) != FTDM_SUCCESS) {
ftdm_log(FTDM_LOG_ERROR, "%d: Failed to set channel alarms\n", span->span_id);
return FTDM_FAIL;
}
return span->start(span);
}

View File

@ -790,9 +790,9 @@ void sngisdn_rcv_q931_trace(InMngmt *trc, Buffer *mBuf)
mlen = ((SsMsgInfo*)(mBuf->b_rptr))->len;
if (trc->t.trc.evnt == TL3PKTTX) {
dir = FTDM_TRACE_OUTGOING;
dir = FTDM_TRACE_DIR_OUTGOING;
} else {
dir = FTDM_TRACE_INCOMING;
dir = FTDM_TRACE_DIR_INCOMING;
}
if (mlen) {
@ -837,9 +837,9 @@ void sngisdn_rcv_q921_trace(BdMngmt *trc, Buffer *mBuf)
}
if (trc->t.trc.evnt == TL2FRMTX) {
dir = FTDM_TRACE_OUTGOING;
dir = FTDM_TRACE_DIR_OUTGOING;
} else {
dir = FTDM_TRACE_INCOMING;
dir = FTDM_TRACE_DIR_INCOMING;
}
ftdm_assert(mBuf != NULLP, "Received a Q921 trace with no buffer");

View File

@ -118,8 +118,8 @@ void sngisdn_trace_raw_q921(sngisdn_span_data_t *signal_data, ftdm_trace_dir_t d
sigev.channel = signal_data->dchan;
sigev.event_id = FTDM_SIGEVENT_TRACE_RAW;
sigev.ev_data.logevent.dir = dir;
sigev.ev_data.logevent.level = 2;
sigev.ev_data.trace.dir = dir;
sigev.ev_data.trace.type = FTDM_TRACE_TYPE_Q921;
/* TODO: Map trace to call ID here */
sigev.call_id = 0;
@ -226,8 +226,8 @@ void sngisdn_trace_raw_q931(sngisdn_span_data_t *signal_data, ftdm_trace_dir_t d
sigev.channel = signal_data->dchan;
sigev.event_id = FTDM_SIGEVENT_TRACE_RAW;
sigev.ev_data.logevent.dir = dir;
sigev.ev_data.logevent.level = 3;
sigev.ev_data.trace.dir = dir;
sigev.ev_data.trace.type = FTDM_TRACE_TYPE_Q931;
/* TODO: Map trace to call ID here */

View File

@ -390,21 +390,31 @@ typedef struct {
typedef enum {
/* This is an received frame */
FTDM_TRACE_INCOMING,
FTDM_TRACE_DIR_INCOMING,
/* This is a transmitted frame */
FTDM_TRACE_OUTGOING,
FTDM_TRACE_DIR_OUTGOING,
/* Invalid */
FTDM_TRACE_INVALID,
FTDM_TRACE_DIR_INVALID,
} ftdm_trace_dir_t;
#define TRACE_DIR_STRINGS "INCOMING", "OUTGOING", "INVALID"
/*! \brief Move string to ftdm_trace_dir_t and viceversa */
FTDM_STR2ENUM_P(ftdm_str2ftdm_trace_dir, ftdm_trace_dir2str, ftdm_trace_dir_t)
typedef enum {
FTDM_TRACE_TYPE_Q931,
FTDM_TRACE_TYPE_Q921,
FTDM_TRACE_TYPE_INVALID,
} ftdm_trace_type_t;
#define TRACE_TYPE_STRINGS "Q931", "Q921", "INVALID"
/*! \brief Move string to ftdm_trace_type_t and viceversa */
FTDM_STR2ENUM_P(ftdm_str2ftdm_trace_type, ftdm_trace_type2str, ftdm_trace_type_t)
typedef struct {
/* Direction - incoming or outgoing */
ftdm_trace_dir_t dir;
uint8_t level; /* 1 for phy layer, 2 for q921/mtp2, 3 for q931/mtp3 */
ftdm_trace_type_t type;
} ftdm_event_trace_t;
/*! \brief Generic signaling message */
@ -418,7 +428,7 @@ struct ftdm_sigmsg {
uint32_t call_id; /*!< unique call id for this call */
union {
ftdm_event_sigstatus_t sigstatus; /*!< valid if event_id is FTDM_SIGEVENT_SIGSTATUS_CHANGED */
ftdm_event_trace_t logevent; /*!< valid if event_id is FTDM_SIGEVENT_TRACE or FTDM_SIGEVENT_TRACE_RAW */
ftdm_event_trace_t trace; /*!< valid if event_id is FTDM_SIGEVENT_TRACE or FTDM_SIGEVENT_TRACE_RAW */
}ev_data;
};